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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 V(CreateWeakCell) \ | 89 V(CreateWeakCell) \ |
90 V(StringLength) \ | 90 V(StringLength) \ |
91 V(AddWithFeedback) \ | 91 V(AddWithFeedback) \ |
92 V(SubtractWithFeedback) \ | 92 V(SubtractWithFeedback) \ |
93 V(MultiplyWithFeedback) \ | 93 V(MultiplyWithFeedback) \ |
94 V(DivideWithFeedback) \ | 94 V(DivideWithFeedback) \ |
95 V(ModulusWithFeedback) \ | 95 V(ModulusWithFeedback) \ |
96 V(InternalArrayNoArgumentConstructor) \ | 96 V(InternalArrayNoArgumentConstructor) \ |
97 V(InternalArraySingleArgumentConstructor) \ | 97 V(InternalArraySingleArgumentConstructor) \ |
98 V(ElementsTransitionAndStore) \ | 98 V(ElementsTransitionAndStore) \ |
99 V(FastCloneRegExp) \ | |
100 V(FastCloneShallowArray) \ | |
101 V(FastCloneShallowObject) \ | |
102 V(KeyedLoadSloppyArguments) \ | 99 V(KeyedLoadSloppyArguments) \ |
103 V(KeyedStoreSloppyArguments) \ | 100 V(KeyedStoreSloppyArguments) \ |
104 V(LoadScriptContextField) \ | 101 V(LoadScriptContextField) \ |
105 V(StoreScriptContextField) \ | 102 V(StoreScriptContextField) \ |
106 V(NumberToString) \ | 103 V(NumberToString) \ |
107 V(StringAdd) \ | 104 V(StringAdd) \ |
108 V(GetProperty) \ | 105 V(GetProperty) \ |
109 V(LoadIC) \ | 106 V(LoadIC) \ |
110 V(LoadICProtoArray) \ | 107 V(LoadICProtoArray) \ |
111 V(KeyedLoadICTF) \ | 108 V(KeyedLoadICTF) \ |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 820 |
824 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); | 821 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); |
825 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); | 822 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); |
826 | 823 |
827 int skip_stub_frame() const { return SkipStubFrameBits::decode(minor_key_); } | 824 int skip_stub_frame() const { return SkipStubFrameBits::decode(minor_key_); } |
828 | 825 |
829 private: | 826 private: |
830 class SkipStubFrameBits : public BitField<bool, 0, 1> {}; | 827 class SkipStubFrameBits : public BitField<bool, 0, 1> {}; |
831 }; | 828 }; |
832 | 829 |
833 class FastCloneRegExpStub final : public TurboFanCodeStub { | |
834 public: | |
835 explicit FastCloneRegExpStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | |
836 | |
837 static compiler::Node* Generate(CodeStubAssembler* assembler, | |
838 compiler::Node* closure, | |
839 compiler::Node* literal_index, | |
840 compiler::Node* pattern, | |
841 compiler::Node* flags, | |
842 compiler::Node* context); | |
843 | |
844 private: | |
845 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); | |
846 DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub); | |
847 }; | |
848 | |
849 class FastCloneShallowArrayStub : public TurboFanCodeStub { | |
850 public: | |
851 // Maximum number of elements in copied array (chosen so that even an array | |
852 // backed by a double backing store will fit into new-space). | |
853 static const int kMaximumClonedElements = | |
854 JSArray::kInitialMaxFastElementArray * kPointerSize / kDoubleSize; | |
855 | |
856 FastCloneShallowArrayStub(Isolate* isolate, | |
857 AllocationSiteMode allocation_site_mode) | |
858 : TurboFanCodeStub(isolate) { | |
859 minor_key_ = AllocationSiteModeBits::encode(allocation_site_mode); | |
860 } | |
861 | |
862 static compiler::Node* Generate(CodeStubAssembler* assembler, | |
863 compiler::Node* closure, | |
864 compiler::Node* literal_index, | |
865 compiler::Node* context, | |
866 compiler::CodeAssemblerLabel* call_runtime, | |
867 AllocationSiteMode allocation_site_mode); | |
868 | |
869 AllocationSiteMode allocation_site_mode() const { | |
870 return AllocationSiteModeBits::decode(minor_key_); | |
871 } | |
872 | |
873 private: | |
874 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | |
875 | |
876 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray); | |
877 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowArray, TurboFanCodeStub); | |
878 }; | |
879 | |
880 class FastCloneShallowObjectStub : public TurboFanCodeStub { | |
881 public: | |
882 // Maximum number of properties in copied object. | |
883 static const int kMaximumClonedProperties = 6; | |
884 | |
885 FastCloneShallowObjectStub(Isolate* isolate, int length) | |
886 : TurboFanCodeStub(isolate) { | |
887 DCHECK_GE(length, 0); | |
888 DCHECK_LE(length, kMaximumClonedProperties); | |
889 minor_key_ = LengthBits::encode(LengthBits::encode(length)); | |
890 } | |
891 | |
892 static compiler::Node* GenerateFastPath( | |
893 CodeStubAssembler* assembler, compiler::CodeAssemblerLabel* call_runtime, | |
894 compiler::Node* closure, compiler::Node* literals_index, | |
895 compiler::Node* properties_count); | |
896 | |
897 static int PropertiesCount(int literal_length); | |
898 | |
899 int length() const { return LengthBits::decode(minor_key_); } | |
900 | |
901 private: | |
902 class LengthBits : public BitField<int, 0, 4> {}; | |
903 | |
904 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowObject); | |
905 DEFINE_TURBOFAN_CODE_STUB(FastCloneShallowObject, TurboFanCodeStub); | |
906 }; | |
907 | |
908 class CreateAllocationSiteStub : public TurboFanCodeStub { | 830 class CreateAllocationSiteStub : public TurboFanCodeStub { |
909 public: | 831 public: |
910 explicit CreateAllocationSiteStub(Isolate* isolate) | 832 explicit CreateAllocationSiteStub(Isolate* isolate) |
911 : TurboFanCodeStub(isolate) {} | 833 : TurboFanCodeStub(isolate) {} |
912 static void GenerateAheadOfTime(Isolate* isolate); | 834 static void GenerateAheadOfTime(Isolate* isolate); |
913 | 835 |
914 DEFINE_CALL_INTERFACE_DESCRIPTOR(CreateAllocationSite); | 836 DEFINE_CALL_INTERFACE_DESCRIPTOR(CreateAllocationSite); |
915 DEFINE_TURBOFAN_CODE_STUB(CreateAllocationSite, TurboFanCodeStub); | 837 DEFINE_TURBOFAN_CODE_STUB(CreateAllocationSite, TurboFanCodeStub); |
916 }; | 838 }; |
917 | 839 |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 #undef DEFINE_PLATFORM_CODE_STUB | 2332 #undef DEFINE_PLATFORM_CODE_STUB |
2411 #undef DEFINE_HANDLER_CODE_STUB | 2333 #undef DEFINE_HANDLER_CODE_STUB |
2412 #undef DEFINE_HYDROGEN_CODE_STUB | 2334 #undef DEFINE_HYDROGEN_CODE_STUB |
2413 #undef DEFINE_CODE_STUB | 2335 #undef DEFINE_CODE_STUB |
2414 #undef DEFINE_CODE_STUB_BASE | 2336 #undef DEFINE_CODE_STUB_BASE |
2415 | 2337 |
2416 } // namespace internal | 2338 } // namespace internal |
2417 } // namespace v8 | 2339 } // namespace v8 |
2418 | 2340 |
2419 #endif // V8_CODE_STUBS_H_ | 2341 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |