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 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 669 |
670 | 670 |
671 enum StringAddFlags { | 671 enum StringAddFlags { |
672 // Omit both parameter checks. | 672 // Omit both parameter checks. |
673 STRING_ADD_CHECK_NONE = 0, | 673 STRING_ADD_CHECK_NONE = 0, |
674 // Check left parameter. | 674 // Check left parameter. |
675 STRING_ADD_CHECK_LEFT = 1 << 0, | 675 STRING_ADD_CHECK_LEFT = 1 << 0, |
676 // Check right parameter. | 676 // Check right parameter. |
677 STRING_ADD_CHECK_RIGHT = 1 << 1, | 677 STRING_ADD_CHECK_RIGHT = 1 << 1, |
678 // Check both parameters. | 678 // Check both parameters. |
679 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT | 679 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT, |
| 680 // Convert parameters when check fails (instead of throwing an exception). |
| 681 STRING_ADD_CONVERT = 1 << 2, |
| 682 STRING_ADD_CONVERT_LEFT = STRING_ADD_CHECK_LEFT | STRING_ADD_CONVERT, |
| 683 STRING_ADD_CONVERT_RIGHT = STRING_ADD_CHECK_RIGHT | STRING_ADD_CONVERT |
680 }; | 684 }; |
681 | 685 |
682 | 686 |
683 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); | 687 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); |
684 | 688 |
685 | 689 |
686 class StringAddTFStub : public TurboFanCodeStub { | 690 class StringAddTFStub : public TurboFanCodeStub { |
687 public: | 691 public: |
688 StringAddTFStub(Isolate* isolate, StringAddFlags flags, | 692 StringAddTFStub(Isolate* isolate, StringAddFlags flags, |
689 PretenureFlag pretenure_flag) | 693 PretenureFlag pretenure_flag) |
690 : TurboFanCodeStub(isolate) { | 694 : TurboFanCodeStub(isolate) { |
691 minor_key_ = StringAddFlagsBits::encode(flags) | | 695 minor_key_ = StringAddFlagsBits::encode(flags) | |
692 PretenureFlagBits::encode(pretenure_flag); | 696 PretenureFlagBits::encode(pretenure_flag); |
693 } | 697 } |
694 | 698 |
695 StringAddFlags flags() const { | 699 StringAddFlags flags() const { |
696 return StringAddFlagsBits::decode(MinorKey()); | 700 return StringAddFlagsBits::decode(MinorKey()); |
697 } | 701 } |
698 | 702 |
699 PretenureFlag pretenure_flag() const { | 703 PretenureFlag pretenure_flag() const { |
700 return PretenureFlagBits::decode(MinorKey()); | 704 return PretenureFlagBits::decode(MinorKey()); |
701 } | 705 } |
702 | 706 |
703 private: | 707 private: |
704 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 2> {}; | 708 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; |
705 class PretenureFlagBits : public BitField<PretenureFlag, 2, 1> {}; | 709 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; |
706 | 710 |
707 void PrintBaseName(std::ostream& os) const override; // NOLINT | 711 void PrintBaseName(std::ostream& os) const override; // NOLINT |
708 | 712 |
709 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 713 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
710 DEFINE_CODE_STUB(StringAddTF, TurboFanCodeStub); | 714 DEFINE_CODE_STUB(StringAddTF, TurboFanCodeStub); |
711 }; | 715 }; |
712 | 716 |
713 | 717 |
714 class NumberToStringStub final : public HydrogenCodeStub { | 718 class NumberToStringStub final : public HydrogenCodeStub { |
715 public: | 719 public: |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 | 1644 |
1641 PretenureFlag pretenure_flag() const { | 1645 PretenureFlag pretenure_flag() const { |
1642 return PretenureFlagBits::decode(sub_minor_key()); | 1646 return PretenureFlagBits::decode(sub_minor_key()); |
1643 } | 1647 } |
1644 | 1648 |
1645 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1649 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1646 static const int kLeft = 0; | 1650 static const int kLeft = 0; |
1647 static const int kRight = 1; | 1651 static const int kRight = 1; |
1648 | 1652 |
1649 private: | 1653 private: |
1650 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1654 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; |
1651 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; | 1655 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; |
1652 | 1656 |
1653 void PrintBaseName(std::ostream& os) const override; // NOLINT | 1657 void PrintBaseName(std::ostream& os) const override; // NOLINT |
1654 | 1658 |
1655 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1659 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1656 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1660 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1657 }; | 1661 }; |
1658 | 1662 |
1659 | 1663 |
1660 class CompareICStub : public PlatformCodeStub { | 1664 class CompareICStub : public PlatformCodeStub { |
1661 public: | 1665 public: |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 #undef DEFINE_HYDROGEN_CODE_STUB | 3079 #undef DEFINE_HYDROGEN_CODE_STUB |
3076 #undef DEFINE_CODE_STUB | 3080 #undef DEFINE_CODE_STUB |
3077 #undef DEFINE_CODE_STUB_BASE | 3081 #undef DEFINE_CODE_STUB_BASE |
3078 | 3082 |
3079 extern Representation RepresentationFromType(Type* type); | 3083 extern Representation RepresentationFromType(Type* type); |
3080 | 3084 |
3081 } // namespace internal | 3085 } // namespace internal |
3082 } // namespace v8 | 3086 } // namespace v8 |
3083 | 3087 |
3084 #endif // V8_CODE_STUBS_H_ | 3088 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |