Chromium Code Reviews
DescriptionSplit TypeGuard and BailoutTarget.
By splitting the guard and the bailout-target we can merge more targets. Take for instance the following code:
x = a[i];
t = x << 4;
We can merge the bailout-targets for both guards to jump before the 'x'. This means that we will do more work (when we bail out), but it will reduce the code-size.
It also allows us to do the following optimization:
x = a[i]; // knowing that 'a' is a JS array.
if (x < 10) ...
=>
if (typeof i != 'number') bailout-to-1;
x = a[i];
if (typeof x != 'number') bailout-to-1;
if (x < 10) ...
Note that we don't do an integer check on 'i', and that we don't do an out-of-bounds check. Indeed, if i is out-of-bounds (or not an integer) then we will get 'undefined' back which is not a number. Since the bailout-target is before the array-access we will execute it again in bailout-code and correctly throw an exception there.
Committed: https://code.google.com/p/dart/source/detail?r=9813
Patch Set 1 #
Total comments: 8
Patch Set 2 : Address comments. #Patch Set 3 : Rebase. #
Messages
Total messages: 7 (0 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||