| 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 "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph-inl.h" | 10 #include "src/compiler/graph-inl.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 ProcessInput(node, 1, AssumeImplicitFloat32Change(access.machine_type)); | 589 ProcessInput(node, 1, AssumeImplicitFloat32Change(access.machine_type)); |
| 590 ProcessRemainingInputs(node, 2); | 590 ProcessRemainingInputs(node, 2); |
| 591 SetOutput(node, 0); | 591 SetOutput(node, 0); |
| 592 if (lower()) lowering->DoStoreField(node); | 592 if (lower()) lowering->DoStoreField(node); |
| 593 break; | 593 break; |
| 594 } | 594 } |
| 595 case IrOpcode::kLoadElement: { | 595 case IrOpcode::kLoadElement: { |
| 596 ElementAccess access = ElementAccessOf(node->op()); | 596 ElementAccess access = ElementAccessOf(node->op()); |
| 597 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 597 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 598 ProcessInput(node, 1, kMachInt32); // element index | 598 ProcessInput(node, 1, kMachInt32); // element index |
| 599 ProcessRemainingInputs(node, 2); | 599 ProcessInput(node, 2, kMachInt32); // length |
| 600 ProcessRemainingInputs(node, 3); |
| 600 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); | 601 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); |
| 601 if (lower()) lowering->DoLoadElement(node); | 602 if (lower()) lowering->DoLoadElement(node); |
| 602 break; | 603 break; |
| 603 } | 604 } |
| 604 case IrOpcode::kStoreElement: { | 605 case IrOpcode::kStoreElement: { |
| 605 ElementAccess access = ElementAccessOf(node->op()); | 606 ElementAccess access = ElementAccessOf(node->op()); |
| 606 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 607 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 607 ProcessInput(node, 1, kMachInt32); // element index | 608 ProcessInput(node, 1, kMachInt32); // element index |
| 608 ProcessInput(node, 2, AssumeImplicitFloat32Change(access.machine_type)); | 609 ProcessInput(node, 2, kMachInt32); // length |
| 609 ProcessRemainingInputs(node, 3); | 610 ProcessInput(node, 3, AssumeImplicitFloat32Change(access.machine_type)); |
| 611 ProcessRemainingInputs(node, 4); |
| 610 SetOutput(node, 0); | 612 SetOutput(node, 0); |
| 611 if (lower()) lowering->DoStoreElement(node); | 613 if (lower()) lowering->DoStoreElement(node); |
| 612 break; | 614 break; |
| 613 } | 615 } |
| 614 | 616 |
| 615 //------------------------------------------------------------------ | 617 //------------------------------------------------------------------ |
| 616 // Machine-level operators. | 618 // Machine-level operators. |
| 617 //------------------------------------------------------------------ | 619 //------------------------------------------------------------------ |
| 618 case IrOpcode::kLoad: { | 620 case IrOpcode::kLoad: { |
| 619 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 621 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 if (fixed_offset == 0) return index; | 862 if (fixed_offset == 0) return index; |
| 861 return graph()->NewNode(machine()->Int32Add(), index, | 863 return graph()->NewNode(machine()->Int32Add(), index, |
| 862 jsgraph()->Int32Constant(fixed_offset)); | 864 jsgraph()->Int32Constant(fixed_offset)); |
| 863 } | 865 } |
| 864 | 866 |
| 865 | 867 |
| 866 void SimplifiedLowering::DoLoadElement(Node* node) { | 868 void SimplifiedLowering::DoLoadElement(Node* node) { |
| 867 const ElementAccess& access = ElementAccessOf(node->op()); | 869 const ElementAccess& access = ElementAccessOf(node->op()); |
| 868 node->set_op(machine()->Load(access.machine_type)); | 870 node->set_op(machine()->Load(access.machine_type)); |
| 869 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 871 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
| 872 node->RemoveInput(2); |
| 870 } | 873 } |
| 871 | 874 |
| 872 | 875 |
| 873 void SimplifiedLowering::DoStoreElement(Node* node) { | 876 void SimplifiedLowering::DoStoreElement(Node* node) { |
| 874 const ElementAccess& access = ElementAccessOf(node->op()); | 877 const ElementAccess& access = ElementAccessOf(node->op()); |
| 875 WriteBarrierKind kind = ComputeWriteBarrierKind( | 878 WriteBarrierKind kind = ComputeWriteBarrierKind( |
| 876 access.base_is_tagged, access.machine_type, access.type); | 879 access.base_is_tagged, access.machine_type, access.type); |
| 877 node->set_op( | 880 node->set_op( |
| 878 machine()->Store(StoreRepresentation(access.machine_type, kind))); | 881 machine()->Store(StoreRepresentation(access.machine_type, kind))); |
| 879 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 882 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
| 883 node->RemoveInput(2); |
| 880 } | 884 } |
| 881 | 885 |
| 882 | 886 |
| 883 void SimplifiedLowering::DoStringAdd(Node* node) { | 887 void SimplifiedLowering::DoStringAdd(Node* node) { |
| 884 Callable callable = CodeFactory::StringAdd( | 888 Callable callable = CodeFactory::StringAdd( |
| 885 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | 889 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
| 886 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | 890 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
| 887 CallDescriptor* desc = | 891 CallDescriptor* desc = |
| 888 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone()); | 892 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone()); |
| 889 node->set_op(common()->Call(desc)); | 893 node->set_op(common()->Call(desc)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 934 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 931 node->set_op(machine()->IntLessThanOrEqual()); | 935 node->set_op(machine()->IntLessThanOrEqual()); |
| 932 node->ReplaceInput(0, StringComparison(node, true)); | 936 node->ReplaceInput(0, StringComparison(node, true)); |
| 933 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 937 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 934 } | 938 } |
| 935 | 939 |
| 936 | 940 |
| 937 } // namespace compiler | 941 } // namespace compiler |
| 938 } // namespace internal | 942 } // namespace internal |
| 939 } // namespace v8 | 943 } // namespace v8 |
| OLD | NEW |