Commit ca20218e authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Unify Smi checking for Check(Internalized)String.

Use the representation selector to insert appropriate Smi checks for
CheckString and CheckInternalizedString when necessary.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2637363002
Cr-Commit-Position: refs/heads/master@{#42434}
parent 2f089197
......@@ -1157,17 +1157,13 @@ Node* EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state) {
Node* EffectControlLinearizer::LowerCheckString(Node* node, Node* frame_state) {
Node* value = node->InputAt(0);
Node* check0 = ObjectIsSmi(value);
__ DeoptimizeIf(DeoptimizeReason::kSmi, check0, frame_state);
Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);
Node* check1 = __ Uint32LessThan(value_instance_type,
__ Uint32Constant(FIRST_NONSTRING_TYPE));
__ DeoptimizeUnless(DeoptimizeReason::kWrongInstanceType, check1,
frame_state);
Node* check = __ Uint32LessThan(value_instance_type,
__ Uint32Constant(FIRST_NONSTRING_TYPE));
__ DeoptimizeUnless(DeoptimizeReason::kWrongInstanceType, check, frame_state);
return value;
}
......@@ -1175,19 +1171,15 @@ Node* EffectControlLinearizer::LowerCheckInternalizedString(Node* node,
Node* frame_state) {
Node* value = node->InputAt(0);
Node* check0 = ObjectIsSmi(value);
__ DeoptimizeIf(DeoptimizeReason::kSmi, check0, frame_state);
Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);
Node* check1 = __ Word32Equal(
Node* check = __ Word32Equal(
__ Word32And(value_instance_type,
__ Int32Constant(kIsNotStringMask | kIsNotInternalizedMask)),
__ Int32Constant(kInternalizedTag));
__ DeoptimizeUnless(DeoptimizeReason::kWrongInstanceType, check1,
frame_state);
__ DeoptimizeUnless(DeoptimizeReason::kWrongInstanceType, check, frame_state);
return value;
}
......
......@@ -2282,7 +2282,7 @@ class RepresentationSelector {
MachineRepresentation::kTaggedPointer);
if (lower()) DeferReplacement(node, node->InputAt(0));
} else {
VisitUnop(node, UseInfo::AnyTagged(),
VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(),
MachineRepresentation::kTaggedPointer);
}
return;
......@@ -2323,7 +2323,7 @@ class RepresentationSelector {
MachineRepresentation::kTaggedPointer);
if (lower()) DeferReplacement(node, node->InputAt(0));
} else {
VisitUnop(node, UseInfo::AnyTagged(),
VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(),
MachineRepresentation::kTaggedPointer);
}
return;
......
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