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 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 struct MachineOperatorBuilderImpl; | 15 struct MachineOperatorBuilderImpl; |
16 class Operator; | 16 class Operator; |
17 | 17 |
18 | 18 |
19 // Supported write barrier modes. | 19 // Supported write barrier modes. |
20 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; | 20 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; |
21 | 21 |
22 std::ostream& operator<<(std::ostream& os, | 22 std::ostream& operator<<(std::ostream& os, WriteBarrierKind); |
23 const WriteBarrierKind& write_barrier_kind); | |
24 | 23 |
25 | 24 |
| 25 // A Load needs a MachineType. |
26 typedef MachineType LoadRepresentation; | 26 typedef MachineType LoadRepresentation; |
27 | 27 |
28 | 28 |
29 // A Store needs a MachineType and a WriteBarrierKind | 29 // A Store needs a MachineType and a WriteBarrierKind in order to emit the |
30 // in order to emit the correct write barrier. | 30 // correct write barrier. |
31 class StoreRepresentation FINAL { | 31 class StoreRepresentation FINAL { |
32 public: | 32 public: |
33 StoreRepresentation(MachineType machine_type, | 33 StoreRepresentation(MachineType machine_type, |
34 WriteBarrierKind write_barrier_kind) | 34 WriteBarrierKind write_barrier_kind) |
35 : machine_type_(machine_type), write_barrier_kind_(write_barrier_kind) {} | 35 : machine_type_(machine_type), write_barrier_kind_(write_barrier_kind) {} |
36 | 36 |
37 MachineType machine_type() const { return machine_type_; } | 37 MachineType machine_type() const { return machine_type_; } |
38 WriteBarrierKind write_barrier_kind() const { return write_barrier_kind_; } | 38 WriteBarrierKind write_barrier_kind() const { return write_barrier_kind_; } |
39 | 39 |
40 private: | 40 private: |
41 MachineType machine_type_; | 41 MachineType machine_type_; |
42 WriteBarrierKind write_barrier_kind_; | 42 WriteBarrierKind write_barrier_kind_; |
43 }; | 43 }; |
44 | 44 |
45 inline bool operator==(const StoreRepresentation& rep1, | 45 bool operator==(StoreRepresentation, StoreRepresentation); |
46 const StoreRepresentation& rep2) { | 46 bool operator!=(StoreRepresentation, StoreRepresentation); |
47 return rep1.machine_type() == rep2.machine_type() && | |
48 rep1.write_barrier_kind() == rep2.write_barrier_kind(); | |
49 } | |
50 | 47 |
51 inline bool operator!=(const StoreRepresentation& rep1, | 48 size_t hash_value(StoreRepresentation); |
52 const StoreRepresentation& rep2) { | |
53 return !(rep1 == rep2); | |
54 } | |
55 | 49 |
56 std::ostream& operator<<(std::ostream& os, const StoreRepresentation& rep); | 50 std::ostream& operator<<(std::ostream&, StoreRepresentation); |
57 | 51 |
58 | 52 |
59 // Interface for building machine-level operators. These operators are | 53 // Interface for building machine-level operators. These operators are |
60 // machine-level but machine-independent and thus define a language suitable | 54 // machine-level but machine-independent and thus define a language suitable |
61 // for generating code to run on architectures such as ia32, x64, arm, etc. | 55 // for generating code to run on architectures such as ia32, x64, arm, etc. |
62 class MachineOperatorBuilder FINAL { | 56 class MachineOperatorBuilder FINAL { |
63 public: | 57 public: |
64 explicit MachineOperatorBuilder(MachineType word = kMachPtr); | 58 explicit MachineOperatorBuilder(MachineType word = kMachPtr); |
65 | 59 |
66 const Operator* Word32And(); | 60 const Operator* Word32And(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 private: | 178 private: |
185 const MachineOperatorBuilderImpl& impl_; | 179 const MachineOperatorBuilderImpl& impl_; |
186 const MachineType word_; | 180 const MachineType word_; |
187 }; | 181 }; |
188 | 182 |
189 } // namespace compiler | 183 } // namespace compiler |
190 } // namespace internal | 184 } // namespace internal |
191 } // namespace v8 | 185 } // namespace v8 |
192 | 186 |
193 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 187 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |