Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1228)

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 1164743002: [turbofan] Enable typed lowering of string addition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698