| 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" |
| 11 #include "src/compiler/code-stub-assembler.h" | 11 #include "src/compiler/code-stub-assembler.h" |
| 12 #include "src/globals.h" | 12 #include "src/globals.h" |
| 13 #include "src/ic/ic-state.h" | 13 #include "src/ic/ic-state.h" |
| 14 #include "src/interface-descriptors.h" | 14 #include "src/interface-descriptors.h" |
| 15 #include "src/macro-assembler.h" | 15 #include "src/macro-assembler.h" |
| 16 #include "src/ostreams.h" | 16 #include "src/ostreams.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 // List of code stubs used on all platforms. | 21 // List of code stubs used on all platforms. |
| 22 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 22 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 23 /* PlatformCodeStubs */ \ | 23 /* PlatformCodeStubs */ \ |
| 24 V(ArgumentsAccess) \ | |
| 25 V(ArrayConstructor) \ | 24 V(ArrayConstructor) \ |
| 26 V(BinaryOpICWithAllocationSite) \ | 25 V(BinaryOpICWithAllocationSite) \ |
| 27 V(CallApiFunction) \ | 26 V(CallApiFunction) \ |
| 28 V(CallApiAccessor) \ | 27 V(CallApiAccessor) \ |
| 29 V(CallApiGetter) \ | 28 V(CallApiGetter) \ |
| 30 V(CallConstruct) \ | 29 V(CallConstruct) \ |
| 31 V(CallIC) \ | 30 V(CallIC) \ |
| 32 V(CEntry) \ | 31 V(CEntry) \ |
| 33 V(CompareIC) \ | 32 V(CompareIC) \ |
| 34 V(DoubleToI) \ | 33 V(DoubleToI) \ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 V(CompareNilIC) \ | 70 V(CompareNilIC) \ |
| 72 V(CreateAllocationSite) \ | 71 V(CreateAllocationSite) \ |
| 73 V(CreateWeakCell) \ | 72 V(CreateWeakCell) \ |
| 74 V(ElementsTransitionAndStore) \ | 73 V(ElementsTransitionAndStore) \ |
| 75 V(FastCloneRegExp) \ | 74 V(FastCloneRegExp) \ |
| 76 V(FastCloneShallowArray) \ | 75 V(FastCloneShallowArray) \ |
| 77 V(FastCloneShallowObject) \ | 76 V(FastCloneShallowObject) \ |
| 78 V(FastNewClosure) \ | 77 V(FastNewClosure) \ |
| 79 V(FastNewContext) \ | 78 V(FastNewContext) \ |
| 80 V(FastNewRestParameter) \ | 79 V(FastNewRestParameter) \ |
| 81 V(FastNewStrictArguments) \ | 80 V(FastNewSloppyArguments) \ |
| 81 V(FastNewStrictArguments) \ |
| 82 V(GrowArrayElements) \ | 82 V(GrowArrayElements) \ |
| 83 V(InternalArrayNArgumentsConstructor) \ | 83 V(InternalArrayNArgumentsConstructor) \ |
| 84 V(InternalArrayNoArgumentConstructor) \ | 84 V(InternalArrayNoArgumentConstructor) \ |
| 85 V(InternalArraySingleArgumentConstructor) \ | 85 V(InternalArraySingleArgumentConstructor) \ |
| 86 V(KeyedLoadGeneric) \ | 86 V(KeyedLoadGeneric) \ |
| 87 V(LoadGlobalViaContext) \ | 87 V(LoadGlobalViaContext) \ |
| 88 V(LoadScriptContextField) \ | 88 V(LoadScriptContextField) \ |
| 89 V(LoadDictionaryElement) \ | 89 V(LoadDictionaryElement) \ |
| 90 V(NameDictionaryLookup) \ | 90 V(NameDictionaryLookup) \ |
| 91 V(NumberToString) \ | 91 V(NumberToString) \ |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 explicit FastNewRestParameterStub(Isolate* isolate) | 735 explicit FastNewRestParameterStub(Isolate* isolate) |
| 736 : PlatformCodeStub(isolate) {} | 736 : PlatformCodeStub(isolate) {} |
| 737 | 737 |
| 738 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewRestParameter); | 738 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewRestParameter); |
| 739 DEFINE_PLATFORM_CODE_STUB(FastNewRestParameter, PlatformCodeStub); | 739 DEFINE_PLATFORM_CODE_STUB(FastNewRestParameter, PlatformCodeStub); |
| 740 }; | 740 }; |
| 741 | 741 |
| 742 | 742 |
| 743 // TODO(turbofan): This stub should be possible to write in TurboFan | 743 // TODO(turbofan): This stub should be possible to write in TurboFan |
| 744 // using the CodeStubAssembler very soon in a way that is as efficient | 744 // using the CodeStubAssembler very soon in a way that is as efficient |
| 745 // and easy as the current handwritten version, which is partly a copy | 745 // and easy as the current handwritten version. |
| 746 // of the strict arguments object materialization code. | 746 class FastNewSloppyArgumentsStub final : public PlatformCodeStub { |
| 747 public: |
| 748 explicit FastNewSloppyArgumentsStub(Isolate* isolate) |
| 749 : PlatformCodeStub(isolate) {} |
| 750 |
| 751 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewSloppyArguments); |
| 752 DEFINE_PLATFORM_CODE_STUB(FastNewSloppyArguments, PlatformCodeStub); |
| 753 }; |
| 754 |
| 755 |
| 756 // TODO(turbofan): This stub should be possible to write in TurboFan |
| 757 // using the CodeStubAssembler very soon in a way that is as efficient |
| 758 // and easy as the current handwritten version. |
| 747 class FastNewStrictArgumentsStub final : public PlatformCodeStub { | 759 class FastNewStrictArgumentsStub final : public PlatformCodeStub { |
| 748 public: | 760 public: |
| 749 explicit FastNewStrictArgumentsStub(Isolate* isolate) | 761 explicit FastNewStrictArgumentsStub(Isolate* isolate) |
| 750 : PlatformCodeStub(isolate) {} | 762 : PlatformCodeStub(isolate) {} |
| 751 | 763 |
| 752 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); | 764 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); |
| 753 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); | 765 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); |
| 754 }; | 766 }; |
| 755 | 767 |
| 756 | 768 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 | 1845 |
| 1834 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; | 1846 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; |
| 1835 | 1847 |
| 1836 int handler_offset_; | 1848 int handler_offset_; |
| 1837 | 1849 |
| 1838 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 1850 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 1839 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); | 1851 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); |
| 1840 }; | 1852 }; |
| 1841 | 1853 |
| 1842 | 1854 |
| 1843 class ArgumentsAccessStub: public PlatformCodeStub { | |
| 1844 public: | |
| 1845 enum Type { | |
| 1846 NEW_SLOPPY_FAST, | |
| 1847 NEW_SLOPPY_SLOW, | |
| 1848 }; | |
| 1849 | |
| 1850 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | |
| 1851 minor_key_ = TypeBits::encode(type); | |
| 1852 } | |
| 1853 | |
| 1854 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | |
| 1855 return ArgumentsAccessNewDescriptor(isolate()); | |
| 1856 } | |
| 1857 | |
| 1858 static Type ComputeType(bool has_duplicate_parameters) { | |
| 1859 if (has_duplicate_parameters) { | |
| 1860 return Type::NEW_SLOPPY_SLOW; | |
| 1861 } else { | |
| 1862 return Type::NEW_SLOPPY_FAST; | |
| 1863 } | |
| 1864 } | |
| 1865 | |
| 1866 private: | |
| 1867 Type type() const { return TypeBits::decode(minor_key_); } | |
| 1868 | |
| 1869 void GenerateNewSloppyFast(MacroAssembler* masm); | |
| 1870 void GenerateNewSloppySlow(MacroAssembler* masm); | |
| 1871 | |
| 1872 void PrintName(std::ostream& os) const override; // NOLINT | |
| 1873 | |
| 1874 class TypeBits : public BitField<Type, 0, 1> {}; | |
| 1875 | |
| 1876 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); | |
| 1877 }; | |
| 1878 | |
| 1879 | |
| 1880 class RegExpExecStub: public PlatformCodeStub { | 1855 class RegExpExecStub: public PlatformCodeStub { |
| 1881 public: | 1856 public: |
| 1882 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1857 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1883 | 1858 |
| 1884 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); | 1859 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
| 1885 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); | 1860 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); |
| 1886 }; | 1861 }; |
| 1887 | 1862 |
| 1888 | 1863 |
| 1889 class RegExpConstructResultStub final : public HydrogenCodeStub { | 1864 class RegExpConstructResultStub final : public HydrogenCodeStub { |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 #undef DEFINE_HYDROGEN_CODE_STUB | 2972 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2998 #undef DEFINE_CODE_STUB | 2973 #undef DEFINE_CODE_STUB |
| 2999 #undef DEFINE_CODE_STUB_BASE | 2974 #undef DEFINE_CODE_STUB_BASE |
| 3000 | 2975 |
| 3001 extern Representation RepresentationFromType(Type* type); | 2976 extern Representation RepresentationFromType(Type* type); |
| 3002 | 2977 |
| 3003 } // namespace internal | 2978 } // namespace internal |
| 3004 } // namespace v8 | 2979 } // namespace v8 |
| 3005 | 2980 |
| 3006 #endif // V8_CODE_STUBS_H_ | 2981 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |