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 machine_type; | 24 MachineType machine_type; |
25 WriteBarrierKind write_barrier_kind; | 25 WriteBarrierKind write_barrier_kind; |
26 }; | 26 }; |
27 | 27 |
28 | 28 |
| 29 // TODO(bmeurer): Phi will probably also need this in the future. |
| 30 template <> |
| 31 struct StaticParameterTraits<MachineType> { |
| 32 static OStream& PrintTo(OStream& os, MachineType type) { // NOLINT |
| 33 return os << type; |
| 34 } |
| 35 static int HashCode(MachineType type) { return type; } |
| 36 static bool Equals(MachineType lhs, MachineType rhs) { return lhs == rhs; } |
| 37 }; |
| 38 |
| 39 |
29 // Interface for building machine-level operators. These operators are | 40 // Interface for building machine-level operators. These operators are |
30 // machine-level but machine-independent and thus define a language suitable | 41 // 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. | 42 // for generating code to run on architectures such as ia32, x64, arm, etc. |
32 class MachineOperatorBuilder { | 43 class MachineOperatorBuilder { |
33 public: | 44 public: |
34 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr) | 45 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr) |
35 : zone_(zone), word_(word) { | 46 : zone_(zone), word_(word) { |
36 CHECK(word == kRepWord32 || word == kRepWord64); | 47 CHECK(word == kRepWord32 || word == kRepWord64); |
37 } | 48 } |
38 | 49 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 182 |
172 private: | 183 private: |
173 Zone* zone_; | 184 Zone* zone_; |
174 MachineType word_; | 185 MachineType word_; |
175 }; | 186 }; |
176 } | 187 } |
177 } | 188 } |
178 } // namespace v8::internal::compiler | 189 } // namespace v8::internal::compiler |
179 | 190 |
180 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 191 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |