-
Enhancement
-
Resolution: Fixed
-
P4
-
22
-
b26
Right shift nodes currently return the bottom type when they encounter a right-hand input that isn't a constant. However, sometimes it's possible to use the type of the left-hand input to calculate a sharper type, even if we don't know anything about the right-hand side.
As an example, "ary.length >> y" knows that the bounds of the array length are [0, max_jint] and can propagate that to the right shift node, as the result of shift is always non-negative if the input is non-negative. This pattern is found in String#length, which shifts the array length by the coder to find the length.
As an example, "ary.length >> y" knows that the bounds of the array length are [0, max_jint] and can propagate that to the right shift node, as the result of shift is always non-negative if the input is non-negative. This pattern is found in String#length, which shifts the array length by the coder to find the length.