| 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(StoreGlobal) \ | |
| 95 V(StoreScriptContextField) \ | 94 V(StoreScriptContextField) \ |
| 96 V(StoreTransition) \ | 95 V(StoreTransition) \ |
| 97 /* These should never be ported to TF */ \ | 96 /* These should never be ported to TF */ \ |
| 98 /* because they are either used only by */ \ | 97 /* because they are either used only by */ \ |
| 99 /* FCG/Crankshaft or are deprecated */ \ | 98 /* FCG/Crankshaft or are deprecated */ \ |
| 100 V(BinaryOpIC) \ | 99 V(BinaryOpIC) \ |
| 101 V(BinaryOpWithAllocationSite) \ | 100 V(BinaryOpWithAllocationSite) \ |
| 102 V(ToBooleanIC) \ | 101 V(ToBooleanIC) \ |
| 103 V(RegExpConstructResult) \ | 102 V(RegExpConstructResult) \ |
| 104 V(TransitionElementsKind) \ | 103 V(TransitionElementsKind) \ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 V(StringGreaterThan) \ | 160 V(StringGreaterThan) \ |
| 162 V(StringGreaterThanOrEqual) \ | 161 V(StringGreaterThanOrEqual) \ |
| 163 V(ToInteger) \ | 162 V(ToInteger) \ |
| 164 V(ToLength) \ | 163 V(ToLength) \ |
| 165 V(HasProperty) \ | 164 V(HasProperty) \ |
| 166 V(ForInFilter) \ | 165 V(ForInFilter) \ |
| 167 V(GetProperty) \ | 166 V(GetProperty) \ |
| 168 V(LoadICTF) \ | 167 V(LoadICTF) \ |
| 169 V(KeyedLoadICTF) \ | 168 V(KeyedLoadICTF) \ |
| 170 V(StoreField) \ | 169 V(StoreField) \ |
| 170 V(StoreGlobal) \ |
| 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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 | 1767 |
| 1768 private: | 1768 private: |
| 1769 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1769 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1770 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1770 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1771 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; | 1771 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; |
| 1772 | 1772 |
| 1773 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition); | 1773 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition); |
| 1774 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); | 1774 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); |
| 1775 }; | 1775 }; |
| 1776 | 1776 |
| 1777 | 1777 class StoreGlobalStub : public TurboFanCodeStub { |
| 1778 class StoreGlobalStub : public HandlerStub { | |
| 1779 public: | 1778 public: |
| 1780 StoreGlobalStub(Isolate* isolate, PropertyCellType type, | 1779 StoreGlobalStub(Isolate* isolate, PropertyCellType type, |
| 1781 Maybe<PropertyCellConstantType> constant_type, | 1780 Maybe<PropertyCellConstantType> constant_type, |
| 1782 bool check_global) | 1781 bool check_global) |
| 1783 : HandlerStub(isolate) { | 1782 : TurboFanCodeStub(isolate) { |
| 1784 PropertyCellConstantType encoded_constant_type = | 1783 PropertyCellConstantType encoded_constant_type = |
| 1785 constant_type.FromMaybe(PropertyCellConstantType::kSmi); | 1784 constant_type.FromMaybe(PropertyCellConstantType::kSmi); |
| 1786 set_sub_minor_key(CellTypeBits::encode(type) | | 1785 minor_key_ = CellTypeBits::encode(type) | |
| 1787 ConstantTypeBits::encode(encoded_constant_type) | | 1786 ConstantTypeBits::encode(encoded_constant_type) | |
| 1788 CheckGlobalBits::encode(check_global)); | 1787 CheckGlobalBits::encode(check_global); |
| 1789 } | 1788 } |
| 1790 | 1789 |
| 1790 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 1791 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } |
| 1792 |
| 1791 static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) { | 1793 static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) { |
| 1792 return isolate->factory()->uninitialized_value(); | 1794 return isolate->factory()->uninitialized_value(); |
| 1793 } | 1795 } |
| 1794 | 1796 |
| 1795 static Handle<HeapObject> global_map_placeholder(Isolate* isolate) { | 1797 static Handle<HeapObject> global_map_placeholder(Isolate* isolate) { |
| 1796 return isolate->factory()->termination_exception(); | 1798 return isolate->factory()->termination_exception(); |
| 1797 } | 1799 } |
| 1798 | 1800 |
| 1799 Handle<Code> GetCodeCopyFromTemplate(Handle<JSGlobalObject> global, | 1801 Handle<Code> GetCodeCopyFromTemplate(Handle<JSGlobalObject> global, |
| 1800 Handle<PropertyCell> cell) { | 1802 Handle<PropertyCell> cell) { |
| 1801 Code::FindAndReplacePattern pattern; | 1803 Code::FindAndReplacePattern pattern; |
| 1802 if (check_global()) { | 1804 if (check_global()) { |
| 1803 pattern.Add(handle(global_map_placeholder(isolate())->map()), | 1805 pattern.Add(handle(global_map_placeholder(isolate())->map()), |
| 1804 Map::WeakCellForMap(Handle<Map>(global->map()))); | 1806 Map::WeakCellForMap(Handle<Map>(global->map()))); |
| 1805 } | 1807 } |
| 1806 pattern.Add(handle(property_cell_placeholder(isolate())->map()), | 1808 pattern.Add(handle(property_cell_placeholder(isolate())->map()), |
| 1807 isolate()->factory()->NewWeakCell(cell)); | 1809 isolate()->factory()->NewWeakCell(cell)); |
| 1808 return CodeStub::GetCodeCopy(pattern); | 1810 return CodeStub::GetCodeCopy(pattern); |
| 1809 } | 1811 } |
| 1810 | 1812 |
| 1811 Code::Kind kind() const override { return Code::STORE_IC; } | |
| 1812 | |
| 1813 PropertyCellType cell_type() const { | 1813 PropertyCellType cell_type() const { |
| 1814 return CellTypeBits::decode(sub_minor_key()); | 1814 return CellTypeBits::decode(minor_key_); |
| 1815 } | 1815 } |
| 1816 | 1816 |
| 1817 PropertyCellConstantType constant_type() const { | 1817 PropertyCellConstantType constant_type() const { |
| 1818 DCHECK(PropertyCellType::kConstantType == cell_type()); | 1818 DCHECK(PropertyCellType::kConstantType == cell_type()); |
| 1819 return ConstantTypeBits::decode(sub_minor_key()); | 1819 return ConstantTypeBits::decode(minor_key_); |
| 1820 } | 1820 } |
| 1821 | 1821 |
| 1822 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } | 1822 bool check_global() const { return CheckGlobalBits::decode(minor_key_); } |
| 1823 | |
| 1824 Representation representation() { | |
| 1825 return Representation::FromKind( | |
| 1826 RepresentationBits::decode(sub_minor_key())); | |
| 1827 } | |
| 1828 | |
| 1829 void set_representation(Representation r) { | |
| 1830 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); | |
| 1831 } | |
| 1832 | 1823 |
| 1833 private: | 1824 private: |
| 1834 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; | 1825 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; |
| 1835 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; | 1826 class ConstantTypeBits |
| 1836 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; | 1827 : public BitField<PropertyCellConstantType, CellTypeBits::kNext, 2> {}; |
| 1837 class CheckGlobalBits : public BitField<bool, 12, 1> {}; | 1828 class CheckGlobalBits : public BitField<bool, ConstantTypeBits::kNext, 1> {}; |
| 1838 | 1829 |
| 1839 // TODO(ishell): The stub uses only kValue parameter. | |
| 1840 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); | 1830 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
| 1841 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1831 DEFINE_TURBOFAN_CODE_STUB(StoreGlobal, TurboFanCodeStub); |
| 1842 }; | 1832 }; |
| 1843 | 1833 |
| 1844 // TODO(ishell): remove, once StoreGlobalIC is implemented. | 1834 // TODO(ishell): remove, once StoreGlobalIC is implemented. |
| 1845 class StoreGlobalViaContextStub final : public PlatformCodeStub { | 1835 class StoreGlobalViaContextStub final : public PlatformCodeStub { |
| 1846 public: | 1836 public: |
| 1847 static const int kMaximumDepth = 15; | 1837 static const int kMaximumDepth = 15; |
| 1848 | 1838 |
| 1849 StoreGlobalViaContextStub(Isolate* isolate, int depth, | 1839 StoreGlobalViaContextStub(Isolate* isolate, int depth, |
| 1850 LanguageMode language_mode) | 1840 LanguageMode language_mode) |
| 1851 : PlatformCodeStub(isolate) { | 1841 : PlatformCodeStub(isolate) { |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3226 #undef DEFINE_HYDROGEN_CODE_STUB | 3216 #undef DEFINE_HYDROGEN_CODE_STUB |
| 3227 #undef DEFINE_CODE_STUB | 3217 #undef DEFINE_CODE_STUB |
| 3228 #undef DEFINE_CODE_STUB_BASE | 3218 #undef DEFINE_CODE_STUB_BASE |
| 3229 | 3219 |
| 3230 extern Representation RepresentationFromMachineType(MachineType type); | 3220 extern Representation RepresentationFromMachineType(MachineType type); |
| 3231 | 3221 |
| 3232 } // namespace internal | 3222 } // namespace internal |
| 3233 } // namespace v8 | 3223 } // namespace v8 |
| 3234 | 3224 |
| 3235 #endif // V8_CODE_STUBS_H_ | 3225 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |