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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 MachineType machine_type; | 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 = kMachPtr) |
35 : zone_(zone), word_(word) { | 35 : zone_(zone), word_(word) { |
36 CHECK(word == kRepWord32 || word == kRepWord64); | 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_) \ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Floating point comparisons complying to IEEE 754. | 150 // Floating point comparisons complying to IEEE 754. |
151 Operator* Float64Equal() { BINOP_C(Float64Equal); } | 151 Operator* Float64Equal() { BINOP_C(Float64Equal); } |
152 Operator* Float64LessThan() { BINOP(Float64LessThan); } | 152 Operator* Float64LessThan() { BINOP(Float64LessThan); } |
153 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } | 153 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } |
154 | 154 |
155 inline bool is32() const { return word_ == kRepWord32; } | 155 inline bool is32() const { return word_ == kRepWord32; } |
156 inline bool is64() const { return word_ == kRepWord64; } | 156 inline bool is64() const { return word_ == kRepWord64; } |
157 inline MachineType word() const { return word_; } | 157 inline MachineType word() const { return word_; } |
158 | 158 |
159 static inline MachineType pointer_rep() { | |
160 return kPointerSize == 8 ? kRepWord64 : kRepWord32; | |
161 } | |
162 | |
163 #undef WORD_SIZE | 159 #undef WORD_SIZE |
164 #undef UNOP | 160 #undef UNOP |
165 #undef BINOP | 161 #undef BINOP |
166 #undef OP1 | 162 #undef OP1 |
167 #undef SIMPLE | 163 #undef SIMPLE |
168 | 164 |
169 private: | 165 private: |
170 Zone* zone_; | 166 Zone* zone_; |
171 MachineType word_; | 167 MachineType word_; |
172 }; | 168 }; |
173 } | 169 } |
174 } | 170 } |
175 } // namespace v8::internal::compiler | 171 } // namespace v8::internal::compiler |
176 | 172 |
177 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 173 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |