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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 #define CHECKED(Name) \ | 254 #define CHECKED(Name) \ |
255 struct Name##Operator final : public Operator { \ | 255 struct Name##Operator final : public Operator { \ |
256 Name##Operator() \ | 256 Name##Operator() \ |
257 : Operator(IrOpcode::k##Name, Operator::kNoThrow, #Name, 1, 1, 1, 1, \ | 257 : Operator(IrOpcode::k##Name, Operator::kNoThrow, #Name, 1, 1, 1, 1, \ |
258 1, 1) {} \ | 258 1, 1) {} \ |
259 }; \ | 259 }; \ |
260 Name##Operator k##Name; | 260 Name##Operator k##Name; |
261 CHECKED_OP_LIST(CHECKED) | 261 CHECKED_OP_LIST(CHECKED) |
262 #undef CHECKED | 262 #undef CHECKED |
263 | 263 |
| 264 struct CheckIfOperator final : public Operator { |
| 265 CheckIfOperator() |
| 266 : Operator(IrOpcode::kCheckIf, Operator::kFoldable, "CheckIf", 1, 1, 1, |
| 267 0, 1, 1) {} |
| 268 }; |
| 269 CheckIfOperator kCheckIf; |
| 270 |
264 template <PretenureFlag kPretenure> | 271 template <PretenureFlag kPretenure> |
265 struct AllocateOperator final : public Operator1<PretenureFlag> { | 272 struct AllocateOperator final : public Operator1<PretenureFlag> { |
266 AllocateOperator() | 273 AllocateOperator() |
267 : Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, | 274 : Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, |
268 "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {} | 275 "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {} |
269 }; | 276 }; |
270 AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator; | 277 AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator; |
271 AllocateOperator<TENURED> kAllocateTenuredOperator; | 278 AllocateOperator<TENURED> kAllocateTenuredOperator; |
272 | 279 |
273 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ | 280 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ |
(...skipping 28 matching lines...) Expand all Loading... |
302 #define GET_FROM_CACHE(Name, properties, input_count) \ | 309 #define GET_FROM_CACHE(Name, properties, input_count) \ |
303 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } | 310 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } |
304 PURE_OP_LIST(GET_FROM_CACHE) | 311 PURE_OP_LIST(GET_FROM_CACHE) |
305 #undef GET_FROM_CACHE | 312 #undef GET_FROM_CACHE |
306 | 313 |
307 #define GET_FROM_CACHE(Name) \ | 314 #define GET_FROM_CACHE(Name) \ |
308 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } | 315 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } |
309 CHECKED_OP_LIST(GET_FROM_CACHE) | 316 CHECKED_OP_LIST(GET_FROM_CACHE) |
310 #undef GET_FROM_CACHE | 317 #undef GET_FROM_CACHE |
311 | 318 |
| 319 const Operator* SimplifiedOperatorBuilder::CheckIf() { |
| 320 return &cache_.kCheckIf; |
| 321 } |
| 322 |
312 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 323 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
313 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 324 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
314 Operator::kCommutative | Operator::kPure, | 325 Operator::kCommutative | Operator::kPure, |
315 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 326 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
316 } | 327 } |
317 | 328 |
318 const Operator* SimplifiedOperatorBuilder::TypeGuard(Type* type) { | 329 const Operator* SimplifiedOperatorBuilder::TypeGuard(Type* type) { |
319 class TypeGuardOperator final : public Operator1<Type*> { | 330 class TypeGuardOperator final : public Operator1<Type*> { |
320 public: | 331 public: |
321 explicit TypeGuardOperator(Type* type) | 332 explicit TypeGuardOperator(Type* type) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 408 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
398 #Name, value_input_count, 1, control_input_count, \ | 409 #Name, value_input_count, 1, control_input_count, \ |
399 output_count, 1, 0, access); \ | 410 output_count, 1, 0, access); \ |
400 } | 411 } |
401 ACCESS_OP_LIST(ACCESS) | 412 ACCESS_OP_LIST(ACCESS) |
402 #undef ACCESS | 413 #undef ACCESS |
403 | 414 |
404 } // namespace compiler | 415 } // namespace compiler |
405 } // namespace internal | 416 } // namespace internal |
406 } // namespace v8 | 417 } // namespace v8 |
OLD | NEW |