OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/compiler/simplified-operator.h" | 5 #include "src/compiler/simplified-operator.h" |
6 | 6 |
7 #include "src/base/lazy-instance.h" | 7 #include "src/base/lazy-instance.h" |
8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/types.h" | 10 #include "src/types.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 const ElementAccess& ElementAccessOf(const Operator* op) { | 152 const ElementAccess& ElementAccessOf(const Operator* op) { |
153 DCHECK_NOT_NULL(op); | 153 DCHECK_NOT_NULL(op); |
154 DCHECK(op->opcode() == IrOpcode::kLoadElement || | 154 DCHECK(op->opcode() == IrOpcode::kLoadElement || |
155 op->opcode() == IrOpcode::kStoreElement); | 155 op->opcode() == IrOpcode::kStoreElement); |
156 return OpParameter<ElementAccess>(op); | 156 return OpParameter<ElementAccess>(op); |
157 } | 157 } |
158 | 158 |
159 #define PURE_OP_LIST(V) \ | 159 #define PURE_OP_LIST(V) \ |
160 V(BooleanNot, Operator::kNoProperties, 1) \ | 160 V(BooleanNot, Operator::kNoProperties, 1) \ |
161 V(BooleanToNumber, Operator::kNoProperties, 1) \ | 161 V(BooleanToNumber, Operator::kNoProperties, 1) \ |
162 V(NumberEqual, Operator::kCommutative, 2) \ | 162 V(NumberEqual, Operator::kCommutative, 2) \ |
163 V(NumberLessThan, Operator::kNoProperties, 2) \ | 163 V(NumberLessThan, Operator::kNoProperties, 2) \ |
164 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \ | 164 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \ |
165 V(NumberAdd, Operator::kCommutative, 2) \ | 165 V(NumberAdd, Operator::kCommutative, 2) \ |
166 V(NumberSubtract, Operator::kNoProperties, 2) \ | 166 V(NumberSubtract, Operator::kNoProperties, 2) \ |
167 V(NumberMultiply, Operator::kCommutative, 2) \ | 167 V(NumberMultiply, Operator::kCommutative, 2) \ |
168 V(NumberDivide, Operator::kNoProperties, 2) \ | 168 V(NumberDivide, Operator::kNoProperties, 2) \ |
169 V(NumberModulus, Operator::kNoProperties, 2) \ | 169 V(NumberModulus, Operator::kNoProperties, 2) \ |
170 V(NumberBitwiseOr, Operator::kCommutative, 2) \ | 170 V(NumberBitwiseOr, Operator::kCommutative, 2) \ |
171 V(NumberBitwiseXor, Operator::kCommutative, 2) \ | 171 V(NumberBitwiseXor, Operator::kCommutative, 2) \ |
172 V(NumberBitwiseAnd, Operator::kCommutative, 2) \ | 172 V(NumberBitwiseAnd, Operator::kCommutative, 2) \ |
173 V(NumberShiftLeft, Operator::kNoProperties, 2) \ | 173 V(NumberShiftLeft, Operator::kNoProperties, 2) \ |
174 V(NumberShiftRight, Operator::kNoProperties, 2) \ | 174 V(NumberShiftRight, Operator::kNoProperties, 2) \ |
175 V(NumberShiftRightLogical, Operator::kNoProperties, 2) \ | 175 V(NumberShiftRightLogical, Operator::kNoProperties, 2) \ |
176 V(NumberClz32, Operator::kNoProperties, 1) \ | 176 V(NumberClz32, Operator::kNoProperties, 1) \ |
177 V(NumberCeil, Operator::kNoProperties, 1) \ | 177 V(NumberCeil, Operator::kNoProperties, 1) \ |
178 V(NumberFloor, Operator::kNoProperties, 1) \ | 178 V(NumberFloor, Operator::kNoProperties, 1) \ |
179 V(NumberRound, Operator::kNoProperties, 1) \ | 179 V(NumberRound, Operator::kNoProperties, 1) \ |
180 V(NumberTrunc, Operator::kNoProperties, 1) \ | 180 V(NumberTrunc, Operator::kNoProperties, 1) \ |
181 V(NumberToInt32, Operator::kNoProperties, 1) \ | 181 V(NumberToInt32, Operator::kNoProperties, 1) \ |
182 V(NumberToUint32, Operator::kNoProperties, 1) \ | 182 V(NumberToUint32, Operator::kNoProperties, 1) \ |
183 V(NumberIsHoleNaN, Operator::kNoProperties, 1) \ | 183 V(NumberIsHoleNaN, Operator::kNoProperties, 1) \ |
184 V(StringToNumber, Operator::kNoProperties, 1) \ | 184 V(StringToNumber, Operator::kNoProperties, 1) \ |
185 V(ChangeTaggedToInt32, Operator::kNoProperties, 1) \ | 185 V(ChangeTaggedSignedToWord32, Operator::kNoProperties, 1) \ |
186 V(ChangeTaggedToUint32, Operator::kNoProperties, 1) \ | 186 V(ChangeTaggedToInt32, Operator::kNoProperties, 1) \ |
187 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \ | 187 V(ChangeTaggedToUint32, Operator::kNoProperties, 1) \ |
188 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ | 188 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \ |
189 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ | 189 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ |
190 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ | 190 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ |
191 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ | 191 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ |
192 V(ChangeBitToBool, Operator::kNoProperties, 1) \ | 192 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ |
193 V(ObjectIsCallable, Operator::kNoProperties, 1) \ | 193 V(ChangeBitToBool, Operator::kNoProperties, 1) \ |
194 V(ObjectIsNumber, Operator::kNoProperties, 1) \ | 194 V(ObjectIsCallable, Operator::kNoProperties, 1) \ |
195 V(ObjectIsReceiver, Operator::kNoProperties, 1) \ | 195 V(ObjectIsNumber, Operator::kNoProperties, 1) \ |
196 V(ObjectIsSmi, Operator::kNoProperties, 1) \ | 196 V(ObjectIsReceiver, Operator::kNoProperties, 1) \ |
197 V(ObjectIsString, Operator::kNoProperties, 1) \ | 197 V(ObjectIsSmi, Operator::kNoProperties, 1) \ |
198 V(ObjectIsUndetectable, Operator::kNoProperties, 1) \ | 198 V(ObjectIsString, Operator::kNoProperties, 1) \ |
199 V(StringEqual, Operator::kCommutative, 2) \ | 199 V(ObjectIsUndetectable, Operator::kNoProperties, 1) \ |
200 V(StringLessThan, Operator::kNoProperties, 2) \ | 200 V(StringEqual, Operator::kCommutative, 2) \ |
| 201 V(StringLessThan, Operator::kNoProperties, 2) \ |
201 V(StringLessThanOrEqual, Operator::kNoProperties, 2) | 202 V(StringLessThanOrEqual, Operator::kNoProperties, 2) |
202 | 203 |
203 struct SimplifiedOperatorGlobalCache final { | 204 struct SimplifiedOperatorGlobalCache final { |
204 #define PURE(Name, properties, input_count) \ | 205 #define PURE(Name, properties, input_count) \ |
205 struct Name##Operator final : public Operator { \ | 206 struct Name##Operator final : public Operator { \ |
206 Name##Operator() \ | 207 Name##Operator() \ |
207 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ | 208 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ |
208 input_count, 0, 0, 1, 0, 0) {} \ | 209 input_count, 0, 0, 1, 0, 0) {} \ |
209 }; \ | 210 }; \ |
210 Name##Operator k##Name; | 211 Name##Operator k##Name; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 302 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
302 #Name, value_input_count, 1, control_input_count, \ | 303 #Name, value_input_count, 1, control_input_count, \ |
303 output_count, 1, 0, access); \ | 304 output_count, 1, 0, access); \ |
304 } | 305 } |
305 ACCESS_OP_LIST(ACCESS) | 306 ACCESS_OP_LIST(ACCESS) |
306 #undef ACCESS | 307 #undef ACCESS |
307 | 308 |
308 } // namespace compiler | 309 } // namespace compiler |
309 } // namespace internal | 310 } // namespace internal |
310 } // namespace v8 | 311 } // namespace v8 |
OLD | NEW |