Commit eaef3617 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Use StringCompareStub for string comparisons.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1353103002

Cr-Commit-Position: refs/heads/master@{#30821}
parent cb2c2232
...@@ -1344,21 +1344,16 @@ void SimplifiedLowering::DoStoreElement(Node* node) { ...@@ -1344,21 +1344,16 @@ void SimplifiedLowering::DoStoreElement(Node* node) {
} }
Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { Node* SimplifiedLowering::StringComparison(Node* node) {
Runtime::FunctionId f = Operator::Properties properties = node->op()->properties();
requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals; Callable callable = CodeFactory::StringCompare(isolate());
ExternalReference ref(f, jsgraph()->isolate()); CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
Operator::Properties props = node->op()->properties(); CallDescriptor* desc = Linkage::GetStubCallDescriptor(
// TODO(mstarzinger): We should call StringCompareStub here instead, once an isolate(), zone(), callable.descriptor(), 0, flags, properties);
// interface descriptor is available for it. return graph()->NewNode(
CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); common()->Call(desc), jsgraph()->HeapConstant(callable.code()),
return graph()->NewNode(common()->Call(desc), NodeProperties::GetValueInput(node, 0),
jsgraph()->CEntryStubConstant(1), NodeProperties::GetValueInput(node, 1), jsgraph()->NoContextConstant());
NodeProperties::GetValueInput(node, 0),
NodeProperties::GetValueInput(node, 1),
jsgraph()->ExternalConstant(ref),
jsgraph()->Int32Constant(2),
jsgraph()->NoContextConstant());
} }
...@@ -1624,21 +1619,21 @@ void SimplifiedLowering::DoShift(Node* node, Operator const* op) { ...@@ -1624,21 +1619,21 @@ void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
void SimplifiedLowering::DoStringEqual(Node* node) { void SimplifiedLowering::DoStringEqual(Node* node) {
node->set_op(machine()->WordEqual()); node->set_op(machine()->WordEqual());
node->ReplaceInput(0, StringComparison(node, false)); node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
} }
void SimplifiedLowering::DoStringLessThan(Node* node) { void SimplifiedLowering::DoStringLessThan(Node* node) {
node->set_op(machine()->IntLessThan()); node->set_op(machine()->IntLessThan());
node->ReplaceInput(0, StringComparison(node, true)); node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
} }
void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
node->set_op(machine()->IntLessThanOrEqual()); node->set_op(machine()->IntLessThanOrEqual());
node->ReplaceInput(0, StringComparison(node, true)); node->ReplaceInput(0, StringComparison(node));
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
} }
......
...@@ -59,7 +59,7 @@ class SimplifiedLowering final { ...@@ -59,7 +59,7 @@ class SimplifiedLowering final {
Node* Untag(Node* node); Node* Untag(Node* node);
Node* OffsetMinusTagConstant(int32_t offset); Node* OffsetMinusTagConstant(int32_t offset);
Node* ComputeIndex(const ElementAccess& access, Node* const key); Node* ComputeIndex(const ElementAccess& access, Node* const key);
Node* StringComparison(Node* node, bool requires_ordering); Node* StringComparison(Node* node);
Node* Int32Div(Node* const node); Node* Int32Div(Node* const node);
Node* Int32Mod(Node* const node); Node* Int32Mod(Node* const node);
Node* Uint32Div(Node* const node); Node* Uint32Div(Node* const node);
...@@ -67,6 +67,7 @@ class SimplifiedLowering final { ...@@ -67,6 +67,7 @@ class SimplifiedLowering final {
friend class RepresentationSelector; friend class RepresentationSelector;
Isolate* isolate() { return jsgraph_->isolate(); }
Zone* zone() { return jsgraph_->zone(); } Zone* zone() { return jsgraph_->zone(); }
JSGraph* jsgraph() { return jsgraph_; } JSGraph* jsgraph() { return jsgraph_; }
Graph* graph() { return jsgraph()->graph(); } Graph* graph() { return jsgraph()->graph(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment