OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_MACHINE_OPERATOR_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 #include "src/compiler/operator.h" | 10 #include "src/compiler/operator.h" |
11 #include "src/zone.h" | 11 #include "src/zone.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 // TODO(turbofan): other write barriers are possible based on type | 17 // TODO(turbofan): other write barriers are possible based on type |
18 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; | 18 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; |
19 | 19 |
20 | 20 |
21 // A Store needs a MachineType and a WriteBarrierKind | 21 // A Store needs a MachineType and a WriteBarrierKind |
22 // in order to emit the correct write barrier. | 22 // in order to emit the correct write barrier. |
23 struct StoreRepresentation { | 23 struct StoreRepresentation { |
24 MachineType rep; | 24 MachineType machine_type; |
25 WriteBarrierKind write_barrier_kind; | 25 WriteBarrierKind write_barrier_kind; |
26 }; | 26 }; |
27 | 27 |
28 | 28 |
29 // Interface for building machine-level operators. These operators are | 29 // Interface for building machine-level operators. These operators are |
30 // machine-level but machine-independent and thus define a language suitable | 30 // machine-level but machine-independent and thus define a language suitable |
31 // for generating code to run on architectures such as ia32, x64, arm, etc. | 31 // for generating code to run on architectures such as ia32, x64, arm, etc. |
32 class MachineOperatorBuilder { | 32 class MachineOperatorBuilder { |
33 public: | 33 public: |
34 explicit MachineOperatorBuilder(Zone* zone, MachineType word = pointer_rep()) | 34 explicit MachineOperatorBuilder(Zone* zone, MachineType word = pointer_rep()) |
35 : zone_(zone), word_(word) { | 35 : zone_(zone), word_(word) { |
36 CHECK(word == kMachineWord32 || word == kMachineWord64); | 36 CHECK(word == kRepWord32 || word == kRepWord64); |
37 } | 37 } |
38 | 38 |
39 #define SIMPLE(name, properties, inputs, outputs) \ | 39 #define SIMPLE(name, properties, inputs, outputs) \ |
40 return new (zone_) \ | 40 return new (zone_) \ |
41 SimpleOperator(IrOpcode::k##name, properties, inputs, outputs, #name); | 41 SimpleOperator(IrOpcode::k##name, properties, inputs, outputs, #name); |
42 | 42 |
43 #define OP1(name, ptype, pname, properties, inputs, outputs) \ | 43 #define OP1(name, ptype, pname, properties, inputs, outputs) \ |
44 return new (zone_) \ | 44 return new (zone_) \ |
45 Operator1<ptype>(IrOpcode::k##name, properties | Operator::kNoThrow, \ | 45 Operator1<ptype>(IrOpcode::k##name, properties | Operator::kNoThrow, \ |
46 inputs, outputs, #name, pname) | 46 inputs, outputs, #name, pname) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 Operator* Float64Sub() { BINOP(Float64Sub); } | 139 Operator* Float64Sub() { BINOP(Float64Sub); } |
140 Operator* Float64Mul() { BINOP_C(Float64Mul); } | 140 Operator* Float64Mul() { BINOP_C(Float64Mul); } |
141 Operator* Float64Div() { BINOP(Float64Div); } | 141 Operator* Float64Div() { BINOP(Float64Div); } |
142 Operator* Float64Mod() { BINOP(Float64Mod); } | 142 Operator* Float64Mod() { BINOP(Float64Mod); } |
143 | 143 |
144 // Floating point comparisons complying to IEEE 754. | 144 // Floating point comparisons complying to IEEE 754. |
145 Operator* Float64Equal() { BINOP_C(Float64Equal); } | 145 Operator* Float64Equal() { BINOP_C(Float64Equal); } |
146 Operator* Float64LessThan() { BINOP(Float64LessThan); } | 146 Operator* Float64LessThan() { BINOP(Float64LessThan); } |
147 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } | 147 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } |
148 | 148 |
149 inline bool is32() const { return word_ == kMachineWord32; } | 149 inline bool is32() const { return word_ == kRepWord32; } |
150 inline bool is64() const { return word_ == kMachineWord64; } | 150 inline bool is64() const { return word_ == kRepWord64; } |
151 inline MachineType word() const { return word_; } | 151 inline MachineType word() const { return word_; } |
152 | 152 |
153 static inline MachineType pointer_rep() { | 153 static inline MachineType pointer_rep() { |
154 return kPointerSize == 8 ? kMachineWord64 : kMachineWord32; | 154 return kPointerSize == 8 ? kRepWord64 : kRepWord32; |
155 } | 155 } |
156 | 156 |
157 #undef WORD_SIZE | 157 #undef WORD_SIZE |
158 #undef UNOP | 158 #undef UNOP |
159 #undef BINOP | 159 #undef BINOP |
160 #undef OP1 | 160 #undef OP1 |
161 #undef SIMPLE | 161 #undef SIMPLE |
162 | 162 |
163 private: | 163 private: |
164 Zone* zone_; | 164 Zone* zone_; |
165 MachineType word_; | 165 MachineType word_; |
166 }; | 166 }; |
167 } | 167 } |
168 } | 168 } |
169 } // namespace v8::internal::compiler | 169 } // namespace v8::internal::compiler |
170 | 170 |
171 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 171 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |