OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_SIMPLIFIED_OPERATOR_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT | 74 static OStream& PrintTo(OStream& os, const ElementAccess& val) { // NOLINT |
75 return os << val.header_size; | 75 return os << val.header_size; |
76 } | 76 } |
77 static int HashCode(const ElementAccess& val) { | 77 static int HashCode(const ElementAccess& val) { |
78 return (val.header_size < 16) | (val.machine_type & 0xffff); | 78 return (val.header_size < 16) | (val.machine_type & 0xffff); |
79 } | 79 } |
80 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs); | 80 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs); |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 inline const FieldAccess FieldAccessOf(Operator* op) { | 84 inline const FieldAccess FieldAccessOf(const Operator* op) { |
85 DCHECK(op->opcode() == IrOpcode::kLoadField || | 85 DCHECK(op->opcode() == IrOpcode::kLoadField || |
86 op->opcode() == IrOpcode::kStoreField); | 86 op->opcode() == IrOpcode::kStoreField); |
87 return static_cast<Operator1<FieldAccess>*>(op)->parameter(); | 87 return OpParameter<FieldAccess>(op); |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 inline const ElementAccess ElementAccessOf(Operator* op) { | 91 inline const ElementAccess ElementAccessOf(const Operator* op) { |
92 DCHECK(op->opcode() == IrOpcode::kLoadElement || | 92 DCHECK(op->opcode() == IrOpcode::kLoadElement || |
93 op->opcode() == IrOpcode::kStoreElement); | 93 op->opcode() == IrOpcode::kStoreElement); |
94 return static_cast<Operator1<ElementAccess>*>(op)->parameter(); | 94 return OpParameter<ElementAccess>(op); |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 // Interface for building simplified operators, which represent the | 98 // Interface for building simplified operators, which represent the |
99 // medium-level operations of V8, including adding numbers, allocating objects, | 99 // medium-level operations of V8, including adding numbers, allocating objects, |
100 // indexing into objects and arrays, etc. | 100 // indexing into objects and arrays, etc. |
101 // All operators are typed but many are representation independent. | 101 // All operators are typed but many are representation independent. |
102 | 102 |
103 // Number values from JS can be in one of these representations: | 103 // Number values from JS can be in one of these representations: |
104 // - Tagged: word-sized integer that is either | 104 // - Tagged: word-sized integer that is either |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #undef SIMPLE | 181 #undef SIMPLE |
182 | 182 |
183 private: | 183 private: |
184 Zone* zone_; | 184 Zone* zone_; |
185 }; | 185 }; |
186 } | 186 } |
187 } | 187 } |
188 } // namespace v8::internal::compiler | 188 } // namespace v8::internal::compiler |
189 | 189 |
190 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 190 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
OLD | NEW |