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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 V(CompareNilIC) \ | 71 V(CompareNilIC) \ |
72 V(CreateAllocationSite) \ | 72 V(CreateAllocationSite) \ |
73 V(CreateWeakCell) \ | 73 V(CreateWeakCell) \ |
74 V(ElementsTransitionAndStore) \ | 74 V(ElementsTransitionAndStore) \ |
75 V(FastCloneRegExp) \ | 75 V(FastCloneRegExp) \ |
76 V(FastCloneShallowArray) \ | 76 V(FastCloneShallowArray) \ |
77 V(FastCloneShallowObject) \ | 77 V(FastCloneShallowObject) \ |
78 V(FastNewClosure) \ | 78 V(FastNewClosure) \ |
79 V(FastNewContext) \ | 79 V(FastNewContext) \ |
80 V(FastNewRestParameter) \ | 80 V(FastNewRestParameter) \ |
| 81 V(FastNewStrictArguments) \ |
81 V(GrowArrayElements) \ | 82 V(GrowArrayElements) \ |
82 V(InternalArrayNArgumentsConstructor) \ | 83 V(InternalArrayNArgumentsConstructor) \ |
83 V(InternalArrayNoArgumentConstructor) \ | 84 V(InternalArrayNoArgumentConstructor) \ |
84 V(InternalArraySingleArgumentConstructor) \ | 85 V(InternalArraySingleArgumentConstructor) \ |
85 V(KeyedLoadGeneric) \ | 86 V(KeyedLoadGeneric) \ |
86 V(LoadGlobalViaContext) \ | 87 V(LoadGlobalViaContext) \ |
87 V(LoadScriptContextField) \ | 88 V(LoadScriptContextField) \ |
88 V(LoadDictionaryElement) \ | 89 V(LoadDictionaryElement) \ |
89 V(NameDictionaryLookup) \ | 90 V(NameDictionaryLookup) \ |
90 V(NumberToString) \ | 91 V(NumberToString) \ |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 class FastNewRestParameterStub final : public PlatformCodeStub { | 733 class FastNewRestParameterStub final : public PlatformCodeStub { |
733 public: | 734 public: |
734 explicit FastNewRestParameterStub(Isolate* isolate) | 735 explicit FastNewRestParameterStub(Isolate* isolate) |
735 : PlatformCodeStub(isolate) {} | 736 : PlatformCodeStub(isolate) {} |
736 | 737 |
737 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewRestParameter); | 738 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewRestParameter); |
738 DEFINE_PLATFORM_CODE_STUB(FastNewRestParameter, PlatformCodeStub); | 739 DEFINE_PLATFORM_CODE_STUB(FastNewRestParameter, PlatformCodeStub); |
739 }; | 740 }; |
740 | 741 |
741 | 742 |
| 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 |
| 745 // and easy as the current handwritten version, which is partly a copy |
| 746 // of the strict arguments object materialization code. |
| 747 class FastNewStrictArgumentsStub final : public PlatformCodeStub { |
| 748 public: |
| 749 explicit FastNewStrictArgumentsStub(Isolate* isolate) |
| 750 : PlatformCodeStub(isolate) {} |
| 751 |
| 752 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewStrictArguments); |
| 753 DEFINE_PLATFORM_CODE_STUB(FastNewStrictArguments, PlatformCodeStub); |
| 754 }; |
| 755 |
| 756 |
742 class FastCloneRegExpStub final : public HydrogenCodeStub { | 757 class FastCloneRegExpStub final : public HydrogenCodeStub { |
743 public: | 758 public: |
744 explicit FastCloneRegExpStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 759 explicit FastCloneRegExpStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
745 | 760 |
746 private: | 761 private: |
747 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); | 762 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp); |
748 DEFINE_HYDROGEN_CODE_STUB(FastCloneRegExp, HydrogenCodeStub); | 763 DEFINE_HYDROGEN_CODE_STUB(FastCloneRegExp, HydrogenCodeStub); |
749 }; | 764 }; |
750 | 765 |
751 | 766 |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); | 1839 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); |
1825 }; | 1840 }; |
1826 | 1841 |
1827 | 1842 |
1828 class ArgumentsAccessStub: public PlatformCodeStub { | 1843 class ArgumentsAccessStub: public PlatformCodeStub { |
1829 public: | 1844 public: |
1830 enum Type { | 1845 enum Type { |
1831 READ_ELEMENT, | 1846 READ_ELEMENT, |
1832 NEW_SLOPPY_FAST, | 1847 NEW_SLOPPY_FAST, |
1833 NEW_SLOPPY_SLOW, | 1848 NEW_SLOPPY_SLOW, |
1834 NEW_STRICT | |
1835 }; | 1849 }; |
1836 | 1850 |
1837 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1851 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { |
1838 minor_key_ = TypeBits::encode(type); | 1852 minor_key_ = TypeBits::encode(type); |
1839 } | 1853 } |
1840 | 1854 |
1841 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 1855 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
1842 if (type() == READ_ELEMENT) { | 1856 if (type() == READ_ELEMENT) { |
1843 return ArgumentsAccessReadDescriptor(isolate()); | 1857 return ArgumentsAccessReadDescriptor(isolate()); |
1844 } else { | 1858 } else { |
1845 return ArgumentsAccessNewDescriptor(isolate()); | 1859 return ArgumentsAccessNewDescriptor(isolate()); |
1846 } | 1860 } |
1847 } | 1861 } |
1848 | 1862 |
1849 static Type ComputeType(bool is_unmapped, bool has_duplicate_parameters) { | 1863 static Type ComputeType(bool has_duplicate_parameters) { |
1850 if (is_unmapped) { | 1864 if (has_duplicate_parameters) { |
1851 return Type::NEW_STRICT; | |
1852 } else if (has_duplicate_parameters) { | |
1853 return Type::NEW_SLOPPY_SLOW; | 1865 return Type::NEW_SLOPPY_SLOW; |
1854 } else { | 1866 } else { |
1855 return Type::NEW_SLOPPY_FAST; | 1867 return Type::NEW_SLOPPY_FAST; |
1856 } | 1868 } |
1857 } | 1869 } |
1858 | 1870 |
1859 private: | 1871 private: |
1860 Type type() const { return TypeBits::decode(minor_key_); } | 1872 Type type() const { return TypeBits::decode(minor_key_); } |
1861 | 1873 |
1862 void GenerateReadElement(MacroAssembler* masm); | 1874 void GenerateReadElement(MacroAssembler* masm); |
1863 void GenerateNewStrict(MacroAssembler* masm); | |
1864 void GenerateNewSloppyFast(MacroAssembler* masm); | 1875 void GenerateNewSloppyFast(MacroAssembler* masm); |
1865 void GenerateNewSloppySlow(MacroAssembler* masm); | 1876 void GenerateNewSloppySlow(MacroAssembler* masm); |
1866 | 1877 |
1867 void PrintName(std::ostream& os) const override; // NOLINT | 1878 void PrintName(std::ostream& os) const override; // NOLINT |
1868 | 1879 |
1869 class TypeBits : public BitField<Type, 0, 2> {}; | 1880 class TypeBits : public BitField<Type, 0, 2> {}; |
1870 | 1881 |
1871 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); | 1882 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); |
1872 }; | 1883 }; |
1873 | 1884 |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 #undef DEFINE_HYDROGEN_CODE_STUB | 3003 #undef DEFINE_HYDROGEN_CODE_STUB |
2993 #undef DEFINE_CODE_STUB | 3004 #undef DEFINE_CODE_STUB |
2994 #undef DEFINE_CODE_STUB_BASE | 3005 #undef DEFINE_CODE_STUB_BASE |
2995 | 3006 |
2996 extern Representation RepresentationFromType(Type* type); | 3007 extern Representation RepresentationFromType(Type* type); |
2997 | 3008 |
2998 } // namespace internal | 3009 } // namespace internal |
2999 } // namespace v8 | 3010 } // namespace v8 |
3000 | 3011 |
3001 #endif // V8_CODE_STUBS_H_ | 3012 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |