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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-inl.h" 9 #include "src/compiler/graph-inl.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 if (lower()) node->set_op(lowering->machine()->WordEqual()); 519 if (lower()) node->set_op(lowering->machine()->WordEqual());
520 break; 520 break;
521 } 521 }
522 case IrOpcode::kStringEqual: { 522 case IrOpcode::kStringEqual: {
523 VisitBinop(node, kMachAnyTagged, kRepBit); 523 VisitBinop(node, kMachAnyTagged, kRepBit);
524 if (lower()) lowering->DoStringEqual(node); 524 if (lower()) lowering->DoStringEqual(node);
525 break; 525 break;
526 } 526 }
527 case IrOpcode::kStringLessThan: { 527 case IrOpcode::kStringLessThan: {
528 VisitBinop(node, kMachAnyTagged, kRepBit); 528 VisitBinop(node, kMachAnyTagged, kRepBit);
529 // TODO(titzer): lower StringLessThan to stub/runtime call. 529 if (lower()) lowering->DoStringLessThan(node);
530 break; 530 break;
531 } 531 }
532 case IrOpcode::kStringLessThanOrEqual: { 532 case IrOpcode::kStringLessThanOrEqual: {
533 VisitBinop(node, kMachAnyTagged, kRepBit); 533 VisitBinop(node, kMachAnyTagged, kRepBit);
534 // TODO(titzer): lower StringLessThanOrEqual to stub/runtime call. 534 if (lower()) lowering->DoStringLessThanOrEqual(node);
535 break; 535 break;
536 } 536 }
537 case IrOpcode::kStringAdd: { 537 case IrOpcode::kStringAdd: {
538 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); 538 VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
539 if (lower()) lowering->DoStringAdd(node); 539 if (lower()) lowering->DoStringAdd(node);
540 break; 540 break;
541 } 541 }
542 case IrOpcode::kLoadField: { 542 case IrOpcode::kLoadField: {
543 FieldAccess access = FieldAccessOf(node->op()); 543 FieldAccess access = FieldAccessOf(node->op());
544 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 544 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 848 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
849 CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone()); 849 CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone());
850 node->set_op(common()->Call(desc)); 850 node->set_op(common()->Call(desc));
851 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode())); 851 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode()));
852 node->AppendInput(zone(), jsgraph()->UndefinedConstant()); 852 node->AppendInput(zone(), jsgraph()->UndefinedConstant());
853 node->AppendInput(zone(), graph()->start()); 853 node->AppendInput(zone(), graph()->start());
854 node->AppendInput(zone(), graph()->start()); 854 node->AppendInput(zone(), graph()->start());
855 } 855 }
856 856
857 857
858 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) {
859 CEntryStub stub(zone()->isolate(), 1);
860 Runtime::FunctionId f =
861 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals;
862 ExternalReference ref(f, zone()->isolate());
863 Operator::Properties props = node->op()->properties();
864 // TODO(mstarzinger): We should call StringCompareStub here instead, once an
865 // interface descriptor is available for it.
866 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(f, 2, props, zone());
867 return graph()->NewNode(common()->Call(desc),
868 jsgraph()->HeapConstant(stub.GetCode()),
869 NodeProperties::GetValueInput(node, 0),
870 NodeProperties::GetValueInput(node, 1),
871 jsgraph()->ExternalConstant(ref),
872 jsgraph()->Int32Constant(2),
873 jsgraph()->UndefinedConstant());
874 }
875
876
858 void SimplifiedLowering::DoStringEqual(Node* node) { 877 void SimplifiedLowering::DoStringEqual(Node* node) {
859 CEntryStub stub(zone()->isolate(), 1);
860 ExternalReference ref(Runtime::kStringEquals, zone()->isolate());
861 Operator::Properties props = node->op()->properties();
862 // TODO(mstarzinger): We should call StringCompareStub here instead, once an
863 // interface descriptor is available for it.
864 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
865 Runtime::kStringEquals, 2, props, zone());
866 Node* call = graph()->NewNode(common()->Call(desc),
867 jsgraph()->HeapConstant(stub.GetCode()),
868 NodeProperties::GetValueInput(node, 0),
869 NodeProperties::GetValueInput(node, 1),
870 jsgraph()->ExternalConstant(ref),
871 jsgraph()->Int32Constant(2),
872 jsgraph()->UndefinedConstant());
873 node->set_op(machine()->WordEqual()); 878 node->set_op(machine()->WordEqual());
874 node->ReplaceInput(0, call); 879 node->ReplaceInput(0, StringComparison(node, false));
875 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 880 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
876 } 881 }
877 882
883
884 void SimplifiedLowering::DoStringLessThan(Node* node) {
885 node->set_op(machine()->IntLessThan());
886 node->ReplaceInput(0, StringComparison(node, true));
887 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
888 }
889
890
891 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
892 node->set_op(machine()->IntLessThanOrEqual());
893 node->ReplaceInput(0, StringComparison(node, true));
894 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
895 }
896
878 897
879 } // namespace compiler 898 } // namespace compiler
880 } // namespace internal 899 } // namespace internal
881 } // namespace v8 900 } // namespace v8
OLDNEW
« 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