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 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Node* Store(MachineRepresentation rep, Node* base, Node* value, | 126 Node* Store(MachineRepresentation rep, Node* base, Node* value, |
127 WriteBarrierKind write_barrier) { | 127 WriteBarrierKind write_barrier) { |
128 return Store(rep, base, IntPtrConstant(0), value, write_barrier); | 128 return Store(rep, base, IntPtrConstant(0), value, write_barrier); |
129 } | 129 } |
130 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value, | 130 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value, |
131 WriteBarrierKind write_barrier) { | 131 WriteBarrierKind write_barrier) { |
132 return AddNode(machine()->Store(StoreRepresentation(rep, write_barrier)), | 132 return AddNode(machine()->Store(StoreRepresentation(rep, write_barrier)), |
133 base, index, value); | 133 base, index, value); |
134 } | 134 } |
135 | 135 |
| 136 // Unaligned memory operations |
| 137 Node* UnalignedLoad(MachineType rep, Node* base) { |
| 138 return UnalignedLoad(rep, base, IntPtrConstant(0)); |
| 139 } |
| 140 Node* UnalignedLoad(MachineType rep, Node* base, Node* index) { |
| 141 if (machine()->UnalignedLoadSupported(rep, 1)) { |
| 142 return AddNode(machine()->Load(rep), base, index); |
| 143 } else { |
| 144 return AddNode(machine()->UnalignedLoad(rep), base, index); |
| 145 } |
| 146 } |
| 147 Node* UnalignedStore(MachineRepresentation rep, Node* base, Node* value) { |
| 148 return UnalignedStore(rep, base, IntPtrConstant(0), value); |
| 149 } |
| 150 Node* UnalignedStore(MachineRepresentation rep, Node* base, Node* index, |
| 151 Node* value) { |
| 152 MachineType t = MachineType::TypeForRepresentation(rep); |
| 153 if (machine()->UnalignedStoreSupported(t, 1)) { |
| 154 return AddNode(machine()->Store(StoreRepresentation( |
| 155 rep, WriteBarrierKind::kNoWriteBarrier)), |
| 156 base, index, value); |
| 157 } else { |
| 158 return AddNode( |
| 159 machine()->UnalignedStore(UnalignedStoreRepresentation(rep)), base, |
| 160 index, value); |
| 161 } |
| 162 } |
| 163 |
136 // Atomic memory operations. | 164 // Atomic memory operations. |
137 Node* AtomicLoad(MachineType rep, Node* base, Node* index) { | 165 Node* AtomicLoad(MachineType rep, Node* base, Node* index) { |
138 return AddNode(machine()->AtomicLoad(rep), base, index); | 166 return AddNode(machine()->AtomicLoad(rep), base, index); |
139 } | 167 } |
140 Node* AtomicStore(MachineRepresentation rep, Node* base, Node* index, | 168 Node* AtomicStore(MachineRepresentation rep, Node* base, Node* index, |
141 Node* value) { | 169 Node* value) { |
142 return AddNode(machine()->AtomicStore(rep), base, index, value); | 170 return AddNode(machine()->AtomicStore(rep), base, index, value); |
143 } | 171 } |
144 | 172 |
145 // Arithmetic Operations. | 173 // Arithmetic Operations. |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // Parameters. | 671 // Parameters. |
644 Node* Parameter(size_t index); | 672 Node* Parameter(size_t index); |
645 | 673 |
646 // Pointer utilities. | 674 // Pointer utilities. |
647 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { | 675 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { |
648 return Load(rep, PointerConstant(address), Int32Constant(offset)); | 676 return Load(rep, PointerConstant(address), Int32Constant(offset)); |
649 } | 677 } |
650 Node* StoreToPointer(void* address, MachineRepresentation rep, Node* node) { | 678 Node* StoreToPointer(void* address, MachineRepresentation rep, Node* node) { |
651 return Store(rep, PointerConstant(address), node, kNoWriteBarrier); | 679 return Store(rep, PointerConstant(address), node, kNoWriteBarrier); |
652 } | 680 } |
| 681 Node* UnalignedLoadFromPointer(void* address, MachineType rep, |
| 682 int32_t offset = 0) { |
| 683 return UnalignedLoad(rep, PointerConstant(address), Int32Constant(offset)); |
| 684 } |
| 685 Node* UnalignedStoreToPointer(void* address, MachineRepresentation rep, |
| 686 Node* node) { |
| 687 return UnalignedStore(rep, PointerConstant(address), node); |
| 688 } |
653 Node* StringConstant(const char* string) { | 689 Node* StringConstant(const char* string) { |
654 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); | 690 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); |
655 } | 691 } |
656 | 692 |
657 // Call a given call descriptor and the given arguments. | 693 // Call a given call descriptor and the given arguments. |
658 Node* CallN(CallDescriptor* desc, Node* function, Node** args); | 694 Node* CallN(CallDescriptor* desc, Node* function, Node** args); |
659 // Call a given call descriptor and the given arguments and frame-state. | 695 // Call a given call descriptor and the given arguments and frame-state. |
660 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, | 696 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, |
661 Node* frame_state); | 697 Node* frame_state); |
662 // Call to a runtime function with zero arguments. | 698 // Call to a runtime function with zero arguments. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 bool deferred_; | 831 bool deferred_; |
796 friend class RawMachineAssembler; | 832 friend class RawMachineAssembler; |
797 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 833 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
798 }; | 834 }; |
799 | 835 |
800 } // namespace compiler | 836 } // namespace compiler |
801 } // namespace internal | 837 } // namespace internal |
802 } // namespace v8 | 838 } // namespace v8 |
803 | 839 |
804 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 840 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |