| 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) \ |
| 24 V(ArrayConstructor) \ | 25 V(ArrayConstructor) \ |
| 25 V(BinaryOpICWithAllocationSite) \ | 26 V(BinaryOpICWithAllocationSite) \ |
| 26 V(CallApiFunction) \ | 27 V(CallApiFunction) \ |
| 27 V(CallApiAccessor) \ | 28 V(CallApiAccessor) \ |
| 28 V(CallApiGetter) \ | 29 V(CallApiGetter) \ |
| 29 V(CallConstruct) \ | 30 V(CallConstruct) \ |
| 30 V(CallIC) \ | 31 V(CallIC) \ |
| 31 V(CEntry) \ | 32 V(CEntry) \ |
| 32 V(CompareIC) \ | 33 V(CompareIC) \ |
| 33 V(DoubleToI) \ | 34 V(DoubleToI) \ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 V(CompareNilIC) \ | 71 V(CompareNilIC) \ |
| 71 V(CreateAllocationSite) \ | 72 V(CreateAllocationSite) \ |
| 72 V(CreateWeakCell) \ | 73 V(CreateWeakCell) \ |
| 73 V(ElementsTransitionAndStore) \ | 74 V(ElementsTransitionAndStore) \ |
| 74 V(FastCloneRegExp) \ | 75 V(FastCloneRegExp) \ |
| 75 V(FastCloneShallowArray) \ | 76 V(FastCloneShallowArray) \ |
| 76 V(FastCloneShallowObject) \ | 77 V(FastCloneShallowObject) \ |
| 77 V(FastNewClosure) \ | 78 V(FastNewClosure) \ |
| 78 V(FastNewContext) \ | 79 V(FastNewContext) \ |
| 79 V(FastNewRestParameter) \ | 80 V(FastNewRestParameter) \ |
| 80 V(FastNewSloppyArguments) \ | 81 V(FastNewStrictArguments) \ |
| 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. | 745 // and easy as the current handwritten version, which is partly a copy |
| 746 class FastNewSloppyArgumentsStub final : public PlatformCodeStub { | 746 // of the strict arguments object materialization code. |
| 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. | |
| 759 class FastNewStrictArgumentsStub final : public PlatformCodeStub { | 747 class FastNewStrictArgumentsStub final : public PlatformCodeStub { |
| 760 public: | 748 public: |
| 761 explicit FastNewStrictArgumentsStub(Isolate* isolate) | 749 explicit FastNewStrictArgumentsStub(Isolate* isolate) |
| 762 : PlatformCodeStub(isolate) {} | 750 : PlatformCodeStub(isolate) {} |
| 763 | 751 |
| 764 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); | 752 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); |
| 765 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); | 753 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); |
| 766 }; | 754 }; |
| 767 | 755 |
| 768 | 756 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 | 1833 |
| 1846 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; | 1834 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; |
| 1847 | 1835 |
| 1848 int handler_offset_; | 1836 int handler_offset_; |
| 1849 | 1837 |
| 1850 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 1838 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 1851 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); | 1839 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); |
| 1852 }; | 1840 }; |
| 1853 | 1841 |
| 1854 | 1842 |
| 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 |
| 1855 class RegExpExecStub: public PlatformCodeStub { | 1880 class RegExpExecStub: public PlatformCodeStub { |
| 1856 public: | 1881 public: |
| 1857 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1882 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1858 | 1883 |
| 1859 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); | 1884 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
| 1860 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); | 1885 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); |
| 1861 }; | 1886 }; |
| 1862 | 1887 |
| 1863 | 1888 |
| 1864 class RegExpConstructResultStub final : public HydrogenCodeStub { | 1889 class RegExpConstructResultStub final : public HydrogenCodeStub { |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2972 #undef DEFINE_HYDROGEN_CODE_STUB | 2997 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2973 #undef DEFINE_CODE_STUB | 2998 #undef DEFINE_CODE_STUB |
| 2974 #undef DEFINE_CODE_STUB_BASE | 2999 #undef DEFINE_CODE_STUB_BASE |
| 2975 | 3000 |
| 2976 extern Representation RepresentationFromType(Type* type); | 3001 extern Representation RepresentationFromType(Type* type); |
| 2977 | 3002 |
| 2978 } // namespace internal | 3003 } // namespace internal |
| 2979 } // namespace v8 | 3004 } // namespace v8 |
| 2980 | 3005 |
| 2981 #endif // V8_CODE_STUBS_H_ | 3006 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |