X86: Use memory to do array range checks

Currently, an HBoundsCheck is fed by an HArrayLength, causing a load of
the array length, followed by a register compare.

Avoid the load when we can by comparing directly with the array length
in memory.  Implement this by marking the HArrayLength as 'emitted at
use site', and then generating the code in the HBoundsCheck.

Only do this replacement when we are the only user of the ArrayLength
and it isn't visible to the environment.

Handle the special case where the array is 'null' and where an implicit
null check can't be eliminated.

This code moves the load of the length to the slow code for the failed
check, which is what we want.

Test: 609-checker-x86-bounds-check

Change-Id: I9cdb183301e048234bb0ffeda940eedcf4a655bd
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
10 files changed