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/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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 if (lower()) lowering->DoStoreElement(node); | 583 if (lower()) lowering->DoStoreElement(node); |
584 break; | 584 break; |
585 } | 585 } |
586 | 586 |
587 //------------------------------------------------------------------ | 587 //------------------------------------------------------------------ |
588 // Machine-level operators. | 588 // Machine-level operators. |
589 //------------------------------------------------------------------ | 589 //------------------------------------------------------------------ |
590 case IrOpcode::kLoad: { | 590 case IrOpcode::kLoad: { |
591 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 591 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
592 MachineType tBase = kRepTagged; | 592 MachineType tBase = kRepTagged; |
593 MachineType machine_type = OpParameter<MachineType>(node); | 593 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); |
594 ProcessInput(node, 0, tBase); // pointer or object | 594 ProcessInput(node, 0, tBase); // pointer or object |
595 ProcessInput(node, 1, kMachInt32); // index | 595 ProcessInput(node, 1, kMachInt32); // index |
596 ProcessRemainingInputs(node, 2); | 596 ProcessRemainingInputs(node, 2); |
597 SetOutput(node, machine_type); | 597 SetOutput(node, rep); |
598 break; | 598 break; |
599 } | 599 } |
600 case IrOpcode::kStore: { | 600 case IrOpcode::kStore: { |
601 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 601 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
602 MachineType tBase = kRepTagged; | 602 MachineType tBase = kRepTagged; |
603 StoreRepresentation rep = OpParameter<StoreRepresentation>(node); | 603 StoreRepresentation rep = OpParameter<StoreRepresentation>(node); |
604 ProcessInput(node, 0, tBase); // pointer or object | 604 ProcessInput(node, 0, tBase); // pointer or object |
605 ProcessInput(node, 1, kMachInt32); // index | 605 ProcessInput(node, 1, kMachInt32); // index |
606 ProcessInput(node, 2, rep.machine_type); | 606 ProcessInput(node, 2, rep.machine_type()); |
607 ProcessRemainingInputs(node, 3); | 607 ProcessRemainingInputs(node, 3); |
608 SetOutput(node, 0); | 608 SetOutput(node, 0); |
609 break; | 609 break; |
610 } | 610 } |
611 case IrOpcode::kWord32Shr: | 611 case IrOpcode::kWord32Shr: |
612 // We output unsigned int32 for shift right because JavaScript. | 612 // We output unsigned int32 for shift right because JavaScript. |
613 return VisitBinop(node, kRepWord32, kRepWord32 | kTypeUint32); | 613 return VisitBinop(node, kRepWord32, kRepWord32 | kTypeUint32); |
614 case IrOpcode::kWord32And: | 614 case IrOpcode::kWord32And: |
615 case IrOpcode::kWord32Or: | 615 case IrOpcode::kWord32Or: |
616 case IrOpcode::kWord32Xor: | 616 case IrOpcode::kWord32Xor: |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 node->set_op(machine_.Load(access.machine_type)); | 807 node->set_op(machine_.Load(access.machine_type)); |
808 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); | 808 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
809 node->InsertInput(zone(), 1, offset); | 809 node->InsertInput(zone(), 1, offset); |
810 } | 810 } |
811 | 811 |
812 | 812 |
813 void SimplifiedLowering::DoStoreField(Node* node) { | 813 void SimplifiedLowering::DoStoreField(Node* node) { |
814 const FieldAccess& access = FieldAccessOf(node->op()); | 814 const FieldAccess& access = FieldAccessOf(node->op()); |
815 WriteBarrierKind kind = ComputeWriteBarrierKind( | 815 WriteBarrierKind kind = ComputeWriteBarrierKind( |
816 access.base_is_tagged, access.machine_type, access.type); | 816 access.base_is_tagged, access.machine_type, access.type); |
817 node->set_op(machine_.Store(access.machine_type, kind)); | 817 node->set_op(machine_.Store(StoreRepresentation(access.machine_type, kind))); |
818 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); | 818 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
819 node->InsertInput(zone(), 1, offset); | 819 node->InsertInput(zone(), 1, offset); |
820 } | 820 } |
821 | 821 |
822 | 822 |
823 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, | 823 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, |
824 Node* index) { | 824 Node* index) { |
825 int element_size = ElementSizeOf(access.machine_type); | 825 int element_size = ElementSizeOf(access.machine_type); |
826 if (element_size != 1) { | 826 if (element_size != 1) { |
827 index = graph()->NewNode(machine()->Int32Mul(), | 827 index = graph()->NewNode(machine()->Int32Mul(), |
(...skipping 10 matching lines...) Expand all Loading... |
838 const ElementAccess& access = ElementAccessOf(node->op()); | 838 const ElementAccess& access = ElementAccessOf(node->op()); |
839 node->set_op(machine_.Load(access.machine_type)); | 839 node->set_op(machine_.Load(access.machine_type)); |
840 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 840 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
841 } | 841 } |
842 | 842 |
843 | 843 |
844 void SimplifiedLowering::DoStoreElement(Node* node) { | 844 void SimplifiedLowering::DoStoreElement(Node* node) { |
845 const ElementAccess& access = ElementAccessOf(node->op()); | 845 const ElementAccess& access = ElementAccessOf(node->op()); |
846 WriteBarrierKind kind = ComputeWriteBarrierKind( | 846 WriteBarrierKind kind = ComputeWriteBarrierKind( |
847 access.base_is_tagged, access.machine_type, access.type); | 847 access.base_is_tagged, access.machine_type, access.type); |
848 node->set_op(machine_.Store(access.machine_type, kind)); | 848 node->set_op(machine_.Store(StoreRepresentation(access.machine_type, kind))); |
849 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 849 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
850 } | 850 } |
851 | 851 |
852 | 852 |
853 void SimplifiedLowering::DoStringAdd(Node* node) { | 853 void SimplifiedLowering::DoStringAdd(Node* node) { |
854 StringAddStub stub(zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | 854 StringAddStub stub(zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
855 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); | 855 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); |
856 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | 856 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
857 CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone()); | 857 CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone()); |
858 node->set_op(common()->Call(desc)); | 858 node->set_op(common()->Call(desc)); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 899 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
900 node->set_op(machine()->IntLessThanOrEqual()); | 900 node->set_op(machine()->IntLessThanOrEqual()); |
901 node->ReplaceInput(0, StringComparison(node, true)); | 901 node->ReplaceInput(0, StringComparison(node, true)); |
902 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 902 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
903 } | 903 } |
904 | 904 |
905 | 905 |
906 } // namespace compiler | 906 } // namespace compiler |
907 } // namespace internal | 907 } // namespace internal |
908 } // namespace v8 | 908 } // namespace v8 |
OLD | NEW |