OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 1980 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
1981 uint32_t bit_field_; | 1981 uint32_t bit_field_; |
1982 | 1982 |
1983 Major MajorKey() { return TransitionElementsKind; } | 1983 Major MajorKey() { return TransitionElementsKind; } |
1984 int NotMissMinorKey() { return bit_field_; } | 1984 int NotMissMinorKey() { return bit_field_; } |
1985 | 1985 |
1986 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1986 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
1987 }; | 1987 }; |
1988 | 1988 |
1989 | 1989 |
1990 enum ContextCheckMode { | |
1991 CONTEXT_CHECK_REQUIRED, | |
1992 CONTEXT_CHECK_NOT_REQUIRED, | |
1993 LAST_CONTEXT_CHECK_MODE = CONTEXT_CHECK_NOT_REQUIRED | |
1994 }; | |
1995 | |
1996 | |
1997 class ArrayConstructorStubBase : public HydrogenCodeStub { | 1990 class ArrayConstructorStubBase : public HydrogenCodeStub { |
1998 public: | 1991 public: |
1999 ArrayConstructorStubBase(ElementsKind kind, ContextCheckMode context_mode, | 1992 ArrayConstructorStubBase(ElementsKind kind, |
2000 AllocationSiteOverrideMode override_mode) { | 1993 AllocationSiteOverrideMode override_mode) { |
2001 // It only makes sense to override local allocation site behavior | 1994 // It only makes sense to override local allocation site behavior |
2002 // if there is a difference between the global allocation site policy | 1995 // if there is a difference between the global allocation site policy |
2003 // for an ElementsKind and the desired usage of the stub. | 1996 // for an ElementsKind and the desired usage of the stub. |
2004 ASSERT(override_mode != DISABLE_ALLOCATION_SITES || | 1997 ASSERT(override_mode != DISABLE_ALLOCATION_SITES || |
2005 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); | 1998 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); |
2006 bit_field_ = ElementsKindBits::encode(kind) | | 1999 bit_field_ = ElementsKindBits::encode(kind) | |
2007 AllocationSiteOverrideModeBits::encode(override_mode) | | 2000 AllocationSiteOverrideModeBits::encode(override_mode); |
2008 ContextCheckModeBits::encode(context_mode); | |
2009 } | 2001 } |
2010 | 2002 |
2011 ElementsKind elements_kind() const { | 2003 ElementsKind elements_kind() const { |
2012 return ElementsKindBits::decode(bit_field_); | 2004 return ElementsKindBits::decode(bit_field_); |
2013 } | 2005 } |
2014 | 2006 |
2015 AllocationSiteOverrideMode override_mode() const { | 2007 AllocationSiteOverrideMode override_mode() const { |
2016 return AllocationSiteOverrideModeBits::decode(bit_field_); | 2008 return AllocationSiteOverrideModeBits::decode(bit_field_); |
2017 } | 2009 } |
2018 | 2010 |
2019 ContextCheckMode context_mode() const { | |
2020 return ContextCheckModeBits::decode(bit_field_); | |
2021 } | |
2022 | |
2023 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2011 static void GenerateStubsAheadOfTime(Isolate* isolate); |
2024 static void InstallDescriptors(Isolate* isolate); | 2012 static void InstallDescriptors(Isolate* isolate); |
2025 | 2013 |
2026 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2014 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
2027 static const int kConstructor = 0; | 2015 static const int kConstructor = 0; |
2028 static const int kPropertyCell = 1; | 2016 static const int kPropertyCell = 1; |
2029 | 2017 |
2030 protected: | 2018 protected: |
2031 void BasePrintName(const char* name, StringStream* stream); | 2019 void BasePrintName(const char* name, StringStream* stream); |
2032 | 2020 |
2033 private: | 2021 private: |
2034 int NotMissMinorKey() { return bit_field_; } | 2022 int NotMissMinorKey() { return bit_field_; } |
2035 | 2023 |
2036 // Ensure data fits within available bits. | 2024 // Ensure data fits within available bits. |
2037 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2025 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
2038 STATIC_ASSERT(LAST_CONTEXT_CHECK_MODE == 1); | |
2039 | 2026 |
2040 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2027 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2041 class AllocationSiteOverrideModeBits: public | 2028 class AllocationSiteOverrideModeBits: public |
2042 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2029 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
2043 class ContextCheckModeBits: public BitField<ContextCheckMode, 9, 1> {}; | |
2044 uint32_t bit_field_; | 2030 uint32_t bit_field_; |
2045 | 2031 |
2046 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 2032 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
2047 }; | 2033 }; |
2048 | 2034 |
2049 | 2035 |
2050 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2036 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
2051 public: | 2037 public: |
2052 ArrayNoArgumentConstructorStub( | 2038 ArrayNoArgumentConstructorStub( |
2053 ElementsKind kind, | 2039 ElementsKind kind, |
2054 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
2055 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2040 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2056 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2041 : ArrayConstructorStubBase(kind, override_mode) { |
2057 } | 2042 } |
2058 | 2043 |
2059 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2044 virtual Handle<Code> GenerateCode(Isolate* isolate); |
2060 | 2045 |
2061 virtual void InitializeInterfaceDescriptor( | 2046 virtual void InitializeInterfaceDescriptor( |
2062 Isolate* isolate, | 2047 Isolate* isolate, |
2063 CodeStubInterfaceDescriptor* descriptor); | 2048 CodeStubInterfaceDescriptor* descriptor); |
2064 | 2049 |
2065 private: | 2050 private: |
2066 Major MajorKey() { return ArrayNoArgumentConstructor; } | 2051 Major MajorKey() { return ArrayNoArgumentConstructor; } |
2067 | 2052 |
2068 virtual void PrintName(StringStream* stream) { | 2053 virtual void PrintName(StringStream* stream) { |
2069 BasePrintName("ArrayNoArgumentConstructorStub", stream); | 2054 BasePrintName("ArrayNoArgumentConstructorStub", stream); |
2070 } | 2055 } |
2071 | 2056 |
2072 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2057 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
2073 }; | 2058 }; |
2074 | 2059 |
2075 | 2060 |
2076 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2061 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2077 public: | 2062 public: |
2078 ArraySingleArgumentConstructorStub( | 2063 ArraySingleArgumentConstructorStub( |
2079 ElementsKind kind, | 2064 ElementsKind kind, |
2080 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
2081 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2065 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2082 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2066 : ArrayConstructorStubBase(kind, override_mode) { |
2083 } | 2067 } |
2084 | 2068 |
2085 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2069 virtual Handle<Code> GenerateCode(Isolate* isolate); |
2086 | 2070 |
2087 virtual void InitializeInterfaceDescriptor( | 2071 virtual void InitializeInterfaceDescriptor( |
2088 Isolate* isolate, | 2072 Isolate* isolate, |
2089 CodeStubInterfaceDescriptor* descriptor); | 2073 CodeStubInterfaceDescriptor* descriptor); |
2090 | 2074 |
2091 private: | 2075 private: |
2092 Major MajorKey() { return ArraySingleArgumentConstructor; } | 2076 Major MajorKey() { return ArraySingleArgumentConstructor; } |
2093 | 2077 |
2094 virtual void PrintName(StringStream* stream) { | 2078 virtual void PrintName(StringStream* stream) { |
2095 BasePrintName("ArraySingleArgumentConstructorStub", stream); | 2079 BasePrintName("ArraySingleArgumentConstructorStub", stream); |
2096 } | 2080 } |
2097 | 2081 |
2098 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2082 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
2099 }; | 2083 }; |
2100 | 2084 |
2101 | 2085 |
2102 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2086 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
2103 public: | 2087 public: |
2104 ArrayNArgumentsConstructorStub( | 2088 ArrayNArgumentsConstructorStub( |
2105 ElementsKind kind, | 2089 ElementsKind kind, |
2106 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
2107 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2090 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2108 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2091 : ArrayConstructorStubBase(kind, override_mode) { |
2109 } | 2092 } |
2110 | 2093 |
2111 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2094 virtual Handle<Code> GenerateCode(Isolate* isolate); |
2112 | 2095 |
2113 virtual void InitializeInterfaceDescriptor( | 2096 virtual void InitializeInterfaceDescriptor( |
2114 Isolate* isolate, | 2097 Isolate* isolate, |
2115 CodeStubInterfaceDescriptor* descriptor); | 2098 CodeStubInterfaceDescriptor* descriptor); |
2116 | 2099 |
2117 private: | 2100 private: |
2118 Major MajorKey() { return ArrayNArgumentsConstructor; } | 2101 Major MajorKey() { return ArrayNArgumentsConstructor; } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 int MinorKey() { return 0; } | 2436 int MinorKey() { return 0; } |
2454 | 2437 |
2455 void Generate(MacroAssembler* masm); | 2438 void Generate(MacroAssembler* masm); |
2456 | 2439 |
2457 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2440 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2458 }; | 2441 }; |
2459 | 2442 |
2460 } } // namespace v8::internal | 2443 } } // namespace v8::internal |
2461 | 2444 |
2462 #endif // V8_CODE_STUBS_H_ | 2445 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |