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/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 /* ishell before doing anything */ \ | 84 /* ishell before doing anything */ \ |
85 V(KeyedLoadGeneric) \ | 85 V(KeyedLoadGeneric) \ |
86 V(KeyedLoadSloppyArguments) \ | 86 V(KeyedLoadSloppyArguments) \ |
87 V(KeyedStoreSloppyArguments) \ | 87 V(KeyedStoreSloppyArguments) \ |
88 V(LoadConstant) \ | 88 V(LoadConstant) \ |
89 V(LoadDictionaryElement) \ | 89 V(LoadDictionaryElement) \ |
90 V(LoadFastElement) \ | 90 V(LoadFastElement) \ |
91 V(LoadField) \ | 91 V(LoadField) \ |
92 V(LoadScriptContextField) \ | 92 V(LoadScriptContextField) \ |
93 V(StoreFastElement) \ | 93 V(StoreFastElement) \ |
94 V(StoreField) \ | |
95 V(StoreGlobal) \ | 94 V(StoreGlobal) \ |
96 V(StoreScriptContextField) \ | 95 V(StoreScriptContextField) \ |
97 V(StoreTransition) \ | 96 V(StoreTransition) \ |
98 /* These should never be ported to TF */ \ | 97 /* These should never be ported to TF */ \ |
99 /* because they are either used only by */ \ | 98 /* because they are either used only by */ \ |
100 /* FCG/Crankshaft or are deprecated */ \ | 99 /* FCG/Crankshaft or are deprecated */ \ |
101 V(BinaryOpIC) \ | 100 V(BinaryOpIC) \ |
102 V(BinaryOpWithAllocationSite) \ | 101 V(BinaryOpWithAllocationSite) \ |
103 V(ToBooleanIC) \ | 102 V(ToBooleanIC) \ |
104 V(RegExpConstructResult) \ | 103 V(RegExpConstructResult) \ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 V(StringLessThanOrEqual) \ | 160 V(StringLessThanOrEqual) \ |
162 V(StringGreaterThan) \ | 161 V(StringGreaterThan) \ |
163 V(StringGreaterThanOrEqual) \ | 162 V(StringGreaterThanOrEqual) \ |
164 V(ToInteger) \ | 163 V(ToInteger) \ |
165 V(ToLength) \ | 164 V(ToLength) \ |
166 V(HasProperty) \ | 165 V(HasProperty) \ |
167 V(ForInFilter) \ | 166 V(ForInFilter) \ |
168 V(GetProperty) \ | 167 V(GetProperty) \ |
169 V(LoadICTF) \ | 168 V(LoadICTF) \ |
170 V(KeyedLoadICTF) \ | 169 V(KeyedLoadICTF) \ |
| 170 V(StoreField) \ |
171 V(StoreInterceptor) \ | 171 V(StoreInterceptor) \ |
172 V(LoadApiGetter) \ | 172 V(LoadApiGetter) \ |
173 V(LoadIndexedInterceptor) \ | 173 V(LoadIndexedInterceptor) \ |
174 V(GrowArrayElements) \ | 174 V(GrowArrayElements) \ |
175 /* These are only called from FGC and */ \ | 175 /* These are only called from FGC and */ \ |
176 /* can be removed when we use ignition */ \ | 176 /* can be removed when we use ignition */ \ |
177 /* only */ \ | 177 /* only */ \ |
178 V(LoadICTrampolineTF) \ | 178 V(LoadICTrampolineTF) \ |
179 V(LoadGlobalICTrampoline) \ | 179 V(LoadGlobalICTrampoline) \ |
180 V(KeyedLoadICTrampolineTF) | 180 V(KeyedLoadICTrampolineTF) |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 } | 1625 } |
1626 | 1626 |
1627 private: | 1627 private: |
1628 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; | 1628 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; |
1629 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; | 1629 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; |
1630 | 1630 |
1631 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1631 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
1632 DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub); | 1632 DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub); |
1633 }; | 1633 }; |
1634 | 1634 |
1635 class StoreFieldStub : public HandlerStub { | 1635 class StoreFieldStub : public TurboFanCodeStub { |
1636 public: | 1636 public: |
1637 StoreFieldStub(Isolate* isolate, FieldIndex index, | 1637 StoreFieldStub(Isolate* isolate, FieldIndex index, |
1638 Representation representation) | 1638 Representation representation) |
1639 : HandlerStub(isolate) { | 1639 : TurboFanCodeStub(isolate) { |
1640 int property_index_key = index.GetFieldAccessStubKey(); | 1640 int property_index_key = index.GetFieldAccessStubKey(); |
1641 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 1641 minor_key_ = StoreFieldByIndexBits::encode(property_index_key) | |
1642 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 1642 RepresentationBits::encode(representation.kind()); |
1643 RepresentationBits::encode(repr)); | |
1644 } | 1643 } |
1645 | 1644 |
| 1645 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 1646 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
| 1647 |
1646 FieldIndex index() const { | 1648 FieldIndex index() const { |
1647 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 1649 int property_index_key = StoreFieldByIndexBits::decode(minor_key_); |
1648 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 1650 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
1649 } | 1651 } |
1650 | 1652 |
1651 Representation representation() { | 1653 Representation representation() const { |
1652 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 1654 return Representation::FromKind(RepresentationBits::decode(minor_key_)); |
1653 return PropertyDetails::DecodeRepresentation(repr); | |
1654 } | 1655 } |
1655 | 1656 |
1656 protected: | |
1657 Code::Kind kind() const override { return Code::STORE_IC; } | |
1658 | |
1659 private: | 1657 private: |
1660 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1658 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1661 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1659 class RepresentationBits |
| 1660 : public BitField<Representation::Kind, StoreFieldByIndexBits::kNext, 4> { |
| 1661 }; |
| 1662 STATIC_ASSERT(Representation::kNumRepresentations - 1 < |
| 1663 RepresentationBits::kMax); |
1662 | 1664 |
1663 // TODO(ishell): The stub uses only kReceiver and kValue parameters. | |
1664 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 1665 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
1665 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 1666 DEFINE_TURBOFAN_CODE_STUB(StoreField, TurboFanCodeStub); |
1666 }; | 1667 }; |
1667 | 1668 |
1668 | 1669 |
1669 // Register and parameter access methods are specified here instead of in | 1670 // Register and parameter access methods are specified here instead of in |
1670 // the CallInterfaceDescriptor because the stub uses a different descriptor | 1671 // the CallInterfaceDescriptor because the stub uses a different descriptor |
1671 // if FLAG_vector_stores is on. | 1672 // if FLAG_vector_stores is on. |
1672 class StoreTransitionHelper { | 1673 class StoreTransitionHelper { |
1673 public: | 1674 public: |
1674 static Register ReceiverRegister() { | 1675 static Register ReceiverRegister() { |
1675 return StoreTransitionDescriptor::ReceiverRegister(); | 1676 return StoreTransitionDescriptor::ReceiverRegister(); |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 #undef DEFINE_HYDROGEN_CODE_STUB | 3226 #undef DEFINE_HYDROGEN_CODE_STUB |
3226 #undef DEFINE_CODE_STUB | 3227 #undef DEFINE_CODE_STUB |
3227 #undef DEFINE_CODE_STUB_BASE | 3228 #undef DEFINE_CODE_STUB_BASE |
3228 | 3229 |
3229 extern Representation RepresentationFromMachineType(MachineType type); | 3230 extern Representation RepresentationFromMachineType(MachineType type); |
3230 | 3231 |
3231 } // namespace internal | 3232 } // namespace internal |
3232 } // namespace v8 | 3233 } // namespace v8 |
3233 | 3234 |
3234 #endif // V8_CODE_STUBS_H_ | 3235 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |