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 | |
344 #define PURE_OP_LIST(V) \ | 339 #define PURE_OP_LIST(V) \ |
345 V(BooleanNot, Operator::kNoProperties, 1, 0) \ | 340 V(BooleanNot, Operator::kNoProperties, 1, 0) \ |
346 V(NumberEqual, Operator::kCommutative, 2, 0) \ | 341 V(NumberEqual, Operator::kCommutative, 2, 0) \ |
347 V(NumberLessThan, Operator::kNoProperties, 2, 0) \ | 342 V(NumberLessThan, Operator::kNoProperties, 2, 0) \ |
348 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \ | 343 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \ |
349 V(NumberAdd, Operator::kCommutative, 2, 0) \ | 344 V(NumberAdd, Operator::kCommutative, 2, 0) \ |
350 V(NumberSubtract, Operator::kNoProperties, 2, 0) \ | 345 V(NumberSubtract, Operator::kNoProperties, 2, 0) \ |
351 V(NumberMultiply, Operator::kCommutative, 2, 0) \ | 346 V(NumberMultiply, Operator::kCommutative, 2, 0) \ |
352 V(NumberDivide, Operator::kNoProperties, 2, 0) \ | 347 V(NumberDivide, Operator::kNoProperties, 2, 0) \ |
353 V(NumberModulus, Operator::kNoProperties, 2, 0) \ | 348 V(NumberModulus, Operator::kNoProperties, 2, 0) \ |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 struct Name##Operator final : public Operator { \ | 461 struct Name##Operator final : public Operator { \ |
467 Name##Operator() \ | 462 Name##Operator() \ |
468 : Operator(IrOpcode::k##Name, \ | 463 : Operator(IrOpcode::k##Name, \ |
469 Operator::kFoldable | Operator::kNoThrow, #Name, \ | 464 Operator::kFoldable | Operator::kNoThrow, #Name, \ |
470 value_input_count, 1, 1, value_output_count, 1, 0) {} \ | 465 value_input_count, 1, 1, value_output_count, 1, 0) {} \ |
471 }; \ | 466 }; \ |
472 Name##Operator k##Name; | 467 Name##Operator k##Name; |
473 CHECKED_OP_LIST(CHECKED) | 468 CHECKED_OP_LIST(CHECKED) |
474 #undef CHECKED | 469 #undef CHECKED |
475 | 470 |
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 | |
487 struct ArrayBufferWasNeuteredOperator final : public Operator { | 471 struct ArrayBufferWasNeuteredOperator final : public Operator { |
488 ArrayBufferWasNeuteredOperator() | 472 ArrayBufferWasNeuteredOperator() |
489 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, | 473 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, |
490 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} | 474 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} |
491 }; | 475 }; |
492 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; | 476 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; |
493 | 477 |
494 template <CheckForMinusZeroMode kMode> | 478 template <CheckForMinusZeroMode kMode> |
495 struct CheckedInt32MulOperator final | 479 struct CheckedInt32MulOperator final |
496 : public Operator1<CheckForMinusZeroMode> { | 480 : public Operator1<CheckForMinusZeroMode> { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \ | 747 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \ |
764 case kExternal##Type##Array: \ | 748 case kExternal##Type##Array: \ |
765 return &cache_.kStoreBuffer##Type; | 749 return &cache_.kStoreBuffer##Type; |
766 TYPED_ARRAYS(STORE_BUFFER) | 750 TYPED_ARRAYS(STORE_BUFFER) |
767 #undef STORE_BUFFER | 751 #undef STORE_BUFFER |
768 } | 752 } |
769 UNREACHABLE(); | 753 UNREACHABLE(); |
770 return nullptr; | 754 return nullptr; |
771 } | 755 } |
772 | 756 |
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 | |
785 #define SPECULATIVE_NUMBER_BINOP(Name) \ | 757 #define SPECULATIVE_NUMBER_BINOP(Name) \ |
786 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \ | 758 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \ |
787 switch (hint) { \ | 759 switch (hint) { \ |
788 case NumberOperationHint::kSignedSmall: \ | 760 case NumberOperationHint::kSignedSmall: \ |
789 return &cache_.k##Name##SignedSmallOperator; \ | 761 return &cache_.k##Name##SignedSmallOperator; \ |
790 case NumberOperationHint::kSigned32: \ | 762 case NumberOperationHint::kSigned32: \ |
791 return &cache_.k##Name##Signed32Operator; \ | 763 return &cache_.k##Name##Signed32Operator; \ |
792 case NumberOperationHint::kNumber: \ | 764 case NumberOperationHint::kNumber: \ |
793 return &cache_.k##Name##NumberOperator; \ | 765 return &cache_.k##Name##NumberOperator; \ |
794 case NumberOperationHint::kNumberOrOddball: \ | 766 case NumberOperationHint::kNumberOrOddball: \ |
(...skipping 21 matching lines...) Expand all Loading... |
816 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 788 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
817 #Name, value_input_count, 1, control_input_count, \ | 789 #Name, value_input_count, 1, control_input_count, \ |
818 output_count, 1, 0, access); \ | 790 output_count, 1, 0, access); \ |
819 } | 791 } |
820 ACCESS_OP_LIST(ACCESS) | 792 ACCESS_OP_LIST(ACCESS) |
821 #undef ACCESS | 793 #undef ACCESS |
822 | 794 |
823 } // namespace compiler | 795 } // namespace compiler |
824 } // namespace internal | 796 } // namespace internal |
825 } // namespace v8 | 797 } // namespace v8 |
OLD | NEW |