When the defendant is convicted or acquitted or has been once placed in jeopardy upon an accusatory pleading, the conviction, acquittal, or jeopardy is a bar to another prosecution for the offense charged in such accusatory pleading, or for an attempt to commit the same, or for an offense necessarily included therein, of which he might have been convicted under that accusatory pleading.