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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \ | 187 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \ |
188 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ | 188 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ |
189 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ | 189 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ |
190 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ | 190 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ |
191 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ | 191 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ |
192 V(ChangeBitToBool, Operator::kNoProperties, 1) \ | 192 V(ChangeBitToBool, Operator::kNoProperties, 1) \ |
193 V(ObjectIsNumber, Operator::kNoProperties, 1) \ | 193 V(ObjectIsNumber, Operator::kNoProperties, 1) \ |
194 V(ObjectIsReceiver, Operator::kNoProperties, 1) \ | 194 V(ObjectIsReceiver, Operator::kNoProperties, 1) \ |
195 V(ObjectIsSmi, Operator::kNoProperties, 1) \ | 195 V(ObjectIsSmi, Operator::kNoProperties, 1) \ |
196 V(ObjectIsString, Operator::kNoProperties, 1) \ | 196 V(ObjectIsString, Operator::kNoProperties, 1) \ |
197 V(ObjectIsUndetectable, Operator::kNoProperties, 1) | 197 V(ObjectIsUndetectable, Operator::kNoProperties, 1) \ |
198 | 198 V(StringEqual, Operator::kCommutative, 2) \ |
199 #define NO_THROW_OP_LIST(V) \ | 199 V(StringLessThan, Operator::kNoProperties, 2) \ |
200 V(StringEqual, Operator::kCommutative, 2) \ | 200 V(StringLessThanOrEqual, Operator::kNoProperties, 2) |
201 V(StringLessThan, Operator::kNoThrow, 2) \ | |
202 V(StringLessThanOrEqual, Operator::kNoThrow, 2) | |
203 | 201 |
204 struct SimplifiedOperatorGlobalCache final { | 202 struct SimplifiedOperatorGlobalCache final { |
205 #define PURE(Name, properties, input_count) \ | 203 #define PURE(Name, properties, input_count) \ |
206 struct Name##Operator final : public Operator { \ | 204 struct Name##Operator final : public Operator { \ |
207 Name##Operator() \ | 205 Name##Operator() \ |
208 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ | 206 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ |
209 input_count, 0, 0, 1, 0, 0) {} \ | 207 input_count, 0, 0, 1, 0, 0) {} \ |
210 }; \ | 208 }; \ |
211 Name##Operator k##Name; | 209 Name##Operator k##Name; |
212 PURE_OP_LIST(PURE) | 210 PURE_OP_LIST(PURE) |
213 #undef PURE | 211 #undef PURE |
214 | 212 |
215 #define NO_THROW(Name, properties, input_count) \ | |
216 struct Name##Operator final : public Operator { \ | |
217 Name##Operator() \ | |
218 : Operator(IrOpcode::k##Name, Operator::kNoThrow | properties, #Name, \ | |
219 input_count, 1, 1, 1, 1, 0) {} \ | |
220 }; \ | |
221 Name##Operator k##Name; | |
222 NO_THROW_OP_LIST(NO_THROW) | |
223 #undef NO_THROW | |
224 | |
225 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ | 213 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ |
226 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ | 214 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
227 LoadBuffer##Type##Operator() \ | 215 LoadBuffer##Type##Operator() \ |
228 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \ | 216 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \ |
229 Operator::kNoThrow | Operator::kNoWrite, \ | 217 Operator::kNoThrow | Operator::kNoWrite, \ |
230 "LoadBuffer", 3, 1, 1, 1, 1, 0, \ | 218 "LoadBuffer", 3, 1, 1, 1, 1, 0, \ |
231 BufferAccess(kExternal##Type##Array)) {} \ | 219 BufferAccess(kExternal##Type##Array)) {} \ |
232 }; \ | 220 }; \ |
233 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \ | 221 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
234 StoreBuffer##Type##Operator() \ | 222 StoreBuffer##Type##Operator() \ |
(...skipping 13 matching lines...) Expand all Loading... |
248 LAZY_INSTANCE_INITIALIZER; | 236 LAZY_INSTANCE_INITIALIZER; |
249 | 237 |
250 | 238 |
251 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) | 239 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) |
252 : cache_(kCache.Get()), zone_(zone) {} | 240 : cache_(kCache.Get()), zone_(zone) {} |
253 | 241 |
254 | 242 |
255 #define GET_FROM_CACHE(Name, properties, input_count) \ | 243 #define GET_FROM_CACHE(Name, properties, input_count) \ |
256 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } | 244 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } |
257 PURE_OP_LIST(GET_FROM_CACHE) | 245 PURE_OP_LIST(GET_FROM_CACHE) |
258 NO_THROW_OP_LIST(GET_FROM_CACHE) | |
259 #undef GET_FROM_CACHE | 246 #undef GET_FROM_CACHE |
260 | 247 |
261 | 248 |
262 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 249 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
263 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 250 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
264 Operator::kCommutative | Operator::kPure, | 251 Operator::kCommutative | Operator::kPure, |
265 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 252 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
266 } | 253 } |
267 | 254 |
268 | 255 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 300 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
314 #Name, value_input_count, 1, control_input_count, \ | 301 #Name, value_input_count, 1, control_input_count, \ |
315 output_count, 1, 0, access); \ | 302 output_count, 1, 0, access); \ |
316 } | 303 } |
317 ACCESS_OP_LIST(ACCESS) | 304 ACCESS_OP_LIST(ACCESS) |
318 #undef ACCESS | 305 #undef ACCESS |
319 | 306 |
320 } // namespace compiler | 307 } // namespace compiler |
321 } // namespace internal | 308 } // namespace internal |
322 } // namespace v8 | 309 } // namespace v8 |
OLD | NEW |