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 25 matching lines...) Expand all Loading... |
36 CallOperator(CallDescriptor* descriptor, const char* mnemonic) | 36 CallOperator(CallDescriptor* descriptor, const char* mnemonic) |
37 : Operator1<CallDescriptor*>( | 37 : Operator1<CallDescriptor*>( |
38 IrOpcode::kCall, descriptor->properties(), descriptor->InputCount(), | 38 IrOpcode::kCall, descriptor->properties(), descriptor->InputCount(), |
39 descriptor->ReturnCount(), mnemonic, descriptor) {} | 39 descriptor->ReturnCount(), mnemonic, descriptor) {} |
40 | 40 |
41 virtual OStream& PrintParameter(OStream& os) const { // NOLINT | 41 virtual OStream& PrintParameter(OStream& os) const { // NOLINT |
42 return os << "[" << *parameter() << "]"; | 42 return os << "[" << *parameter() << "]"; |
43 } | 43 } |
44 }; | 44 }; |
45 | 45 |
46 class FrameStateDescriptor { | |
47 public: | |
48 explicit FrameStateDescriptor(BailoutId bailout_id) | |
49 : bailout_id_(bailout_id) {} | |
50 | |
51 BailoutId bailout_id() const { return bailout_id_; } | |
52 | |
53 private: | |
54 BailoutId bailout_id_; | |
55 }; | |
56 | |
57 // Interface for building common operators that can be used at any level of IR, | 46 // Interface for building common operators that can be used at any level of IR, |
58 // including JavaScript, mid-level, and low-level. | 47 // including JavaScript, mid-level, and low-level. |
59 // TODO(titzer): Move the mnemonics into SimpleOperator and Operator1 classes. | 48 // TODO(titzer): Move the mnemonics into SimpleOperator and Operator1 classes. |
60 class CommonOperatorBuilder { | 49 class CommonOperatorBuilder { |
61 public: | 50 public: |
62 explicit CommonOperatorBuilder(Zone* zone) : zone_(zone) {} | 51 explicit CommonOperatorBuilder(Zone* zone) : zone_(zone) {} |
63 | 52 |
64 #define CONTROL_OP(name, inputs, controls) \ | 53 #define CONTROL_OP(name, inputs, controls) \ |
65 return new (zone_) ControlOperator(IrOpcode::k##name, Operator::kFoldable, \ | 54 return new (zone_) ControlOperator(IrOpcode::k##name, Operator::kFoldable, \ |
66 inputs, 0, controls, #name); | 55 inputs, 0, controls, #name); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Operator* Phi(int arguments) { | 123 Operator* Phi(int arguments) { |
135 DCHECK(arguments > 0); // Disallow empty phis. | 124 DCHECK(arguments > 0); // Disallow empty phis. |
136 return new (zone_) Operator1<int>(IrOpcode::kPhi, Operator::kPure, | 125 return new (zone_) Operator1<int>(IrOpcode::kPhi, Operator::kPure, |
137 arguments, 1, "Phi", arguments); | 126 arguments, 1, "Phi", arguments); |
138 } | 127 } |
139 Operator* EffectPhi(int arguments) { | 128 Operator* EffectPhi(int arguments) { |
140 DCHECK(arguments > 0); // Disallow empty phis. | 129 DCHECK(arguments > 0); // Disallow empty phis. |
141 return new (zone_) Operator1<int>(IrOpcode::kEffectPhi, Operator::kPure, 0, | 130 return new (zone_) Operator1<int>(IrOpcode::kEffectPhi, Operator::kPure, 0, |
142 0, "EffectPhi", arguments); | 131 0, "EffectPhi", arguments); |
143 } | 132 } |
144 Operator* FrameState(const FrameStateDescriptor& descriptor) { | 133 Operator* StateValues(int arguments) { |
145 return new (zone_) Operator1<FrameStateDescriptor>( | 134 return new (zone_) Operator1<int>(IrOpcode::kStateValues, Operator::kPure, |
146 IrOpcode::kFrameState, Operator::kPure, 0, 1, "FrameState", descriptor); | 135 arguments, 1, "StateValues", arguments); |
| 136 } |
| 137 Operator* FrameState(BailoutId ast_id) { |
| 138 return new (zone_) Operator1<BailoutId>( |
| 139 IrOpcode::kFrameState, Operator::kPure, 3, 1, "FrameState", ast_id); |
147 } | 140 } |
148 Operator* Call(CallDescriptor* descriptor) { | 141 Operator* Call(CallDescriptor* descriptor) { |
149 return new (zone_) CallOperator(descriptor, "Call"); | 142 return new (zone_) CallOperator(descriptor, "Call"); |
150 } | 143 } |
151 Operator* Projection(int index) { | 144 Operator* Projection(int index) { |
152 return new (zone_) Operator1<int>(IrOpcode::kProjection, Operator::kPure, 1, | 145 return new (zone_) Operator1<int>(IrOpcode::kProjection, Operator::kPure, 1, |
153 1, "Projection", index); | 146 1, "Projection", index); |
154 } | 147 } |
155 | 148 |
156 private: | 149 private: |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 275 |
283 template <typename T> | 276 template <typename T> |
284 inline T ValueOf(Operator* op) { | 277 inline T ValueOf(Operator* op) { |
285 return CommonOperatorTraits<T>::ValueOf(op); | 278 return CommonOperatorTraits<T>::ValueOf(op); |
286 } | 279 } |
287 } | 280 } |
288 } | 281 } |
289 } // namespace v8::internal::compiler | 282 } // namespace v8::internal::compiler |
290 | 283 |
291 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 284 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
OLD | NEW |