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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 531763002: Lower simplified StringEqual to runtime call. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 6 years, 3 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/simplified-lowering.h ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 67886a9acc816697123447db6cde098cf7a0c709..b8e7d8d4b6b9428780fc73c2f77029e4a653725c 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -506,7 +506,7 @@ class RepresentationSelector {
}
case IrOpcode::kStringEqual: {
VisitBinop(node, kMachAnyTagged, kRepBit);
- // TODO(titzer): lower StringEqual to stub/runtime call.
+ if (lower()) lowering->DoStringEqual(node);
break;
}
case IrOpcode::kStringLessThan: {
@@ -826,7 +826,7 @@ void SimplifiedLowering::DoStringAdd(Node* node) {
CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone());
- node->set_op(jsgraph()->common()->Call(desc));
+ node->set_op(common()->Call(desc));
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode()));
node->AppendInput(zone(), jsgraph()->UndefinedConstant());
node->AppendInput(zone(), graph()->start());
@@ -834,6 +834,27 @@ void SimplifiedLowering::DoStringAdd(Node* node) {
}
+void SimplifiedLowering::DoStringEqual(Node* node) {
+ CEntryStub stub(zone()->isolate(), 1);
+ ExternalReference ref(Runtime::kStringEquals, zone()->isolate());
+ Operator::Properties props = node->op()->properties();
+ // TODO(mstarzinger): We should call StringCompareStub here instead, once an
+ // interface descriptor is available for it.
+ CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
+ Runtime::kStringEquals, 2, props, zone());
+ Node* call = graph()->NewNode(common()->Call(desc),
+ jsgraph()->HeapConstant(stub.GetCode()),
+ NodeProperties::GetValueInput(node, 0),
+ NodeProperties::GetValueInput(node, 1),
+ jsgraph()->ExternalConstant(ref),
+ jsgraph()->Int32Constant(2),
+ jsgraph()->UndefinedConstant());
+ node->set_op(machine()->WordEqual());
+ node->ReplaceInput(0, call);
+ node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+}
+
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698