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

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

Issue 531093002: Lower simplified StringLessThan[OrEqual] 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/cctest.status » ('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 ab5551ace6592aa344459fe0e18d345a5b8ed503..960c93aaba1e583bd895f0a424c82d2b7034f404 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -526,12 +526,12 @@ class RepresentationSelector {
}
case IrOpcode::kStringLessThan: {
VisitBinop(node, kMachAnyTagged, kRepBit);
- // TODO(titzer): lower StringLessThan to stub/runtime call.
+ if (lower()) lowering->DoStringLessThan(node);
break;
}
case IrOpcode::kStringLessThanOrEqual: {
VisitBinop(node, kMachAnyTagged, kRepBit);
- // TODO(titzer): lower StringLessThanOrEqual to stub/runtime call.
+ if (lower()) lowering->DoStringLessThanOrEqual(node);
break;
}
case IrOpcode::kStringAdd: {
@@ -855,23 +855,42 @@ void SimplifiedLowering::DoStringAdd(Node* node) {
}
-void SimplifiedLowering::DoStringEqual(Node* node) {
+Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) {
CEntryStub stub(zone()->isolate(), 1);
- ExternalReference ref(Runtime::kStringEquals, zone()->isolate());
+ Runtime::FunctionId f =
+ requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals;
+ ExternalReference ref(f, 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());
+ CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(f, 2, props, zone());
+ return 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());
+}
+
+
+void SimplifiedLowering::DoStringEqual(Node* node) {
node->set_op(machine()->WordEqual());
- node->ReplaceInput(0, call);
+ node->ReplaceInput(0, StringComparison(node, false));
+ node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+}
+
+
+void SimplifiedLowering::DoStringLessThan(Node* node) {
+ node->set_op(machine()->IntLessThan());
+ node->ReplaceInput(0, StringComparison(node, true));
+ node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+}
+
+
+void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
+ node->set_op(machine()->IntLessThanOrEqual());
+ node->ReplaceInput(0, StringComparison(node, true));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
}
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698