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

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

Issue 1353103002: [turbofan] Use StringCompareStub for string comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@StringCompare
Patch Set: Created 5 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') | no next file » | 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 1b2a9447aca868232dd6bc9105800e8de8d9729e..3f4b5b28a0ab460a2f55f7aa31215dc0c91da5f7 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1344,21 +1344,16 @@ void SimplifiedLowering::DoStoreElement(Node* node) {
}
-Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) {
- Runtime::FunctionId f =
- requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals;
- ExternalReference ref(f, jsgraph()->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(zone(), f, 2, props);
- return graph()->NewNode(common()->Call(desc),
- jsgraph()->CEntryStubConstant(1),
- NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1),
- jsgraph()->ExternalConstant(ref),
- jsgraph()->Int32Constant(2),
- jsgraph()->NoContextConstant());
+Node* SimplifiedLowering::StringComparison(Node* node) {
+ Operator::Properties properties = node->op()->properties();
+ Callable callable = CodeFactory::StringCompare(isolate());
+ CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(
+ isolate(), zone(), callable.descriptor(), 0, flags, properties);
+ return graph()->NewNode(
+ common()->Call(desc), jsgraph()->HeapConstant(callable.code()),
+ NodeProperties::GetValueInput(node, 0),
+ NodeProperties::GetValueInput(node, 1), jsgraph()->NoContextConstant());
}
@@ -1624,21 +1619,21 @@ void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
void SimplifiedLowering::DoStringEqual(Node* node) {
node->set_op(machine()->WordEqual());
- node->ReplaceInput(0, StringComparison(node, false));
+ node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
}
void SimplifiedLowering::DoStringLessThan(Node* node) {
node->set_op(machine()->IntLessThan());
- node->ReplaceInput(0, StringComparison(node, true));
+ node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
}
void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
node->set_op(machine()->IntLessThanOrEqual());
- node->ReplaceInput(0, StringComparison(node, true));
+ node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
}
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698