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/compiler/types.h" | 10 #include "src/compiler/types.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 op->opcode() == IrOpcode::kSpeculativeNumberLessThan || | 329 op->opcode() == IrOpcode::kSpeculativeNumberLessThan || |
330 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual); | 330 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual); |
331 return OpParameter<NumberOperationHint>(op); | 331 return OpParameter<NumberOperationHint>(op); |
332 } | 332 } |
333 | 333 |
334 PretenureFlag PretenureFlagOf(const Operator* op) { | 334 PretenureFlag PretenureFlagOf(const Operator* op) { |
335 DCHECK_EQ(IrOpcode::kAllocate, op->opcode()); | 335 DCHECK_EQ(IrOpcode::kAllocate, op->opcode()); |
336 return OpParameter<PretenureFlag>(op); | 336 return OpParameter<PretenureFlag>(op); |
337 } | 337 } |
338 | 338 |
| 339 UnicodeEncoding UnicodeEncodingOf(const Operator* op) { |
| 340 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint); |
| 341 return OpParameter<UnicodeEncoding>(op); |
| 342 } |
| 343 |
339 #define PURE_OP_LIST(V) \ | 344 #define PURE_OP_LIST(V) \ |
340 V(BooleanNot, Operator::kNoProperties, 1, 0) \ | 345 V(BooleanNot, Operator::kNoProperties, 1, 0) \ |
341 V(NumberEqual, Operator::kCommutative, 2, 0) \ | 346 V(NumberEqual, Operator::kCommutative, 2, 0) \ |
342 V(NumberLessThan, Operator::kNoProperties, 2, 0) \ | 347 V(NumberLessThan, Operator::kNoProperties, 2, 0) \ |
343 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \ | 348 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \ |
344 V(NumberAdd, Operator::kCommutative, 2, 0) \ | 349 V(NumberAdd, Operator::kCommutative, 2, 0) \ |
345 V(NumberSubtract, Operator::kNoProperties, 2, 0) \ | 350 V(NumberSubtract, Operator::kNoProperties, 2, 0) \ |
346 V(NumberMultiply, Operator::kCommutative, 2, 0) \ | 351 V(NumberMultiply, Operator::kCommutative, 2, 0) \ |
347 V(NumberDivide, Operator::kNoProperties, 2, 0) \ | 352 V(NumberDivide, Operator::kNoProperties, 2, 0) \ |
348 V(NumberModulus, Operator::kNoProperties, 2, 0) \ | 353 V(NumberModulus, Operator::kNoProperties, 2, 0) \ |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 struct Name##Operator final : public Operator { \ | 466 struct Name##Operator final : public Operator { \ |
462 Name##Operator() \ | 467 Name##Operator() \ |
463 : Operator(IrOpcode::k##Name, \ | 468 : Operator(IrOpcode::k##Name, \ |
464 Operator::kFoldable | Operator::kNoThrow, #Name, \ | 469 Operator::kFoldable | Operator::kNoThrow, #Name, \ |
465 value_input_count, 1, 1, value_output_count, 1, 0) {} \ | 470 value_input_count, 1, 1, value_output_count, 1, 0) {} \ |
466 }; \ | 471 }; \ |
467 Name##Operator k##Name; | 472 Name##Operator k##Name; |
468 CHECKED_OP_LIST(CHECKED) | 473 CHECKED_OP_LIST(CHECKED) |
469 #undef CHECKED | 474 #undef CHECKED |
470 | 475 |
| 476 template <UnicodeEncoding kEncoding> |
| 477 struct StringFromCodePointOperator final : public Operator { |
| 478 StringFromCodePointOperator() |
| 479 : Operator(IrOpcode::kStringFromCodePoint, Operator::kPure, |
| 480 "StringFromCodePoint", 1, 0, 0, 1, 0, 0) {} |
| 481 }; |
| 482 StringFromCodePointOperator<UnicodeEncoding::UTF16> |
| 483 kStringFromCodePointOperatorUTF16; |
| 484 StringFromCodePointOperator<UnicodeEncoding::UTF32> |
| 485 kStringFromCodePointOperatorUTF32; |
| 486 |
471 struct ArrayBufferWasNeuteredOperator final : public Operator { | 487 struct ArrayBufferWasNeuteredOperator final : public Operator { |
472 ArrayBufferWasNeuteredOperator() | 488 ArrayBufferWasNeuteredOperator() |
473 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, | 489 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, |
474 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} | 490 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} |
475 }; | 491 }; |
476 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; | 492 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; |
477 | 493 |
478 template <CheckForMinusZeroMode kMode> | 494 template <CheckForMinusZeroMode kMode> |
479 struct CheckedInt32MulOperator final | 495 struct CheckedInt32MulOperator final |
480 : public Operator1<CheckForMinusZeroMode> { | 496 : public Operator1<CheckForMinusZeroMode> { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \ | 763 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \ |
748 case kExternal##Type##Array: \ | 764 case kExternal##Type##Array: \ |
749 return &cache_.kStoreBuffer##Type; | 765 return &cache_.kStoreBuffer##Type; |
750 TYPED_ARRAYS(STORE_BUFFER) | 766 TYPED_ARRAYS(STORE_BUFFER) |
751 #undef STORE_BUFFER | 767 #undef STORE_BUFFER |
752 } | 768 } |
753 UNREACHABLE(); | 769 UNREACHABLE(); |
754 return nullptr; | 770 return nullptr; |
755 } | 771 } |
756 | 772 |
| 773 const Operator* SimplifiedOperatorBuilder::StringFromCodePoint( |
| 774 UnicodeEncoding encoding) { |
| 775 switch (encoding) { |
| 776 case UnicodeEncoding::UTF16: |
| 777 return &cache_.kStringFromCodePointOperatorUTF16; |
| 778 case UnicodeEncoding::UTF32: |
| 779 return &cache_.kStringFromCodePointOperatorUTF32; |
| 780 } |
| 781 UNREACHABLE(); |
| 782 return nullptr; |
| 783 } |
| 784 |
757 #define SPECULATIVE_NUMBER_BINOP(Name) \ | 785 #define SPECULATIVE_NUMBER_BINOP(Name) \ |
758 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \ | 786 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \ |
759 switch (hint) { \ | 787 switch (hint) { \ |
760 case NumberOperationHint::kSignedSmall: \ | 788 case NumberOperationHint::kSignedSmall: \ |
761 return &cache_.k##Name##SignedSmallOperator; \ | 789 return &cache_.k##Name##SignedSmallOperator; \ |
762 case NumberOperationHint::kSigned32: \ | 790 case NumberOperationHint::kSigned32: \ |
763 return &cache_.k##Name##Signed32Operator; \ | 791 return &cache_.k##Name##Signed32Operator; \ |
764 case NumberOperationHint::kNumber: \ | 792 case NumberOperationHint::kNumber: \ |
765 return &cache_.k##Name##NumberOperator; \ | 793 return &cache_.k##Name##NumberOperator; \ |
766 case NumberOperationHint::kNumberOrOddball: \ | 794 case NumberOperationHint::kNumberOrOddball: \ |
(...skipping 21 matching lines...) Expand all Loading... |
788 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 816 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
789 #Name, value_input_count, 1, control_input_count, \ | 817 #Name, value_input_count, 1, control_input_count, \ |
790 output_count, 1, 0, access); \ | 818 output_count, 1, 0, access); \ |
791 } | 819 } |
792 ACCESS_OP_LIST(ACCESS) | 820 ACCESS_OP_LIST(ACCESS) |
793 #undef ACCESS | 821 #undef ACCESS |
794 | 822 |
795 } // namespace compiler | 823 } // namespace compiler |
796 } // namespace internal | 824 } // namespace internal |
797 } // namespace v8 | 825 } // namespace v8 |
OLD | NEW |