Commit f13540e9 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Fix array masking for the length==index case.

Bug: chromium:798964
Change-Id: I48d6662d60765f04004b324f67ed3aadf11ee07b
Reviewed-on: https://chromium-review.googlesource.com/854132Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50421}
parent 784e2f5e
......@@ -1300,9 +1300,12 @@ Node* EffectControlLinearizer::LowerMaskIndexWithBound(Node* node) {
if (mask_array_index_ == kMaskArrayIndex) {
Node* limit = node->InputAt(1);
Node* mask = __ Word32Sar(__ Word32Or(__ Int32Sub(limit, index), index),
__ Int32Constant(31));
mask = __ Word32Xor(mask, __ Int32Constant(-1));
// mask = ((index - limit) & ~index) >> 31
// index = index & mask
Node* neg_index = __ Word32Xor(index, __ Int32Constant(-1));
Node* mask =
__ Word32Sar(__ Word32And(__ Int32Sub(index, limit), neg_index),
__ Int32Constant(31));
index = __ Word32And(index, mask);
}
return index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment