Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 61f23ca82ac7c7b897f841b3622886472f8f94f8..4a4bcbfd6516c8d4c992afc4b84544d530e83f87 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -370,20 +370,20 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) { |
r.ConvertInputsToNumber(frame_state); |
return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number()); |
} |
-#if 0 |
- // TODO(turbofan): Lowering of StringAdd is disabled for now because: |
- // a) The inserted ToString operation screws up valueOf vs. toString order. |
- // b) Deoptimization at ToString doesn't have corresponding bailout id. |
- // c) Our current StringAddStub is actually non-pure and requires context. |
- if ((r.OneInputIs(Type::String()) && !r.IsStrong()) || |
- r.BothInputsAre(Type::String())) { |
- // JSAdd(x:string, y:string) => StringAdd(x, y) |
- // JSAdd(x:string, y) => StringAdd(x, ToString(y)) |
- // JSAdd(x, y:string) => StringAdd(ToString(x), y) |
- r.ConvertInputsToString(); |
- return r.ChangeToPureOperator(simplified()->StringAdd()); |
- } |
-#endif |
+ if (r.BothInputsAre(Type::String())) { |
+ // JSAdd(x:string, y:string) => CallStub[StringAdd](x, y) |
+ Callable const callable = |
+ CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
+ CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( |
+ isolate(), graph()->zone(), callable.descriptor(), 0, |
+ CallDescriptor::kNeedsFrameState, node->op()->properties()); |
+ DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); |
+ node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
+ node->InsertInput(graph()->zone(), 0, |
+ jsgraph()->HeapConstant(callable.code())); |
+ node->set_op(common()->Call(desc)); |
+ return Changed(node); |
+ } |
return NoChange(); |
} |
@@ -1467,6 +1467,9 @@ Factory* JSTypedLowering::factory() const { return jsgraph()->factory(); } |
Graph* JSTypedLowering::graph() const { return jsgraph()->graph(); } |
+Isolate* JSTypedLowering::isolate() const { return jsgraph()->isolate(); } |
+ |
+ |
JSOperatorBuilder* JSTypedLowering::javascript() const { |
return jsgraph()->javascript(); |
} |