Chromium Code Reviews| Index: src/compiler/effect-control-linearizer.cc |
| diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc |
| index 0a8fbd900d9ddafe7f95c1c1146961e6bfaa193d..d4b361738f691604e18bb5dd059a716b48bfcb29 100644 |
| --- a/src/compiler/effect-control-linearizer.cc |
| +++ b/src/compiler/effect-control-linearizer.cc |
| @@ -2232,16 +2232,16 @@ EffectControlLinearizer::LowerStringCharCodeAt(Node* node, Node* effect, |
| Node* index = node->InputAt(1); |
| // We may need to loop several times for ConsString/SlicedString {subject}s. |
|
Igor Sheludko
2016/12/20 23:46:58
/ThinString
Jakob Kummerow
2017/01/04 12:45:06
Done.
|
| - Node* loop = |
| - graph()->NewNode(common()->Loop(4), control, control, control, control); |
| + Node* loop = graph()->NewNode(common()->Loop(5), control, control, control, |
| + control, control); |
| Node* lsubject = |
| - graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 4), |
| - subject, subject, subject, subject, loop); |
| + graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 5), |
| + subject, subject, subject, subject, subject, loop); |
| Node* lindex = |
| - graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 4), index, |
| - index, index, index, loop); |
| - Node* leffect = graph()->NewNode(common()->EffectPhi(4), effect, effect, |
| - effect, effect, loop); |
| + graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 5), index, |
| + index, index, index, index, loop); |
| + Node* leffect = graph()->NewNode(common()->EffectPhi(5), effect, effect, |
| + effect, effect, effect, loop); |
| control = loop; |
| effect = leffect; |
| @@ -2456,21 +2456,48 @@ EffectControlLinearizer::LowerStringCharCodeAt(Node* node, Node* effect, |
| Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2); |
| Node* efalse2 = efalse1; |
| { |
| - // The {lsubject} is a SlicedString, continue with its parent. |
| - Node* lsubject_parent = efalse2 = graph()->NewNode( |
| - simplified()->LoadField(AccessBuilder::ForSlicedStringParent()), |
| - lsubject, efalse2, if_false2); |
| - Node* lsubject_offset = efalse2 = graph()->NewNode( |
| - simplified()->LoadField(AccessBuilder::ForSlicedStringOffset()), |
| - lsubject, efalse2, if_false2); |
| - Node* lsubject_index = graph()->NewNode( |
| - machine()->Int32Add(), lindex, ChangeSmiToInt32(lsubject_offset)); |
| - |
| - // Retry the {loop} with the parent subject. |
| - loop->ReplaceInput(3, if_false2); |
| - leffect->ReplaceInput(3, efalse2); |
| - lindex->ReplaceInput(3, lsubject_index); |
| - lsubject->ReplaceInput(3, lsubject_parent); |
| + // Check if the {lsubject} is a SlicedString. |
| + Node* check3 = graph()->NewNode( |
| + machine()->Word32Equal(), |
| + graph()->NewNode( |
| + machine()->Word32And(), lsubject_instance_type, |
| + jsgraph()->Int32Constant(kStringRepresentationMask)), |
| + jsgraph()->Int32Constant(kSlicedStringTag)); |
| + Node* branch3 = graph()->NewNode(common()->Branch(), check3, if_false2); |
| + |
| + Node* if_true3 = graph()->NewNode(common()->IfTrue(), branch3); |
| + Node* etrue3 = efalse2; |
| + { |
| + // The {lsubject} is a SlicedString, continue with its parent. |
| + Node* lsubject_parent = etrue3 = graph()->NewNode( |
| + simplified()->LoadField(AccessBuilder::ForSlicedStringParent()), |
| + lsubject, etrue3, if_true3); |
| + Node* lsubject_offset = etrue3 = graph()->NewNode( |
| + simplified()->LoadField(AccessBuilder::ForSlicedStringOffset()), |
| + lsubject, etrue3, if_true3); |
| + Node* lsubject_index = graph()->NewNode( |
| + machine()->Int32Add(), lindex, ChangeSmiToInt32(lsubject_offset)); |
| + |
| + // Retry the {loop} with the parent subject. |
| + loop->ReplaceInput(3, if_true3); |
| + leffect->ReplaceInput(3, etrue3); |
| + lindex->ReplaceInput(3, lsubject_index); |
| + lsubject->ReplaceInput(3, lsubject_parent); |
| + } |
| + |
| + Node* if_false3 = graph()->NewNode(common()->IfFalse(), branch3); |
| + Node* efalse3 = efalse2; |
| + { |
| + // The {lsubject} is a ThinString, continue with its actual value. |
| + Node* lsubject_actual = efalse3 = graph()->NewNode( |
| + simplified()->LoadField(AccessBuilder::ForThinStringActual()), |
| + lsubject, efalse3, if_false3); |
| + |
| + // Retry the {loop} with the actual subject. |
| + loop->ReplaceInput(4, if_false3); |
| + leffect->ReplaceInput(4, efalse3); |
| + lsubject->ReplaceInput(4, lsubject_actual); |
| + } |
| } |
| if_false1 = if_true2; |