Commit 8567093b authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[turbofan] Improve code generation for CheckSeqString.

The CheckSeqString operator unnecessarily materialized two bits for the
separate conditions, but we can actually check for SeqString with just a
single mask instead, which saves the intermediate computations and two
registers.

Bug: v8:5267
Change-Id: Ib937a5a4eebdc271a2bbbc6f074f5992e06b2fa9
Reviewed-on: https://chromium-review.googlesource.com/741702Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49023}
parent 0742e623
......@@ -1433,16 +1433,12 @@ Node* EffectControlLinearizer::LowerCheckSeqString(Node* node,
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);
Node* is_string = __ Uint32LessThan(value_instance_type,
__ Uint32Constant(FIRST_NONSTRING_TYPE));
Node* is_sequential =
__ Word32Equal(__ Word32And(value_instance_type,
__ Int32Constant(kStringRepresentationMask)),
__ Int32Constant(kSeqStringTag));
Node* is_sequential_string = __ Word32And(is_string, is_sequential);
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, is_sequential_string,
frame_state);
Node* check = __ Word32Equal(
__ Word32And(
value_instance_type,
__ Int32Constant(kStringRepresentationMask | kIsNotStringMask)),
__ Int32Constant(kSeqStringTag | kStringTag));
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, check, frame_state);
return value;
}
......
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