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" | |
9 | |
10 #include "src/assembler.h" | 8 #include "src/assembler.h" |
11 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/machine-type.h" |
12 #include "src/compiler/opcodes.h" | 11 #include "src/compiler/opcodes.h" |
13 #include "src/compiler/operator.h" | 12 #include "src/compiler/operator.h" |
14 #include "src/unique.h" | 13 #include "src/unique.h" |
15 | 14 |
16 namespace v8 { | 15 namespace v8 { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
19 class OStream; | 18 class OStream; |
20 | 19 |
21 namespace compiler { | 20 namespace compiler { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 Operator* Loop(int controls) { | 107 Operator* Loop(int controls) { |
109 return new (zone_) ControlOperator(IrOpcode::kLoop, Operator::kFoldable, 0, | 108 return new (zone_) ControlOperator(IrOpcode::kLoop, Operator::kFoldable, 0, |
110 0, controls, "Loop"); | 109 0, controls, "Loop"); |
111 } | 110 } |
112 | 111 |
113 Operator* Parameter(int index) { | 112 Operator* Parameter(int index) { |
114 return new (zone_) Operator1<int>(IrOpcode::kParameter, Operator::kPure, 1, | 113 return new (zone_) Operator1<int>(IrOpcode::kParameter, Operator::kPure, 1, |
115 1, "Parameter", index); | 114 1, "Parameter", index); |
116 } | 115 } |
117 Operator* Int32Constant(int32_t value) { | 116 Operator* Int32Constant(int32_t value) { |
118 return new (zone_) Operator1<int>(IrOpcode::kInt32Constant, Operator::kPure, | 117 return new (zone_) |
119 0, 1, "Int32Constant", value); | 118 Operator1<int32_t>(IrOpcode::kInt32Constant, Operator::kPure, 0, 1, |
| 119 "Int32Constant", value); |
120 } | 120 } |
121 Operator* Int64Constant(int64_t value) { | 121 Operator* Int64Constant(int64_t value) { |
122 return new (zone_) | 122 return new (zone_) |
123 Operator1<int64_t>(IrOpcode::kInt64Constant, Operator::kPure, 0, 1, | 123 Operator1<int64_t>(IrOpcode::kInt64Constant, Operator::kPure, 0, 1, |
124 "Int64Constant", value); | 124 "Int64Constant", value); |
125 } | 125 } |
126 Operator* Float64Constant(double value) { | 126 Operator* Float64Constant(double value) { |
127 return new (zone_) | 127 return new (zone_) |
128 Operator1<double>(IrOpcode::kFloat64Constant, Operator::kPure, 0, 1, | 128 Operator1<double>(IrOpcode::kFloat64Constant, Operator::kPure, 0, 1, |
129 "Float64Constant", value); | 129 "Float64Constant", value); |
130 } | 130 } |
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(Unique<Object> value) { | 141 Operator* HeapConstant(Unique<Object> value) { |
142 return new (zone_) Operator1<Unique<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(MachineType type, 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<MachineType>(IrOpcode::kPhi, Operator::kPure, |
148 arguments, 1, "Phi", arguments); | 148 arguments, 1, "Phi", type); |
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, |
153 0, "EffectPhi", arguments); | 153 0, "EffectPhi", arguments); |
154 } | 154 } |
155 Operator* ControlEffect() { | 155 Operator* ControlEffect() { |
156 return new (zone_) SimpleOperator(IrOpcode::kControlEffect, Operator::kPure, | 156 return new (zone_) SimpleOperator(IrOpcode::kControlEffect, Operator::kPure, |
157 0, 0, "ControlEffect"); | 157 0, 0, "ControlEffect"); |
158 } | 158 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |