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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 } | 909 } |
910 | 910 |
911 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 911 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
912 | 912 |
913 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); | 913 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); |
914 }; | 914 }; |
915 | 915 |
916 | 916 |
917 class CallICStub: public PlatformCodeStub { | 917 class CallICStub: public PlatformCodeStub { |
918 public: | 918 public: |
919 CallICStub(Isolate* isolate, const CallICState& state) | 919 CallICStub(Isolate* isolate, ConvertReceiverMode convert_mode, |
| 920 TailCallMode tail_call_mode) |
920 : PlatformCodeStub(isolate) { | 921 : PlatformCodeStub(isolate) { |
921 minor_key_ = state.GetExtraICState(); | 922 minor_key_ = ConvertModeBits::encode(convert_mode) | |
| 923 TailCallModeBits::encode(tail_call_mode); |
922 } | 924 } |
923 | 925 |
924 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 926 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
925 | 927 |
926 ExtraICState GetExtraICState() const final { | 928 ExtraICState GetExtraICState() const final { |
927 return static_cast<ExtraICState>(minor_key_); | 929 return static_cast<ExtraICState>(minor_key_); |
928 } | 930 } |
929 | 931 |
930 protected: | 932 protected: |
931 ConvertReceiverMode convert_mode() const { return state().convert_mode(); } | 933 typedef BitField<ConvertReceiverMode, 0, 2> ConvertModeBits; |
932 TailCallMode tail_call_mode() const { return state().tail_call_mode(); } | 934 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; |
933 | 935 |
934 CallICState state() const { return CallICState(GetExtraICState()); } | 936 ConvertReceiverMode convert_mode() const { |
| 937 return ConvertModeBits::decode(minor_key_); |
| 938 } |
| 939 TailCallMode tail_call_mode() const { |
| 940 return TailCallModeBits::decode(minor_key_); |
| 941 } |
935 | 942 |
936 // Code generation helpers. | 943 // Code generation helpers. |
937 void GenerateMiss(MacroAssembler* masm); | 944 void GenerateMiss(MacroAssembler* masm); |
938 void HandleArrayCase(MacroAssembler* masm, Label* miss); | 945 void HandleArrayCase(MacroAssembler* masm, Label* miss); |
939 | 946 |
940 private: | 947 private: |
941 void PrintState(std::ostream& os) const override; // NOLINT | 948 void PrintState(std::ostream& os) const override; // NOLINT |
942 | 949 |
943 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); | 950 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); |
944 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 951 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 | 1597 |
1591 private: | 1598 private: |
1592 StringCharCodeAtGenerator char_code_at_generator_; | 1599 StringCharCodeAtGenerator char_code_at_generator_; |
1593 StringCharFromCodeGenerator char_from_code_generator_; | 1600 StringCharFromCodeGenerator char_from_code_generator_; |
1594 | 1601 |
1595 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1602 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
1596 }; | 1603 }; |
1597 | 1604 |
1598 class CallICTrampolineStub : public TurboFanCodeStub { | 1605 class CallICTrampolineStub : public TurboFanCodeStub { |
1599 public: | 1606 public: |
1600 CallICTrampolineStub(Isolate* isolate, const CallICState& state) | 1607 CallICTrampolineStub(Isolate* isolate, ConvertReceiverMode convert_mode, |
| 1608 TailCallMode tail_call_mode) |
1601 : TurboFanCodeStub(isolate) { | 1609 : TurboFanCodeStub(isolate) { |
1602 minor_key_ = state.GetExtraICState(); | 1610 minor_key_ = ConvertModeBits::encode(convert_mode) | |
| 1611 TailCallModeBits::encode(tail_call_mode); |
1603 } | 1612 } |
1604 | 1613 |
1605 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 1614 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
1606 | 1615 |
1607 ExtraICState GetExtraICState() const final { | 1616 ExtraICState GetExtraICState() const final { |
1608 return static_cast<ExtraICState>(minor_key_); | 1617 return static_cast<ExtraICState>(minor_key_); |
1609 } | 1618 } |
1610 | 1619 |
1611 protected: | 1620 protected: |
1612 ConvertReceiverMode convert_mode() const { return state().convert_mode(); } | 1621 typedef BitField<ConvertReceiverMode, 0, 2> ConvertModeBits; |
1613 TailCallMode tail_call_mode() const { return state().tail_call_mode(); } | 1622 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; |
1614 CallICState state() const { | 1623 |
1615 return CallICState(static_cast<ExtraICState>(minor_key_)); | 1624 ConvertReceiverMode convert_mode() const { |
| 1625 return ConvertModeBits::decode(minor_key_); |
1616 } | 1626 } |
| 1627 TailCallMode tail_call_mode() const { |
| 1628 return TailCallModeBits::decode(minor_key_); |
| 1629 } |
| 1630 |
| 1631 private: |
| 1632 void PrintState(std::ostream& os) const override; // NOLINT |
1617 | 1633 |
1618 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 1634 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
1619 DEFINE_TURBOFAN_CODE_STUB(CallICTrampoline, TurboFanCodeStub); | 1635 DEFINE_TURBOFAN_CODE_STUB(CallICTrampoline, TurboFanCodeStub); |
1620 }; | 1636 }; |
1621 | 1637 |
1622 class DoubleToIStub : public PlatformCodeStub { | 1638 class DoubleToIStub : public PlatformCodeStub { |
1623 public: | 1639 public: |
1624 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 1640 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
1625 int offset, bool is_truncating, bool skip_fastpath = false) | 1641 int offset, bool is_truncating, bool skip_fastpath = false) |
1626 : PlatformCodeStub(isolate) { | 1642 : PlatformCodeStub(isolate) { |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 #undef DEFINE_PLATFORM_CODE_STUB | 2127 #undef DEFINE_PLATFORM_CODE_STUB |
2112 #undef DEFINE_HANDLER_CODE_STUB | 2128 #undef DEFINE_HANDLER_CODE_STUB |
2113 #undef DEFINE_HYDROGEN_CODE_STUB | 2129 #undef DEFINE_HYDROGEN_CODE_STUB |
2114 #undef DEFINE_CODE_STUB | 2130 #undef DEFINE_CODE_STUB |
2115 #undef DEFINE_CODE_STUB_BASE | 2131 #undef DEFINE_CODE_STUB_BASE |
2116 | 2132 |
2117 } // namespace internal | 2133 } // namespace internal |
2118 } // namespace v8 | 2134 } // namespace v8 |
2119 | 2135 |
2120 #endif // V8_CODE_STUBS_H_ | 2136 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |