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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Operator* Float64Sub() { BINOP(Float64Sub); } | 136 Operator* Float64Sub() { BINOP(Float64Sub); } |
137 Operator* Float64Mul() { BINOP_C(Float64Mul); } | 137 Operator* Float64Mul() { BINOP_C(Float64Mul); } |
138 Operator* Float64Div() { BINOP(Float64Div); } | 138 Operator* Float64Div() { BINOP(Float64Div); } |
139 Operator* Float64Mod() { BINOP(Float64Mod); } | 139 Operator* Float64Mod() { BINOP(Float64Mod); } |
140 | 140 |
141 // Floating point comparisons complying to IEEE 754. | 141 // Floating point comparisons complying to IEEE 754. |
142 Operator* Float64Equal() { BINOP_C(Float64Equal); } | 142 Operator* Float64Equal() { BINOP_C(Float64Equal); } |
143 Operator* Float64LessThan() { BINOP(Float64LessThan); } | 143 Operator* Float64LessThan() { BINOP(Float64LessThan); } |
144 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } | 144 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } |
145 | 145 |
146 inline bool is32() const { return word_ == kMachineWord32; } | 146 inline bool is32() const { return word_ == kRepWord32; } |
147 inline bool is64() const { return word_ == kMachineWord64; } | 147 inline bool is64() const { return word_ == kRepWord64; } |
148 inline MachineType word() const { return word_; } | 148 inline MachineType word() const { return word_; } |
149 | 149 |
150 static inline MachineType pointer_rep() { | 150 static inline MachineType pointer_rep() { |
151 return kPointerSize == 8 ? kMachineWord64 : kMachineWord32; | 151 return kPointerSize == 8 ? kRepWord64 : kRepWord32; |
152 } | 152 } |
153 | 153 |
154 #undef WORD_SIZE | 154 #undef WORD_SIZE |
155 #undef UNOP | 155 #undef UNOP |
156 #undef BINOP | 156 #undef BINOP |
157 #undef OP1 | 157 #undef OP1 |
158 #undef SIMPLE | 158 #undef SIMPLE |
159 | 159 |
160 private: | 160 private: |
161 Zone* zone_; | 161 Zone* zone_; |
162 MachineType word_; | 162 MachineType word_; |
163 }; | 163 }; |
164 } | 164 } |
165 } | 165 } |
166 } // namespace v8::internal::compiler | 166 } // namespace v8::internal::compiler |
167 | 167 |
168 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 168 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |