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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 V(HasProperty) \ | 152 V(HasProperty) \ |
153 V(ForInFilter) \ | 153 V(ForInFilter) \ |
154 V(GetProperty) \ | 154 V(GetProperty) \ |
155 V(LoadICTF) \ | 155 V(LoadICTF) \ |
156 V(KeyedLoadICTF) \ | 156 V(KeyedLoadICTF) \ |
157 V(StoreFastElement) \ | 157 V(StoreFastElement) \ |
158 V(StoreField) \ | 158 V(StoreField) \ |
159 V(StoreGlobal) \ | 159 V(StoreGlobal) \ |
160 V(StoreICTF) \ | 160 V(StoreICTF) \ |
161 V(StoreInterceptor) \ | 161 V(StoreInterceptor) \ |
| 162 V(StoreMap) \ |
162 V(StoreTransition) \ | 163 V(StoreTransition) \ |
163 V(LoadApiGetter) \ | 164 V(LoadApiGetter) \ |
164 V(LoadIndexedInterceptor) \ | 165 V(LoadIndexedInterceptor) \ |
165 V(GrowArrayElements) \ | 166 V(GrowArrayElements) \ |
166 V(ToObject) \ | 167 V(ToObject) \ |
167 V(Typeof) \ | 168 V(Typeof) \ |
168 /* These are only called from FGC and */ \ | 169 /* These are only called from FGC and */ \ |
169 /* can be removed when we use ignition */ \ | 170 /* can be removed when we use ignition */ \ |
170 /* only */ \ | 171 /* only */ \ |
171 V(LoadICTrampolineTF) \ | 172 V(LoadICTrampolineTF) \ |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 class RepresentationBits | 1604 class RepresentationBits |
1604 : public BitField<Representation::Kind, StoreFieldByIndexBits::kNext, 4> { | 1605 : public BitField<Representation::Kind, StoreFieldByIndexBits::kNext, 4> { |
1605 }; | 1606 }; |
1606 STATIC_ASSERT(Representation::kNumRepresentations - 1 < | 1607 STATIC_ASSERT(Representation::kNumRepresentations - 1 < |
1607 RepresentationBits::kMax); | 1608 RepresentationBits::kMax); |
1608 | 1609 |
1609 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 1610 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
1610 DEFINE_TURBOFAN_CODE_STUB(StoreField, TurboFanCodeStub); | 1611 DEFINE_TURBOFAN_CODE_STUB(StoreField, TurboFanCodeStub); |
1611 }; | 1612 }; |
1612 | 1613 |
| 1614 class StoreMapStub : public TurboFanCodeStub { |
| 1615 public: |
| 1616 explicit StoreMapStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 1617 |
| 1618 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 1619 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
| 1620 |
| 1621 private: |
| 1622 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreTransition); |
| 1623 DEFINE_TURBOFAN_CODE_STUB(StoreMap, TurboFanCodeStub); |
| 1624 }; |
| 1625 |
1613 class StoreTransitionStub : public TurboFanCodeStub { | 1626 class StoreTransitionStub : public TurboFanCodeStub { |
1614 public: | 1627 public: |
1615 enum StoreMode { | 1628 enum StoreMode { |
1616 StoreMapOnly, | |
1617 StoreMapAndValue, | 1629 StoreMapAndValue, |
1618 ExtendStorageAndStoreMapAndValue | 1630 ExtendStorageAndStoreMapAndValue |
1619 }; | 1631 }; |
1620 | 1632 |
1621 explicit StoreTransitionStub(Isolate* isolate) : TurboFanCodeStub(isolate) { | 1633 StoreTransitionStub(Isolate* isolate, bool is_inobject, |
1622 minor_key_ = StoreModeBits::encode(StoreMapOnly); | |
1623 } | |
1624 | |
1625 StoreTransitionStub(Isolate* isolate, FieldIndex index, | |
1626 Representation representation, StoreMode store_mode) | 1634 Representation representation, StoreMode store_mode) |
1627 : TurboFanCodeStub(isolate) { | 1635 : TurboFanCodeStub(isolate) { |
1628 DCHECK(store_mode != StoreMapOnly); | 1636 minor_key_ = IsInobjectBits::encode(is_inobject) | |
1629 int property_index_key = index.GetFieldAccessStubKey(); | |
1630 minor_key_ = StoreFieldByIndexBits::encode(property_index_key) | | |
1631 RepresentationBits::encode(representation.kind()) | | 1637 RepresentationBits::encode(representation.kind()) | |
1632 StoreModeBits::encode(store_mode); | 1638 StoreModeBits::encode(store_mode); |
1633 } | 1639 } |
1634 | 1640 |
1635 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 1641 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
1636 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } | 1642 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
1637 | 1643 |
1638 FieldIndex index() const { | 1644 bool is_inobject() const { return IsInobjectBits::decode(minor_key_); } |
1639 DCHECK(store_mode() != StoreMapOnly); | |
1640 int property_index_key = StoreFieldByIndexBits::decode(minor_key_); | |
1641 return FieldIndex::FromFieldAccessStubKey(property_index_key); | |
1642 } | |
1643 | 1645 |
1644 Representation representation() const { | 1646 Representation representation() const { |
1645 DCHECK(store_mode() != StoreMapOnly); | |
1646 return Representation::FromKind(RepresentationBits::decode(minor_key_)); | 1647 return Representation::FromKind(RepresentationBits::decode(minor_key_)); |
1647 } | 1648 } |
1648 | 1649 |
1649 StoreMode store_mode() const { return StoreModeBits::decode(minor_key_); } | 1650 StoreMode store_mode() const { return StoreModeBits::decode(minor_key_); } |
1650 | 1651 |
1651 private: | 1652 private: |
1652 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1653 class IsInobjectBits : public BitField<bool, 0, 1> {}; |
1653 class RepresentationBits : public BitField<Representation::Kind, 13, 4> {}; | 1654 class RepresentationBits |
| 1655 : public BitField<Representation::Kind, IsInobjectBits::kNext, 4> {}; |
1654 STATIC_ASSERT(Representation::kNumRepresentations - 1 < | 1656 STATIC_ASSERT(Representation::kNumRepresentations - 1 < |
1655 RepresentationBits::kMax); | 1657 RepresentationBits::kMax); |
1656 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; | 1658 class StoreModeBits |
| 1659 : public BitField<StoreMode, RepresentationBits::kNext, 1> {}; |
1657 | 1660 |
1658 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreTransition); | 1661 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreNamedTransition); |
1659 DEFINE_TURBOFAN_CODE_STUB(StoreTransition, TurboFanCodeStub); | 1662 DEFINE_TURBOFAN_CODE_STUB(StoreTransition, TurboFanCodeStub); |
1660 }; | 1663 }; |
1661 | 1664 |
1662 class StoreGlobalStub : public TurboFanCodeStub { | 1665 class StoreGlobalStub : public TurboFanCodeStub { |
1663 public: | 1666 public: |
1664 StoreGlobalStub(Isolate* isolate, PropertyCellType type, | 1667 StoreGlobalStub(Isolate* isolate, PropertyCellType type, |
1665 Maybe<PropertyCellConstantType> constant_type, | 1668 Maybe<PropertyCellConstantType> constant_type, |
1666 bool check_global) | 1669 bool check_global) |
1667 : TurboFanCodeStub(isolate) { | 1670 : TurboFanCodeStub(isolate) { |
1668 PropertyCellConstantType encoded_constant_type = | 1671 PropertyCellConstantType encoded_constant_type = |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 #undef DEFINE_HYDROGEN_CODE_STUB | 3130 #undef DEFINE_HYDROGEN_CODE_STUB |
3128 #undef DEFINE_CODE_STUB | 3131 #undef DEFINE_CODE_STUB |
3129 #undef DEFINE_CODE_STUB_BASE | 3132 #undef DEFINE_CODE_STUB_BASE |
3130 | 3133 |
3131 extern Representation RepresentationFromMachineType(MachineType type); | 3134 extern Representation RepresentationFromMachineType(MachineType type); |
3132 | 3135 |
3133 } // namespace internal | 3136 } // namespace internal |
3134 } // namespace v8 | 3137 } // namespace v8 |
3135 | 3138 |
3136 #endif // V8_CODE_STUBS_H_ | 3139 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |