| 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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 CodeStubInterfaceDescriptor* descriptor); | 1054 CodeStubInterfaceDescriptor* descriptor); |
| 1055 | 1055 |
| 1056 virtual Handle<Code> GenerateCode(Isolate* isolate); | 1056 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 1057 | 1057 |
| 1058 private: | 1058 private: |
| 1059 virtual int NotMissMinorKey() { | 1059 virtual int NotMissMinorKey() { |
| 1060 return GetExtraICState() | ArgcBits::encode(argc_); | 1060 return GetExtraICState() | ArgcBits::encode(argc_); |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 class ContextualBits: public BitField<bool, 0, 1> {}; | 1063 class ContextualBits: public BitField<bool, 0, 1> {}; |
| 1064 STATIC_ASSERT(CallICBase::Contextual::kShift == ContextualBits::kShift); | 1064 STATIC_ASSERT(IC::Contextual::kShift == ContextualBits::kShift); |
| 1065 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); | 1065 STATIC_ASSERT(IC::Contextual::kSize == ContextualBits::kSize); |
| 1066 class HoleyBits: public BitField<bool, 1, 1> {}; | 1066 class HoleyBits: public BitField<bool, 1, 1> {}; |
| 1067 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); | 1067 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); |
| 1068 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1068 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
| 1069 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } | 1069 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } |
| 1070 int bit_field_; | 1070 int bit_field_; |
| 1071 int argc_; | 1071 int argc_; |
| 1072 }; | 1072 }; |
| 1073 | 1073 |
| 1074 | 1074 |
| 1075 class BinaryOpICStub : public HydrogenCodeStub { | 1075 class BinaryOpICStub : public HydrogenCodeStub { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 const BinaryOpIC::State& state); | 1172 const BinaryOpIC::State& state); |
| 1173 | 1173 |
| 1174 BinaryOpIC::State state_; | 1174 BinaryOpIC::State state_; |
| 1175 | 1175 |
| 1176 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); | 1176 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); |
| 1177 }; | 1177 }; |
| 1178 | 1178 |
| 1179 | 1179 |
| 1180 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { | 1180 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { |
| 1181 public: | 1181 public: |
| 1182 BinaryOpWithAllocationSiteStub(Token::Value op, OverwriteMode mode) |
| 1183 : BinaryOpICStub(op, mode) {} |
| 1184 |
| 1182 explicit BinaryOpWithAllocationSiteStub(const BinaryOpIC::State& state) | 1185 explicit BinaryOpWithAllocationSiteStub(const BinaryOpIC::State& state) |
| 1183 : BinaryOpICStub(state) {} | 1186 : BinaryOpICStub(state) {} |
| 1184 | 1187 |
| 1185 virtual void InitializeInterfaceDescriptor( | 1188 virtual void InitializeInterfaceDescriptor( |
| 1186 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1189 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1187 | 1190 |
| 1188 static void InstallDescriptors(Isolate* isolate); | 1191 static void InstallDescriptors(Isolate* isolate); |
| 1189 | 1192 |
| 1190 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { | 1193 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { |
| 1191 return Code::STUB; | 1194 return Code::STUB; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 return ArgcBits::decode(minor_key); | 1554 return ArgcBits::decode(minor_key); |
| 1552 } | 1555 } |
| 1553 | 1556 |
| 1554 private: | 1557 private: |
| 1555 int argc_; | 1558 int argc_; |
| 1556 CallFunctionFlags flags_; | 1559 CallFunctionFlags flags_; |
| 1557 | 1560 |
| 1558 virtual void PrintName(StringStream* stream); | 1561 virtual void PrintName(StringStream* stream); |
| 1559 | 1562 |
| 1560 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1563 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 1561 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; | 1564 class FlagBits: public BitField<CallFunctionFlags, 0, 1> {}; |
| 1562 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; | 1565 class ArgcBits: public BitField<unsigned, 1, 32 - 1> {}; |
| 1563 | 1566 |
| 1564 Major MajorKey() { return CallFunction; } | 1567 Major MajorKey() { return CallFunction; } |
| 1565 int MinorKey() { | 1568 int MinorKey() { |
| 1566 // Encode the parameters in a unique 32 bit value. | 1569 // Encode the parameters in a unique 32 bit value. |
| 1567 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); | 1570 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
| 1568 } | 1571 } |
| 1569 | 1572 |
| 1570 bool ReceiverMightBeImplicit() { | |
| 1571 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; | |
| 1572 } | |
| 1573 | |
| 1574 bool RecordCallTarget() { | 1573 bool RecordCallTarget() { |
| 1575 return (flags_ & RECORD_CALL_TARGET) != 0; | 1574 return (flags_ & RECORD_CALL_TARGET) != 0; |
| 1576 } | 1575 } |
| 1577 }; | 1576 }; |
| 1578 | 1577 |
| 1579 | 1578 |
| 1580 class CallConstructStub: public PlatformCodeStub { | 1579 class CallConstructStub: public PlatformCodeStub { |
| 1581 public: | 1580 public: |
| 1582 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} | 1581 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} |
| 1583 | 1582 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2004 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2006 uint32_t bit_field_; | 2005 uint32_t bit_field_; |
| 2007 | 2006 |
| 2008 Major MajorKey() { return TransitionElementsKind; } | 2007 Major MajorKey() { return TransitionElementsKind; } |
| 2009 int NotMissMinorKey() { return bit_field_; } | 2008 int NotMissMinorKey() { return bit_field_; } |
| 2010 | 2009 |
| 2011 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 2010 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 2012 }; | 2011 }; |
| 2013 | 2012 |
| 2014 | 2013 |
| 2015 enum ContextCheckMode { | |
| 2016 CONTEXT_CHECK_REQUIRED, | |
| 2017 CONTEXT_CHECK_NOT_REQUIRED, | |
| 2018 LAST_CONTEXT_CHECK_MODE = CONTEXT_CHECK_NOT_REQUIRED | |
| 2019 }; | |
| 2020 | |
| 2021 | |
| 2022 class ArrayConstructorStubBase : public HydrogenCodeStub { | 2014 class ArrayConstructorStubBase : public HydrogenCodeStub { |
| 2023 public: | 2015 public: |
| 2024 ArrayConstructorStubBase(ElementsKind kind, ContextCheckMode context_mode, | 2016 ArrayConstructorStubBase(ElementsKind kind, |
| 2025 AllocationSiteOverrideMode override_mode) { | 2017 AllocationSiteOverrideMode override_mode) { |
| 2026 // It only makes sense to override local allocation site behavior | 2018 // It only makes sense to override local allocation site behavior |
| 2027 // if there is a difference between the global allocation site policy | 2019 // if there is a difference between the global allocation site policy |
| 2028 // for an ElementsKind and the desired usage of the stub. | 2020 // for an ElementsKind and the desired usage of the stub. |
| 2029 ASSERT(!(FLAG_track_allocation_sites && | 2021 ASSERT(override_mode != DISABLE_ALLOCATION_SITES || |
| 2030 override_mode == DISABLE_ALLOCATION_SITES) || | |
| 2031 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); | 2022 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); |
| 2032 bit_field_ = ElementsKindBits::encode(kind) | | 2023 bit_field_ = ElementsKindBits::encode(kind) | |
| 2033 AllocationSiteOverrideModeBits::encode(override_mode) | | 2024 AllocationSiteOverrideModeBits::encode(override_mode); |
| 2034 ContextCheckModeBits::encode(context_mode); | |
| 2035 } | 2025 } |
| 2036 | 2026 |
| 2037 ElementsKind elements_kind() const { | 2027 ElementsKind elements_kind() const { |
| 2038 return ElementsKindBits::decode(bit_field_); | 2028 return ElementsKindBits::decode(bit_field_); |
| 2039 } | 2029 } |
| 2040 | 2030 |
| 2041 AllocationSiteOverrideMode override_mode() const { | 2031 AllocationSiteOverrideMode override_mode() const { |
| 2042 return AllocationSiteOverrideModeBits::decode(bit_field_); | 2032 return AllocationSiteOverrideModeBits::decode(bit_field_); |
| 2043 } | 2033 } |
| 2044 | 2034 |
| 2045 ContextCheckMode context_mode() const { | |
| 2046 return ContextCheckModeBits::decode(bit_field_); | |
| 2047 } | |
| 2048 | |
| 2049 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2035 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 2050 static void InstallDescriptors(Isolate* isolate); | 2036 static void InstallDescriptors(Isolate* isolate); |
| 2051 | 2037 |
| 2052 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2038 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2053 static const int kConstructor = 0; | 2039 static const int kConstructor = 0; |
| 2054 static const int kPropertyCell = 1; | 2040 static const int kPropertyCell = 1; |
| 2055 | 2041 |
| 2056 protected: | 2042 protected: |
| 2057 void BasePrintName(const char* name, StringStream* stream); | 2043 void BasePrintName(const char* name, StringStream* stream); |
| 2058 | 2044 |
| 2059 private: | 2045 private: |
| 2060 int NotMissMinorKey() { return bit_field_; } | 2046 int NotMissMinorKey() { return bit_field_; } |
| 2061 | 2047 |
| 2062 // Ensure data fits within available bits. | 2048 // Ensure data fits within available bits. |
| 2063 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2049 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
| 2064 STATIC_ASSERT(LAST_CONTEXT_CHECK_MODE == 1); | |
| 2065 | 2050 |
| 2066 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2051 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2067 class AllocationSiteOverrideModeBits: public | 2052 class AllocationSiteOverrideModeBits: public |
| 2068 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2053 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
| 2069 class ContextCheckModeBits: public BitField<ContextCheckMode, 9, 1> {}; | |
| 2070 uint32_t bit_field_; | 2054 uint32_t bit_field_; |
| 2071 | 2055 |
| 2072 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 2056 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
| 2073 }; | 2057 }; |
| 2074 | 2058 |
| 2075 | 2059 |
| 2076 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2060 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2077 public: | 2061 public: |
| 2078 ArrayNoArgumentConstructorStub( | 2062 ArrayNoArgumentConstructorStub( |
| 2079 ElementsKind kind, | 2063 ElementsKind kind, |
| 2080 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
| 2081 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2064 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2082 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2065 : ArrayConstructorStubBase(kind, override_mode) { |
| 2083 } | 2066 } |
| 2084 | 2067 |
| 2085 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2068 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 2086 | 2069 |
| 2087 virtual void InitializeInterfaceDescriptor( | 2070 virtual void InitializeInterfaceDescriptor( |
| 2088 Isolate* isolate, | 2071 Isolate* isolate, |
| 2089 CodeStubInterfaceDescriptor* descriptor); | 2072 CodeStubInterfaceDescriptor* descriptor); |
| 2090 | 2073 |
| 2091 private: | 2074 private: |
| 2092 Major MajorKey() { return ArrayNoArgumentConstructor; } | 2075 Major MajorKey() { return ArrayNoArgumentConstructor; } |
| 2093 | 2076 |
| 2094 virtual void PrintName(StringStream* stream) { | 2077 virtual void PrintName(StringStream* stream) { |
| 2095 BasePrintName("ArrayNoArgumentConstructorStub", stream); | 2078 BasePrintName("ArrayNoArgumentConstructorStub", stream); |
| 2096 } | 2079 } |
| 2097 | 2080 |
| 2098 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2081 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| 2099 }; | 2082 }; |
| 2100 | 2083 |
| 2101 | 2084 |
| 2102 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2085 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2103 public: | 2086 public: |
| 2104 ArraySingleArgumentConstructorStub( | 2087 ArraySingleArgumentConstructorStub( |
| 2105 ElementsKind kind, | 2088 ElementsKind kind, |
| 2106 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
| 2107 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2089 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2108 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2090 : ArrayConstructorStubBase(kind, override_mode) { |
| 2109 } | 2091 } |
| 2110 | 2092 |
| 2111 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2093 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 2112 | 2094 |
| 2113 virtual void InitializeInterfaceDescriptor( | 2095 virtual void InitializeInterfaceDescriptor( |
| 2114 Isolate* isolate, | 2096 Isolate* isolate, |
| 2115 CodeStubInterfaceDescriptor* descriptor); | 2097 CodeStubInterfaceDescriptor* descriptor); |
| 2116 | 2098 |
| 2117 private: | 2099 private: |
| 2118 Major MajorKey() { return ArraySingleArgumentConstructor; } | 2100 Major MajorKey() { return ArraySingleArgumentConstructor; } |
| 2119 | 2101 |
| 2120 virtual void PrintName(StringStream* stream) { | 2102 virtual void PrintName(StringStream* stream) { |
| 2121 BasePrintName("ArraySingleArgumentConstructorStub", stream); | 2103 BasePrintName("ArraySingleArgumentConstructorStub", stream); |
| 2122 } | 2104 } |
| 2123 | 2105 |
| 2124 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2106 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| 2125 }; | 2107 }; |
| 2126 | 2108 |
| 2127 | 2109 |
| 2128 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2110 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 2129 public: | 2111 public: |
| 2130 ArrayNArgumentsConstructorStub( | 2112 ArrayNArgumentsConstructorStub( |
| 2131 ElementsKind kind, | 2113 ElementsKind kind, |
| 2132 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, | |
| 2133 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2114 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2134 : ArrayConstructorStubBase(kind, context_mode, override_mode) { | 2115 : ArrayConstructorStubBase(kind, override_mode) { |
| 2135 } | 2116 } |
| 2136 | 2117 |
| 2137 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2118 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 2138 | 2119 |
| 2139 virtual void InitializeInterfaceDescriptor( | 2120 virtual void InitializeInterfaceDescriptor( |
| 2140 Isolate* isolate, | 2121 Isolate* isolate, |
| 2141 CodeStubInterfaceDescriptor* descriptor); | 2122 CodeStubInterfaceDescriptor* descriptor); |
| 2142 | 2123 |
| 2143 private: | 2124 private: |
| 2144 Major MajorKey() { return ArrayNArgumentsConstructor; } | 2125 Major MajorKey() { return ArrayNArgumentsConstructor; } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 int MinorKey() { return 0; } | 2460 int MinorKey() { return 0; } |
| 2480 | 2461 |
| 2481 void Generate(MacroAssembler* masm); | 2462 void Generate(MacroAssembler* masm); |
| 2482 | 2463 |
| 2483 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2464 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2484 }; | 2465 }; |
| 2485 | 2466 |
| 2486 } } // namespace v8::internal | 2467 } } // namespace v8::internal |
| 2487 | 2468 |
| 2488 #endif // V8_CODE_STUBS_H_ | 2469 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |