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_COMMON_OPERATOR_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ |
6 #define V8_COMPILER_COMMON_OPERATOR_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 Operator* ExternalConstant(ExternalReference value) { | 131 Operator* ExternalConstant(ExternalReference value) { |
132 return new (zone_) Operator1<ExternalReference>(IrOpcode::kExternalConstant, | 132 return new (zone_) Operator1<ExternalReference>(IrOpcode::kExternalConstant, |
133 Operator::kPure, 0, 1, | 133 Operator::kPure, 0, 1, |
134 "ExternalConstant", value); | 134 "ExternalConstant", value); |
135 } | 135 } |
136 Operator* NumberConstant(double value) { | 136 Operator* NumberConstant(double value) { |
137 return new (zone_) | 137 return new (zone_) |
138 Operator1<double>(IrOpcode::kNumberConstant, Operator::kPure, 0, 1, | 138 Operator1<double>(IrOpcode::kNumberConstant, Operator::kPure, 0, 1, |
139 "NumberConstant", value); | 139 "NumberConstant", value); |
140 } | 140 } |
141 Operator* HeapConstant(PrintableUnique<Object> value) { | 141 Operator* HeapConstant(Unique<Object> value) { |
142 return new (zone_) Operator1<PrintableUnique<Object> >( | 142 return new (zone_) Operator1<Unique<Object> >( |
143 IrOpcode::kHeapConstant, Operator::kPure, 0, 1, "HeapConstant", value); | 143 IrOpcode::kHeapConstant, Operator::kPure, 0, 1, "HeapConstant", value); |
144 } | 144 } |
145 Operator* Phi(int arguments) { | 145 Operator* Phi(int arguments) { |
146 DCHECK(arguments > 0); // Disallow empty phis. | 146 DCHECK(arguments > 0); // Disallow empty phis. |
147 return new (zone_) Operator1<int>(IrOpcode::kPhi, Operator::kPure, | 147 return new (zone_) Operator1<int>(IrOpcode::kPhi, Operator::kPure, |
148 arguments, 1, "Phi", arguments); | 148 arguments, 1, "Phi", arguments); |
149 } | 149 } |
150 Operator* EffectPhi(int arguments) { | 150 Operator* EffectPhi(int arguments) { |
151 DCHECK(arguments > 0); // Disallow empty phis. | 151 DCHECK(arguments > 0); // Disallow empty phis. |
152 return new (zone_) Operator1<int>(IrOpcode::kEffectPhi, Operator::kPure, 0, | 152 return new (zone_) Operator1<int>(IrOpcode::kEffectPhi, Operator::kPure, 0, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 static inline bool HasValue(const Operator* op) { | 282 static inline bool HasValue(const Operator* op) { |
283 return op->opcode() == IrOpcode::kExternalConstant; | 283 return op->opcode() == IrOpcode::kExternalConstant; |
284 } | 284 } |
285 static inline ExternalReference ValueOf(const Operator* op) { | 285 static inline ExternalReference ValueOf(const Operator* op) { |
286 CHECK_EQ(IrOpcode::kExternalConstant, op->opcode()); | 286 CHECK_EQ(IrOpcode::kExternalConstant, op->opcode()); |
287 return OpParameter<ExternalReference>(op); | 287 return OpParameter<ExternalReference>(op); |
288 } | 288 } |
289 }; | 289 }; |
290 | 290 |
291 template <typename T> | 291 template <typename T> |
292 struct CommonOperatorTraits<PrintableUnique<T> > { | 292 struct CommonOperatorTraits<Unique<T> > { |
293 static inline bool HasValue(const Operator* op) { | 293 static inline bool HasValue(const Operator* op) { |
294 return op->opcode() == IrOpcode::kHeapConstant; | 294 return op->opcode() == IrOpcode::kHeapConstant; |
295 } | 295 } |
296 static inline PrintableUnique<T> ValueOf(const Operator* op) { | 296 static inline Unique<T> ValueOf(const Operator* op) { |
297 CHECK_EQ(IrOpcode::kHeapConstant, op->opcode()); | 297 CHECK_EQ(IrOpcode::kHeapConstant, op->opcode()); |
298 return OpParameter<PrintableUnique<T> >(op); | 298 return OpParameter<Unique<T> >(op); |
299 } | 299 } |
300 }; | 300 }; |
301 | 301 |
302 template <typename T> | 302 template <typename T> |
303 struct CommonOperatorTraits<Handle<T> > { | 303 struct CommonOperatorTraits<Handle<T> > { |
304 static inline bool HasValue(const Operator* op) { | 304 static inline bool HasValue(const Operator* op) { |
305 return CommonOperatorTraits<PrintableUnique<T> >::HasValue(op); | 305 return CommonOperatorTraits<Unique<T> >::HasValue(op); |
306 } | 306 } |
307 static inline Handle<T> ValueOf(const Operator* op) { | 307 static inline Handle<T> ValueOf(const Operator* op) { |
308 return CommonOperatorTraits<PrintableUnique<T> >::ValueOf(op).handle(); | 308 return CommonOperatorTraits<Unique<T> >::ValueOf(op).handle(); |
309 } | 309 } |
310 }; | 310 }; |
311 | 311 |
312 | 312 |
313 template <typename T> | 313 template <typename T> |
314 inline T ValueOf(const Operator* op) { | 314 inline T ValueOf(const Operator* op) { |
315 return CommonOperatorTraits<T>::ValueOf(op); | 315 return CommonOperatorTraits<T>::ValueOf(op); |
316 } | 316 } |
317 | 317 |
318 } // namespace compiler | 318 } // namespace compiler |
319 } // namespace internal | 319 } // namespace internal |
320 } // namespace v8 | 320 } // namespace v8 |
321 | 321 |
322 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 322 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |