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 | |
684 }; | 680 }; |
685 | 681 |
686 | 682 |
687 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); | 683 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); |
688 | 684 |
689 | 685 |
690 class StringAddTFStub : public TurboFanCodeStub { | 686 class StringAddTFStub : public TurboFanCodeStub { |
691 public: | 687 public: |
692 StringAddTFStub(Isolate* isolate, StringAddFlags flags, | 688 StringAddTFStub(Isolate* isolate, StringAddFlags flags, |
693 PretenureFlag pretenure_flag) | 689 PretenureFlag pretenure_flag) |
694 : TurboFanCodeStub(isolate) { | 690 : TurboFanCodeStub(isolate) { |
695 minor_key_ = StringAddFlagsBits::encode(flags) | | 691 minor_key_ = StringAddFlagsBits::encode(flags) | |
696 PretenureFlagBits::encode(pretenure_flag); | 692 PretenureFlagBits::encode(pretenure_flag); |
697 } | 693 } |
698 | 694 |
699 StringAddFlags flags() const { | 695 StringAddFlags flags() const { |
700 return StringAddFlagsBits::decode(MinorKey()); | 696 return StringAddFlagsBits::decode(MinorKey()); |
701 } | 697 } |
702 | 698 |
703 PretenureFlag pretenure_flag() const { | 699 PretenureFlag pretenure_flag() const { |
704 return PretenureFlagBits::decode(MinorKey()); | 700 return PretenureFlagBits::decode(MinorKey()); |
705 } | 701 } |
706 | 702 |
707 private: | 703 private: |
708 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; | 704 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 2> {}; |
709 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; | 705 class PretenureFlagBits : public BitField<PretenureFlag, 2, 1> {}; |
710 | 706 |
711 void PrintBaseName(std::ostream& os) const override; // NOLINT | 707 void PrintBaseName(std::ostream& os) const override; // NOLINT |
712 | 708 |
713 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 709 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
714 DEFINE_CODE_STUB(StringAddTF, TurboFanCodeStub); | 710 DEFINE_CODE_STUB(StringAddTF, TurboFanCodeStub); |
715 }; | 711 }; |
716 | 712 |
717 | 713 |
718 class NumberToStringStub final : public HydrogenCodeStub { | 714 class NumberToStringStub final : public HydrogenCodeStub { |
719 public: | 715 public: |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 | 1640 |
1645 PretenureFlag pretenure_flag() const { | 1641 PretenureFlag pretenure_flag() const { |
1646 return PretenureFlagBits::decode(sub_minor_key()); | 1642 return PretenureFlagBits::decode(sub_minor_key()); |
1647 } | 1643 } |
1648 | 1644 |
1649 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1645 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1650 static const int kLeft = 0; | 1646 static const int kLeft = 0; |
1651 static const int kRight = 1; | 1647 static const int kRight = 1; |
1652 | 1648 |
1653 private: | 1649 private: |
1654 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; | 1650 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
1655 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; | 1651 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
1656 | 1652 |
1657 void PrintBaseName(std::ostream& os) const override; // NOLINT | 1653 void PrintBaseName(std::ostream& os) const override; // NOLINT |
1658 | 1654 |
1659 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1655 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1660 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1656 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1661 }; | 1657 }; |
1662 | 1658 |
1663 | 1659 |
1664 class CompareICStub : public PlatformCodeStub { | 1660 class CompareICStub : public PlatformCodeStub { |
1665 public: | 1661 public: |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 #undef DEFINE_PLATFORM_CODE_STUB | 3073 #undef DEFINE_PLATFORM_CODE_STUB |
3078 #undef DEFINE_HANDLER_CODE_STUB | 3074 #undef DEFINE_HANDLER_CODE_STUB |
3079 #undef DEFINE_HYDROGEN_CODE_STUB | 3075 #undef DEFINE_HYDROGEN_CODE_STUB |
3080 #undef DEFINE_CODE_STUB | 3076 #undef DEFINE_CODE_STUB |
3081 #undef DEFINE_CODE_STUB_BASE | 3077 #undef DEFINE_CODE_STUB_BASE |
3082 | 3078 |
3083 extern Representation RepresentationFromType(Type* type); | 3079 extern Representation RepresentationFromType(Type* type); |
3084 } } // namespace v8::internal | 3080 } } // namespace v8::internal |
3085 | 3081 |
3086 #endif // V8_CODE_STUBS_H_ | 3082 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |