If a mov instruction is meant to be patchable, we don't want to rewrite
it as a xor, since that removes the slot where we'd patch in the right
value later.
Also, make sure to set both size bits in the REX prefix for xoring a
register with itself.
When we know the value is a positive Int32 less than 0x7fffffff,
it's safe to just add 1 to it and use that as the final result.
This avoids the work of re-adding the INT32_TAG.
Compiler now has a BasicBlockData struct for each BasicBlock. The struct
contains all the stuff that we previously stored with the
Bytecode::BasicBlock.
This uses a new branch_if_both_int32() helper.
It's interesting to note that we can compare encoded Int32 values
without stripping the INT32_TAG, since it doesn't affect signedness
of values.
We now generate a fast path for cached `this` values. The first time
`this` is resolved within a function, we call out to C++, but then
all subsequent accesses will hit the cache in Register::this_value().
This necessitated making the JIT::Compiler aware of the current
Bytecode::Executable, since that's where all the string literals are
held, but that seems like a good thing.
These push a "valid" unwind context on the stack and check_exception()
now knows how to jump to the (catch) handler if present.
(finally) finalizers will require some more work, but with this change,
we now have basic support for try...catch. :^)
We now establish a stack of "unwind contexts" similar to what the
bytecode interpreter does, but here, it's a stack of structs with
addresses to the catch and finally blocks.
Unwind contexts also have a "valid" flag, and the root unwind context
(always present, pushed on JIT code entry) has valid=false, which we
interpret in check_exception() as "return and let our caller deal with
the exception".
Anything in Compiler that may generate an exception should now also
call check_exception() ASAP to emit the code for handling this.