OLD | NEW |
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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 case IrOpcode::kStringLessThan: { | 775 case IrOpcode::kStringLessThan: { |
776 VisitBinop(node, kMachAnyTagged, kRepBit); | 776 VisitBinop(node, kMachAnyTagged, kRepBit); |
777 if (lower()) lowering->DoStringLessThan(node); | 777 if (lower()) lowering->DoStringLessThan(node); |
778 break; | 778 break; |
779 } | 779 } |
780 case IrOpcode::kStringLessThanOrEqual: { | 780 case IrOpcode::kStringLessThanOrEqual: { |
781 VisitBinop(node, kMachAnyTagged, kRepBit); | 781 VisitBinop(node, kMachAnyTagged, kRepBit); |
782 if (lower()) lowering->DoStringLessThanOrEqual(node); | 782 if (lower()) lowering->DoStringLessThanOrEqual(node); |
783 break; | 783 break; |
784 } | 784 } |
785 case IrOpcode::kStringAdd: { | |
786 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); | |
787 if (lower()) lowering->DoStringAdd(node); | |
788 break; | |
789 } | |
790 case IrOpcode::kAllocate: { | 785 case IrOpcode::kAllocate: { |
791 ProcessInput(node, 0, kMachAnyTagged); | 786 ProcessInput(node, 0, kMachAnyTagged); |
792 ProcessRemainingInputs(node, 1); | 787 ProcessRemainingInputs(node, 1); |
793 SetOutput(node, kMachAnyTagged); | 788 SetOutput(node, kMachAnyTagged); |
794 if (lower()) lowering->DoAllocate(node); | 789 if (lower()) lowering->DoAllocate(node); |
795 break; | 790 break; |
796 } | 791 } |
797 case IrOpcode::kLoadField: { | 792 case IrOpcode::kLoadField: { |
798 FieldAccess access = FieldAccessOf(node->op()); | 793 FieldAccess access = FieldAccessOf(node->op()); |
799 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 794 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 const ElementAccess& access = ElementAccessOf(node->op()); | 1301 const ElementAccess& access = ElementAccessOf(node->op()); |
1307 Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper; | 1302 Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper; |
1308 node->set_op(machine()->Store( | 1303 node->set_op(machine()->Store( |
1309 StoreRepresentation(access.machine_type, | 1304 StoreRepresentation(access.machine_type, |
1310 ComputeWriteBarrierKind(access.base_is_tagged, | 1305 ComputeWriteBarrierKind(access.base_is_tagged, |
1311 access.machine_type, type)))); | 1306 access.machine_type, type)))); |
1312 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 1307 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
1313 } | 1308 } |
1314 | 1309 |
1315 | 1310 |
1316 void SimplifiedLowering::DoStringAdd(Node* node) { | |
1317 Operator::Properties properties = node->op()->properties(); | |
1318 Callable callable = CodeFactory::StringAdd( | |
1319 jsgraph()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | |
1320 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | |
1321 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | |
1322 jsgraph()->isolate(), zone(), callable.descriptor(), 0, flags, | |
1323 properties); | |
1324 node->set_op(common()->Call(desc)); | |
1325 node->InsertInput(graph()->zone(), 0, | |
1326 jsgraph()->HeapConstant(callable.code())); | |
1327 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant()); | |
1328 node->AppendInput(graph()->zone(), graph()->start()); | |
1329 node->AppendInput(graph()->zone(), graph()->start()); | |
1330 } | |
1331 | |
1332 | |
1333 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { | 1311 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { |
1334 Runtime::FunctionId f = | 1312 Runtime::FunctionId f = |
1335 requires_ordering ? Runtime::kStringCompareRT : Runtime::kStringEquals; | 1313 requires_ordering ? Runtime::kStringCompareRT : Runtime::kStringEquals; |
1336 ExternalReference ref(f, jsgraph()->isolate()); | 1314 ExternalReference ref(f, jsgraph()->isolate()); |
1337 Operator::Properties props = node->op()->properties(); | 1315 Operator::Properties props = node->op()->properties(); |
1338 // TODO(mstarzinger): We should call StringCompareStub here instead, once an | 1316 // TODO(mstarzinger): We should call StringCompareStub here instead, once an |
1339 // interface descriptor is available for it. | 1317 // interface descriptor is available for it. |
1340 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); | 1318 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); |
1341 return graph()->NewNode(common()->Call(desc), | 1319 return graph()->NewNode(common()->Call(desc), |
1342 jsgraph()->CEntryStubConstant(1), | 1320 jsgraph()->CEntryStubConstant(1), |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 | 1591 |
1614 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1592 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1615 node->set_op(machine()->IntLessThanOrEqual()); | 1593 node->set_op(machine()->IntLessThanOrEqual()); |
1616 node->ReplaceInput(0, StringComparison(node, true)); | 1594 node->ReplaceInput(0, StringComparison(node, true)); |
1617 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1595 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1618 } | 1596 } |
1619 | 1597 |
1620 } // namespace compiler | 1598 } // namespace compiler |
1621 } // namespace internal | 1599 } // namespace internal |
1622 } // namespace v8 | 1600 } // namespace v8 |
OLD | NEW |