| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 858 |
| 859 | 859 |
| 860 class ArrayConstructorStub: public PlatformCodeStub { | 860 class ArrayConstructorStub: public PlatformCodeStub { |
| 861 public: | 861 public: |
| 862 explicit ArrayConstructorStub(Isolate* isolate); | 862 explicit ArrayConstructorStub(Isolate* isolate); |
| 863 | 863 |
| 864 private: | 864 private: |
| 865 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 865 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
| 866 AllocationSiteOverrideMode mode); | 866 AllocationSiteOverrideMode mode); |
| 867 | 867 |
| 868 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayNArgumentsConstructor); | 868 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); |
| 869 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); | 869 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); |
| 870 }; | 870 }; |
| 871 | 871 |
| 872 | 872 |
| 873 class InternalArrayConstructorStub: public PlatformCodeStub { | 873 class InternalArrayConstructorStub: public PlatformCodeStub { |
| 874 public: | 874 public: |
| 875 explicit InternalArrayConstructorStub(Isolate* isolate); | 875 explicit InternalArrayConstructorStub(Isolate* isolate); |
| 876 | 876 |
| 877 private: | 877 private: |
| 878 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 878 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 906 private: | 906 private: |
| 907 ExponentType exponent_type() const { | 907 ExponentType exponent_type() const { |
| 908 return ExponentTypeBits::decode(minor_key_); | 908 return ExponentTypeBits::decode(minor_key_); |
| 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 class CallICStub : public TurboFanCodeStub { |
| 917 class CallICStub: public PlatformCodeStub { | |
| 918 public: | 917 public: |
| 919 CallICStub(Isolate* isolate, ConvertReceiverMode convert_mode, | 918 CallICStub(Isolate* isolate, ConvertReceiverMode convert_mode, |
| 920 TailCallMode tail_call_mode) | 919 TailCallMode tail_call_mode) |
| 921 : PlatformCodeStub(isolate) { | 920 : TurboFanCodeStub(isolate) { |
| 922 minor_key_ = ConvertModeBits::encode(convert_mode) | | 921 minor_key_ = ConvertModeBits::encode(convert_mode) | |
| 923 TailCallModeBits::encode(tail_call_mode); | 922 TailCallModeBits::encode(tail_call_mode); |
| 924 } | 923 } |
| 925 | 924 |
| 926 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } | 925 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } |
| 927 | 926 |
| 928 ExtraICState GetExtraICState() const final { | 927 ExtraICState GetExtraICState() const final { |
| 929 return static_cast<ExtraICState>(minor_key_); | 928 return static_cast<ExtraICState>(minor_key_); |
| 930 } | 929 } |
| 931 | 930 |
| 932 protected: | 931 protected: |
| 933 typedef BitField<ConvertReceiverMode, 0, 2> ConvertModeBits; | 932 typedef BitField<ConvertReceiverMode, 0, 2> ConvertModeBits; |
| 934 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; | 933 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; |
| 935 | 934 |
| 936 ConvertReceiverMode convert_mode() const { | 935 ConvertReceiverMode convert_mode() const { |
| 937 return ConvertModeBits::decode(minor_key_); | 936 return ConvertModeBits::decode(minor_key_); |
| 938 } | 937 } |
| 939 TailCallMode tail_call_mode() const { | 938 TailCallMode tail_call_mode() const { |
| 940 return TailCallModeBits::decode(minor_key_); | 939 return TailCallModeBits::decode(minor_key_); |
| 941 } | 940 } |
| 942 | 941 |
| 943 // Code generation helpers. | 942 private: |
| 944 void GenerateMiss(MacroAssembler* masm); | 943 void PrintState(std::ostream& os) const final; // NOLINT |
| 945 void HandleArrayCase(MacroAssembler* masm, Label* miss); | |
| 946 | 944 |
| 947 private: | 945 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallIC); |
| 948 void PrintState(std::ostream& os) const override; // NOLINT | 946 DEFINE_TURBOFAN_CODE_STUB(CallIC, TurboFanCodeStub); |
| 949 | |
| 950 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedbackAndVector); | |
| 951 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | |
| 952 }; | 947 }; |
| 953 | 948 |
| 954 | 949 |
| 955 // TODO(verwaest): Translate to hydrogen code stub. | 950 // TODO(verwaest): Translate to hydrogen code stub. |
| 956 class FunctionPrototypeStub : public PlatformCodeStub { | 951 class FunctionPrototypeStub : public PlatformCodeStub { |
| 957 public: | 952 public: |
| 958 explicit FunctionPrototypeStub(Isolate* isolate) | 953 explicit FunctionPrototypeStub(Isolate* isolate) |
| 959 : PlatformCodeStub(isolate) {} | 954 : PlatformCodeStub(isolate) {} |
| 960 | 955 |
| 961 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 956 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 ConvertReceiverMode convert_mode() const { | 1619 ConvertReceiverMode convert_mode() const { |
| 1625 return ConvertModeBits::decode(minor_key_); | 1620 return ConvertModeBits::decode(minor_key_); |
| 1626 } | 1621 } |
| 1627 TailCallMode tail_call_mode() const { | 1622 TailCallMode tail_call_mode() const { |
| 1628 return TailCallModeBits::decode(minor_key_); | 1623 return TailCallModeBits::decode(minor_key_); |
| 1629 } | 1624 } |
| 1630 | 1625 |
| 1631 private: | 1626 private: |
| 1632 void PrintState(std::ostream& os) const override; // NOLINT | 1627 void PrintState(std::ostream& os) const override; // NOLINT |
| 1633 | 1628 |
| 1634 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 1629 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallICTrampoline); |
| 1635 DEFINE_TURBOFAN_CODE_STUB(CallICTrampoline, TurboFanCodeStub); | 1630 DEFINE_TURBOFAN_CODE_STUB(CallICTrampoline, TurboFanCodeStub); |
| 1636 }; | 1631 }; |
| 1637 | 1632 |
| 1638 class DoubleToIStub : public PlatformCodeStub { | 1633 class DoubleToIStub : public PlatformCodeStub { |
| 1639 public: | 1634 public: |
| 1640 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 1635 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
| 1641 int offset, bool is_truncating, bool skip_fastpath = false) | 1636 int offset, bool is_truncating, bool skip_fastpath = false) |
| 1642 : PlatformCodeStub(isolate) { | 1637 : PlatformCodeStub(isolate) { |
| 1643 minor_key_ = SourceRegisterBits::encode(source.code()) | | 1638 minor_key_ = SourceRegisterBits::encode(source.code()) | |
| 1644 DestinationRegisterBits::encode(destination.code()) | | 1639 DestinationRegisterBits::encode(destination.code()) | |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 #undef DEFINE_PLATFORM_CODE_STUB | 2122 #undef DEFINE_PLATFORM_CODE_STUB |
| 2128 #undef DEFINE_HANDLER_CODE_STUB | 2123 #undef DEFINE_HANDLER_CODE_STUB |
| 2129 #undef DEFINE_HYDROGEN_CODE_STUB | 2124 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2130 #undef DEFINE_CODE_STUB | 2125 #undef DEFINE_CODE_STUB |
| 2131 #undef DEFINE_CODE_STUB_BASE | 2126 #undef DEFINE_CODE_STUB_BASE |
| 2132 | 2127 |
| 2133 } // namespace internal | 2128 } // namespace internal |
| 2134 } // namespace v8 | 2129 } // namespace v8 |
| 2135 | 2130 |
| 2136 #endif // V8_CODE_STUBS_H_ | 2131 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |