[JIT] Close code cache race window

See http://b/issue?id=4271784 for details.

Three fixes:
   1.  Verify the code cache version hasn't changed between completion
       of the translation and registering it in JitTable
   2.  When code cache full detected during translating a trace, mark
       the "discard" flag on the work order.
   3.  [The actual cause of the bug] When doing a code cache flush,
       traverse the thread least and cancel any trace selections in
       progress.

Change-Id: Ifea70416d7d91637fb742fc8de11044a89358caa
3 files changed