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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // Constants. | 70 // Constants. |
71 Node* PointerConstant(void* value) { | 71 Node* PointerConstant(void* value) { |
72 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); | 72 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); |
73 } | 73 } |
74 Node* IntPtrConstant(intptr_t value) { | 74 Node* IntPtrConstant(intptr_t value) { |
75 // TODO(dcarney): mark generated code as unserializable if value != 0. | 75 // TODO(dcarney): mark generated code as unserializable if value != 0. |
76 return kPointerSize == 8 ? Int64Constant(value) | 76 return kPointerSize == 8 ? Int64Constant(value) |
77 : Int32Constant(static_cast<int>(value)); | 77 : Int32Constant(static_cast<int>(value)); |
78 } | 78 } |
79 Node* RelocatableIntPtrConstant(intptr_t value, RelocInfo::Mode rmode); | |
80 Node* Int32Constant(int32_t value) { | 79 Node* Int32Constant(int32_t value) { |
81 return AddNode(common()->Int32Constant(value)); | 80 return AddNode(common()->Int32Constant(value)); |
82 } | 81 } |
83 Node* StackSlot(MachineRepresentation rep) { | 82 Node* StackSlot(MachineRepresentation rep) { |
84 return AddNode(machine()->StackSlot(rep)); | 83 return AddNode(machine()->StackSlot(rep)); |
85 } | 84 } |
86 Node* Int64Constant(int64_t value) { | 85 Node* Int64Constant(int64_t value) { |
87 return AddNode(common()->Int64Constant(value)); | 86 return AddNode(common()->Int64Constant(value)); |
88 } | 87 } |
89 Node* NumberConstant(double value) { | 88 Node* NumberConstant(double value) { |
90 return AddNode(common()->NumberConstant(value)); | 89 return AddNode(common()->NumberConstant(value)); |
91 } | 90 } |
92 Node* Float32Constant(float value) { | 91 Node* Float32Constant(float value) { |
93 return AddNode(common()->Float32Constant(value)); | 92 return AddNode(common()->Float32Constant(value)); |
94 } | 93 } |
95 Node* Float64Constant(double value) { | 94 Node* Float64Constant(double value) { |
96 return AddNode(common()->Float64Constant(value)); | 95 return AddNode(common()->Float64Constant(value)); |
97 } | 96 } |
98 Node* HeapConstant(Handle<HeapObject> object) { | 97 Node* HeapConstant(Handle<HeapObject> object) { |
99 return AddNode(common()->HeapConstant(object)); | 98 return AddNode(common()->HeapConstant(object)); |
100 } | 99 } |
101 Node* BooleanConstant(bool value) { | 100 Node* BooleanConstant(bool value) { |
102 Handle<Object> object = isolate()->factory()->ToBoolean(value); | 101 Handle<Object> object = isolate()->factory()->ToBoolean(value); |
103 return HeapConstant(Handle<HeapObject>::cast(object)); | 102 return HeapConstant(Handle<HeapObject>::cast(object)); |
104 } | 103 } |
105 Node* ExternalConstant(ExternalReference address) { | 104 Node* ExternalConstant(ExternalReference address) { |
106 return AddNode(common()->ExternalConstant(address)); | 105 return AddNode(common()->ExternalConstant(address)); |
107 } | 106 } |
108 Node* RelocatableInt32Constant(int32_t value, RelocInfo::Mode rmode) { | |
109 return AddNode(common()->RelocatableInt32Constant(value, rmode)); | |
110 } | |
111 Node* RelocatableInt64Constant(int64_t value, RelocInfo::Mode rmode) { | |
112 return AddNode(common()->RelocatableInt64Constant(value, rmode)); | |
113 } | |
114 | 107 |
115 Node* Projection(int index, Node* a) { | 108 Node* Projection(int index, Node* a) { |
116 return AddNode(common()->Projection(index), a); | 109 return AddNode(common()->Projection(index), a); |
117 } | 110 } |
118 | 111 |
119 // Memory Operations. | 112 // Memory Operations. |
120 Node* Load(MachineType rep, Node* base) { | 113 Node* Load(MachineType rep, Node* base) { |
121 return Load(rep, base, IntPtrConstant(0)); | 114 return Load(rep, base, IntPtrConstant(0)); |
122 } | 115 } |
123 Node* Load(MachineType rep, Node* base, Node* index) { | 116 Node* Load(MachineType rep, Node* base, Node* index) { |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 bool deferred_; | 735 bool deferred_; |
743 friend class RawMachineAssembler; | 736 friend class RawMachineAssembler; |
744 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 737 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
745 }; | 738 }; |
746 | 739 |
747 } // namespace compiler | 740 } // namespace compiler |
748 } // namespace internal | 741 } // namespace internal |
749 } // namespace v8 | 742 } // namespace v8 |
750 | 743 |
751 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 744 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |