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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } \ | 424 } \ |
425 DEFINE_CODE_STUB(NAME, SUPER) | 425 DEFINE_CODE_STUB(NAME, SUPER) |
426 | 426 |
427 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 427 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
428 public: \ | 428 public: \ |
429 Handle<Code> GenerateCode() override; \ | 429 Handle<Code> GenerateCode() override; \ |
430 DEFINE_CODE_STUB(NAME, SUPER) | 430 DEFINE_CODE_STUB(NAME, SUPER) |
431 | 431 |
432 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 432 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
433 public: \ | 433 public: \ |
| 434 typedef NAME##Descriptor Descriptor; \ |
434 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 435 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
435 return NAME##Descriptor(isolate()); \ | 436 return Descriptor(isolate()); \ |
436 } | 437 } |
437 | 438 |
438 #define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \ | 439 #define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \ |
439 public: \ | 440 public: \ |
440 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 441 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
441 return OnStackArgsDescriptorBase::ForArgs(isolate(), PARAMETER_COUNT); \ | 442 return OnStackArgsDescriptorBase::ForArgs(isolate(), PARAMETER_COUNT); \ |
442 } | 443 } |
443 | 444 |
444 // There are some code stubs we just can't describe right now with a | 445 // There are some code stubs we just can't describe right now with a |
445 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. | 446 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 }; | 1017 }; |
1017 | 1018 |
1018 | 1019 |
1019 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); | 1020 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags); |
1020 | 1021 |
1021 | 1022 |
1022 class NumberToStringStub final : public HydrogenCodeStub { | 1023 class NumberToStringStub final : public HydrogenCodeStub { |
1023 public: | 1024 public: |
1024 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1025 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1025 | 1026 |
1026 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1027 static const int kNumber = 0; | |
1028 | |
1029 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); | 1027 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); |
1030 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); | 1028 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); |
1031 }; | 1029 }; |
1032 | 1030 |
1033 | 1031 |
1034 class TypeofStub final : public HydrogenCodeStub { | 1032 class TypeofStub final : public HydrogenCodeStub { |
1035 public: | 1033 public: |
1036 explicit TypeofStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1034 explicit TypeofStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1037 | 1035 |
1038 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1039 static const int kObject = 0; | |
1040 | |
1041 static void GenerateAheadOfTime(Isolate* isolate); | 1036 static void GenerateAheadOfTime(Isolate* isolate); |
1042 | 1037 |
1043 DEFINE_CALL_INTERFACE_DESCRIPTOR(Typeof); | 1038 DEFINE_CALL_INTERFACE_DESCRIPTOR(Typeof); |
1044 DEFINE_HYDROGEN_CODE_STUB(Typeof, HydrogenCodeStub); | 1039 DEFINE_HYDROGEN_CODE_STUB(Typeof, HydrogenCodeStub); |
1045 }; | 1040 }; |
1046 | 1041 |
1047 class FastNewClosureStub : public TurboFanCodeStub { | 1042 class FastNewClosureStub : public TurboFanCodeStub { |
1048 public: | 1043 public: |
1049 explicit FastNewClosureStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 1044 explicit FastNewClosureStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
1050 | 1045 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); | 1436 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); |
1442 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 1437 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
1443 } | 1438 } |
1444 | 1439 |
1445 protected: | 1440 protected: |
1446 Code::Kind kind() const override { return Code::LOAD_IC; } | 1441 Code::Kind kind() const override { return Code::LOAD_IC; } |
1447 | 1442 |
1448 private: | 1443 private: |
1449 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 1444 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
1450 | 1445 |
| 1446 // TODO(ishell): The stub uses only kReceiver parameter. |
| 1447 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
1451 DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub); | 1448 DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub); |
1452 }; | 1449 }; |
1453 | 1450 |
1454 | 1451 |
1455 class KeyedLoadSloppyArgumentsStub : public HandlerStub { | 1452 class KeyedLoadSloppyArgumentsStub : public HandlerStub { |
1456 public: | 1453 public: |
1457 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) | 1454 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) |
1458 : HandlerStub(isolate) {} | 1455 : HandlerStub(isolate) {} |
1459 | 1456 |
1460 protected: | 1457 protected: |
1461 Code::Kind kind() const override { return Code::KEYED_LOAD_IC; } | 1458 Code::Kind kind() const override { return Code::KEYED_LOAD_IC; } |
1462 | 1459 |
1463 private: | 1460 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
1464 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); | 1461 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); |
1465 }; | 1462 }; |
1466 | 1463 |
1467 | 1464 |
1468 class CommonStoreModeBits : public BitField<KeyedAccessStoreMode, 0, 3> {}; | 1465 class CommonStoreModeBits : public BitField<KeyedAccessStoreMode, 0, 3> {}; |
1469 | 1466 |
1470 class KeyedStoreSloppyArgumentsStub : public HandlerStub { | 1467 class KeyedStoreSloppyArgumentsStub : public HandlerStub { |
1471 public: | 1468 public: |
1472 explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate, | 1469 explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate, |
1473 KeyedAccessStoreMode mode) | 1470 KeyedAccessStoreMode mode) |
1474 : HandlerStub(isolate) { | 1471 : HandlerStub(isolate) { |
1475 set_sub_minor_key(CommonStoreModeBits::encode(mode)); | 1472 set_sub_minor_key(CommonStoreModeBits::encode(mode)); |
1476 } | 1473 } |
1477 | 1474 |
1478 protected: | 1475 protected: |
1479 Code::Kind kind() const override { return Code::KEYED_STORE_IC; } | 1476 Code::Kind kind() const override { return Code::KEYED_STORE_IC; } |
1480 | 1477 |
1481 private: | 1478 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
1482 DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub); | 1479 DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub); |
1483 }; | 1480 }; |
1484 | 1481 |
1485 | 1482 |
1486 class LoadConstantStub : public HandlerStub { | 1483 class LoadConstantStub : public HandlerStub { |
1487 public: | 1484 public: |
1488 LoadConstantStub(Isolate* isolate, int constant_index) | 1485 LoadConstantStub(Isolate* isolate, int constant_index) |
1489 : HandlerStub(isolate) { | 1486 : HandlerStub(isolate) { |
1490 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); | 1487 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); |
1491 } | 1488 } |
1492 | 1489 |
1493 int constant_index() const { | 1490 int constant_index() const { |
1494 return ConstantIndexBits::decode(sub_minor_key()); | 1491 return ConstantIndexBits::decode(sub_minor_key()); |
1495 } | 1492 } |
1496 | 1493 |
1497 protected: | 1494 protected: |
1498 Code::Kind kind() const override { return Code::LOAD_IC; } | 1495 Code::Kind kind() const override { return Code::LOAD_IC; } |
1499 | 1496 |
1500 private: | 1497 private: |
1501 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; | 1498 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
1502 | 1499 |
| 1500 // TODO(ishell): The stub uses only kReceiver parameter. |
| 1501 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
1503 DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub); | 1502 DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub); |
1504 }; | 1503 }; |
1505 | 1504 |
1506 class LoadApiGetterStub : public TurboFanCodeStub { | 1505 class LoadApiGetterStub : public TurboFanCodeStub { |
1507 public: | 1506 public: |
1508 LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index) | 1507 LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index) |
1509 : TurboFanCodeStub(isolate) { | 1508 : TurboFanCodeStub(isolate) { |
1510 // If that's not true, we need to ensure that the receiver is actually a | 1509 // If that's not true, we need to ensure that the receiver is actually a |
1511 // JSReceiver. http://crbug.com/609134 | 1510 // JSReceiver. http://crbug.com/609134 |
1512 DCHECK(receiver_is_holder); | 1511 DCHECK(receiver_is_holder); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 return PropertyDetails::DecodeRepresentation(repr); | 1550 return PropertyDetails::DecodeRepresentation(repr); |
1552 } | 1551 } |
1553 | 1552 |
1554 protected: | 1553 protected: |
1555 Code::Kind kind() const override { return Code::STORE_IC; } | 1554 Code::Kind kind() const override { return Code::STORE_IC; } |
1556 | 1555 |
1557 private: | 1556 private: |
1558 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1557 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1559 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1558 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
1560 | 1559 |
| 1560 // TODO(ishell): The stub uses only kReceiver and kValue parameters. |
| 1561 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
1561 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 1562 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); |
1562 }; | 1563 }; |
1563 | 1564 |
1564 | 1565 |
1565 // Register and parameter access methods are specified here instead of in | 1566 // Register and parameter access methods are specified here instead of in |
1566 // the CallInterfaceDescriptor because the stub uses a different descriptor | 1567 // the CallInterfaceDescriptor because the stub uses a different descriptor |
1567 // if FLAG_vector_stores is on. | 1568 // if FLAG_vector_stores is on. |
1568 class StoreTransitionHelper { | 1569 class StoreTransitionHelper { |
1569 public: | 1570 public: |
1570 static Register ReceiverRegister() { | 1571 static Register ReceiverRegister() { |
(...skipping 13 matching lines...) Expand all Loading... |
1584 } | 1585 } |
1585 | 1586 |
1586 static Register VectorRegister() { | 1587 static Register VectorRegister() { |
1587 return VectorStoreTransitionDescriptor::VectorRegister(); | 1588 return VectorStoreTransitionDescriptor::VectorRegister(); |
1588 } | 1589 } |
1589 | 1590 |
1590 static Register MapRegister() { | 1591 static Register MapRegister() { |
1591 return VectorStoreTransitionDescriptor::MapRegister(); | 1592 return VectorStoreTransitionDescriptor::MapRegister(); |
1592 } | 1593 } |
1593 | 1594 |
1594 static int ReceiverIndex() { | 1595 static int ReceiverIndex() { return StoreTransitionDescriptor::kReceiver; } |
1595 return StoreTransitionDescriptor::kReceiverIndex; | |
1596 } | |
1597 | 1596 |
1598 static int NameIndex() { return StoreTransitionDescriptor::kReceiverIndex; } | 1597 static int NameIndex() { return StoreTransitionDescriptor::kReceiver; } |
1599 | 1598 |
1600 static int ValueIndex() { return StoreTransitionDescriptor::kValueIndex; } | 1599 static int ValueIndex() { return StoreTransitionDescriptor::kValue; } |
1601 | 1600 |
1602 static int MapIndex() { | 1601 static int MapIndex() { |
1603 DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMapIndex) == | 1602 DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMap) == |
1604 static_cast<int>(StoreTransitionDescriptor::kMapIndex)); | 1603 static_cast<int>(StoreTransitionDescriptor::kMap)); |
1605 return StoreTransitionDescriptor::kMapIndex; | 1604 return StoreTransitionDescriptor::kMap; |
1606 } | 1605 } |
1607 | 1606 |
1608 static int VectorIndex() { | 1607 static int VectorIndex() { |
1609 if (HasVirtualSlotArg()) { | 1608 if (HasVirtualSlotArg()) { |
1610 return VectorStoreTransitionDescriptor::kVirtualSlotVectorIndex; | 1609 return VectorStoreTransitionDescriptor::kVirtualSlotVector; |
1611 } | 1610 } |
1612 return VectorStoreTransitionDescriptor::kVectorIndex; | 1611 return VectorStoreTransitionDescriptor::kVector; |
1613 } | 1612 } |
1614 | 1613 |
1615 // Some platforms don't have a slot arg. | 1614 // Some platforms don't have a slot arg. |
1616 static bool HasVirtualSlotArg() { | 1615 static bool HasVirtualSlotArg() { |
1617 return SlotRegister().is(no_reg); | 1616 return SlotRegister().is(no_reg); |
1618 } | 1617 } |
1619 }; | 1618 }; |
1620 | 1619 |
1621 | 1620 |
1622 class StoreTransitionStub : public HandlerStub { | 1621 class StoreTransitionStub : public HandlerStub { |
(...skipping 28 matching lines...) Expand all Loading... |
1651 Representation representation() { | 1650 Representation representation() { |
1652 DCHECK(store_mode() != StoreMapOnly); | 1651 DCHECK(store_mode() != StoreMapOnly); |
1653 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 1652 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
1654 return PropertyDetails::DecodeRepresentation(repr); | 1653 return PropertyDetails::DecodeRepresentation(repr); |
1655 } | 1654 } |
1656 | 1655 |
1657 StoreMode store_mode() const { | 1656 StoreMode store_mode() const { |
1658 return StoreModeBits::decode(sub_minor_key()); | 1657 return StoreModeBits::decode(sub_minor_key()); |
1659 } | 1658 } |
1660 | 1659 |
1661 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; | |
1662 | |
1663 protected: | 1660 protected: |
1664 Code::Kind kind() const override { return Code::STORE_IC; } | 1661 Code::Kind kind() const override { return Code::STORE_IC; } |
| 1662 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; |
1665 | 1663 |
1666 private: | 1664 private: |
1667 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1665 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1668 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1666 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
1669 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; | 1667 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; |
1670 | 1668 |
| 1669 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition); |
1671 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); | 1670 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); |
1672 }; | 1671 }; |
1673 | 1672 |
1674 | 1673 |
1675 class StoreGlobalStub : public HandlerStub { | 1674 class StoreGlobalStub : public HandlerStub { |
1676 public: | 1675 public: |
1677 StoreGlobalStub(Isolate* isolate, PropertyCellType type, | 1676 StoreGlobalStub(Isolate* isolate, PropertyCellType type, |
1678 Maybe<PropertyCellConstantType> constant_type, | 1677 Maybe<PropertyCellConstantType> constant_type, |
1679 bool check_global) | 1678 bool check_global) |
1680 : HandlerStub(isolate) { | 1679 : HandlerStub(isolate) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 void set_representation(Representation r) { | 1725 void set_representation(Representation r) { |
1727 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); | 1726 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); |
1728 } | 1727 } |
1729 | 1728 |
1730 private: | 1729 private: |
1731 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; | 1730 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; |
1732 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; | 1731 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; |
1733 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; | 1732 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; |
1734 class CheckGlobalBits : public BitField<bool, 12, 1> {}; | 1733 class CheckGlobalBits : public BitField<bool, 12, 1> {}; |
1735 | 1734 |
| 1735 // TODO(ishell): The stub uses only kValue parameter. |
| 1736 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
1736 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1737 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); |
1737 }; | 1738 }; |
1738 | 1739 |
1739 | 1740 // TODO(ishell): remove, once StoreGlobalIC is implemented. |
1740 class StoreGlobalViaContextStub final : public PlatformCodeStub { | 1741 class StoreGlobalViaContextStub final : public PlatformCodeStub { |
1741 public: | 1742 public: |
1742 static const int kMaximumDepth = 15; | 1743 static const int kMaximumDepth = 15; |
1743 | 1744 |
1744 StoreGlobalViaContextStub(Isolate* isolate, int depth, | 1745 StoreGlobalViaContextStub(Isolate* isolate, int depth, |
1745 LanguageMode language_mode) | 1746 LanguageMode language_mode) |
1746 : PlatformCodeStub(isolate) { | 1747 : PlatformCodeStub(isolate) { |
1747 minor_key_ = | 1748 minor_key_ = |
1748 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode); | 1749 DepthBits::encode(depth) | LanguageModeBits::encode(language_mode); |
1749 } | 1750 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 ExtraICState GetExtraICState() const final { | 1841 ExtraICState GetExtraICState() const final { |
1841 return static_cast<ExtraICState>(sub_minor_key()); | 1842 return static_cast<ExtraICState>(sub_minor_key()); |
1842 } | 1843 } |
1843 | 1844 |
1844 BinaryOpICState state() const { | 1845 BinaryOpICState state() const { |
1845 return BinaryOpICState(isolate(), GetExtraICState()); | 1846 return BinaryOpICState(isolate(), GetExtraICState()); |
1846 } | 1847 } |
1847 | 1848 |
1848 void PrintState(std::ostream& os) const final; // NOLINT | 1849 void PrintState(std::ostream& os) const final; // NOLINT |
1849 | 1850 |
1850 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1851 static const int kLeft = 0; | |
1852 static const int kRight = 1; | |
1853 | |
1854 private: | 1851 private: |
1855 static void GenerateAheadOfTime(Isolate* isolate, | 1852 static void GenerateAheadOfTime(Isolate* isolate, |
1856 const BinaryOpICState& state); | 1853 const BinaryOpICState& state); |
1857 | 1854 |
1858 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1855 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
1859 DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub); | 1856 DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub); |
1860 }; | 1857 }; |
1861 | 1858 |
1862 | 1859 |
1863 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1860 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { | 1899 class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { |
1903 public: | 1900 public: |
1904 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op) | 1901 BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op) |
1905 : BinaryOpICStub(isolate, op) {} | 1902 : BinaryOpICStub(isolate, op) {} |
1906 | 1903 |
1907 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) | 1904 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) |
1908 : BinaryOpICStub(isolate, state) {} | 1905 : BinaryOpICStub(isolate, state) {} |
1909 | 1906 |
1910 Code::Kind GetCodeKind() const final { return Code::STUB; } | 1907 Code::Kind GetCodeKind() const final { return Code::STUB; } |
1911 | 1908 |
1912 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1913 static const int kAllocationSite = 0; | |
1914 static const int kLeft = 1; | |
1915 static const int kRight = 2; | |
1916 | |
1917 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1909 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
1918 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); | 1910 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); |
1919 }; | 1911 }; |
1920 | 1912 |
1921 | 1913 |
1922 class StringAddStub final : public HydrogenCodeStub { | 1914 class StringAddStub final : public HydrogenCodeStub { |
1923 public: | 1915 public: |
1924 StringAddStub(Isolate* isolate, StringAddFlags flags, | 1916 StringAddStub(Isolate* isolate, StringAddFlags flags, |
1925 PretenureFlag pretenure_flag) | 1917 PretenureFlag pretenure_flag) |
1926 : HydrogenCodeStub(isolate) { | 1918 : HydrogenCodeStub(isolate) { |
1927 set_sub_minor_key(StringAddFlagsBits::encode(flags) | | 1919 set_sub_minor_key(StringAddFlagsBits::encode(flags) | |
1928 PretenureFlagBits::encode(pretenure_flag)); | 1920 PretenureFlagBits::encode(pretenure_flag)); |
1929 } | 1921 } |
1930 | 1922 |
1931 StringAddFlags flags() const { | 1923 StringAddFlags flags() const { |
1932 return StringAddFlagsBits::decode(sub_minor_key()); | 1924 return StringAddFlagsBits::decode(sub_minor_key()); |
1933 } | 1925 } |
1934 | 1926 |
1935 PretenureFlag pretenure_flag() const { | 1927 PretenureFlag pretenure_flag() const { |
1936 return PretenureFlagBits::decode(sub_minor_key()); | 1928 return PretenureFlagBits::decode(sub_minor_key()); |
1937 } | 1929 } |
1938 | 1930 |
1939 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1940 static const int kLeft = 0; | |
1941 static const int kRight = 1; | |
1942 | |
1943 private: | 1931 private: |
1944 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; | 1932 class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; |
1945 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; | 1933 class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; |
1946 | 1934 |
1947 void PrintBaseName(std::ostream& os) const override; // NOLINT | 1935 void PrintBaseName(std::ostream& os) const override; // NOLINT |
1948 | 1936 |
1949 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1937 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1950 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1938 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1951 }; | 1939 }; |
1952 | 1940 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4); | 2084 DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4); |
2097 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); | 2085 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); |
2098 }; | 2086 }; |
2099 | 2087 |
2100 | 2088 |
2101 class RegExpConstructResultStub final : public HydrogenCodeStub { | 2089 class RegExpConstructResultStub final : public HydrogenCodeStub { |
2102 public: | 2090 public: |
2103 explicit RegExpConstructResultStub(Isolate* isolate) | 2091 explicit RegExpConstructResultStub(Isolate* isolate) |
2104 : HydrogenCodeStub(isolate) { } | 2092 : HydrogenCodeStub(isolate) { } |
2105 | 2093 |
2106 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
2107 static const int kLength = 0; | |
2108 static const int kIndex = 1; | |
2109 static const int kInput = 2; | |
2110 | |
2111 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); | 2094 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); |
2112 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); | 2095 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); |
2113 }; | 2096 }; |
2114 | 2097 |
2115 | 2098 |
2116 // TODO(bmeurer/mvstanton): Turn CallConstructStub into ConstructICStub. | 2099 // TODO(bmeurer/mvstanton): Turn CallConstructStub into ConstructICStub. |
2117 class CallConstructStub final : public PlatformCodeStub { | 2100 class CallConstructStub final : public PlatformCodeStub { |
2118 public: | 2101 public: |
2119 explicit CallConstructStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2102 explicit CallConstructStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2120 | 2103 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 2285 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
2303 }; | 2286 }; |
2304 | 2287 |
2305 | 2288 |
2306 class KeyedLoadGenericStub : public HydrogenCodeStub { | 2289 class KeyedLoadGenericStub : public HydrogenCodeStub { |
2307 public: | 2290 public: |
2308 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 2291 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
2309 | 2292 |
2310 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } | 2293 Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } |
2311 | 2294 |
2312 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 2295 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2313 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 2296 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
2314 }; | 2297 }; |
2315 | 2298 |
2316 | 2299 |
2317 class LoadICTrampolineStub : public PlatformCodeStub { | 2300 class LoadICTrampolineStub : public PlatformCodeStub { |
2318 public: | 2301 public: |
2319 explicit LoadICTrampolineStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2302 explicit LoadICTrampolineStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2320 | 2303 |
2321 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } | 2304 Code::Kind GetCodeKind() const override { return Code::LOAD_IC; } |
2322 | 2305 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 | 2595 |
2613 class LoadScriptContextFieldStub : public ScriptContextFieldStub { | 2596 class LoadScriptContextFieldStub : public ScriptContextFieldStub { |
2614 public: | 2597 public: |
2615 LoadScriptContextFieldStub( | 2598 LoadScriptContextFieldStub( |
2616 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) | 2599 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
2617 : ScriptContextFieldStub(isolate, lookup_result) {} | 2600 : ScriptContextFieldStub(isolate, lookup_result) {} |
2618 | 2601 |
2619 private: | 2602 private: |
2620 Code::Kind kind() const override { return Code::LOAD_IC; } | 2603 Code::Kind kind() const override { return Code::LOAD_IC; } |
2621 | 2604 |
| 2605 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2622 DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); | 2606 DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); |
2623 }; | 2607 }; |
2624 | 2608 |
2625 | 2609 |
2626 class StoreScriptContextFieldStub : public ScriptContextFieldStub { | 2610 class StoreScriptContextFieldStub : public ScriptContextFieldStub { |
2627 public: | 2611 public: |
2628 StoreScriptContextFieldStub( | 2612 StoreScriptContextFieldStub( |
2629 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) | 2613 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
2630 : ScriptContextFieldStub(isolate, lookup_result) {} | 2614 : ScriptContextFieldStub(isolate, lookup_result) {} |
2631 | 2615 |
2632 private: | 2616 private: |
2633 Code::Kind kind() const override { return Code::STORE_IC; } | 2617 Code::Kind kind() const override { return Code::STORE_IC; } |
2634 | 2618 |
| 2619 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
2635 DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); | 2620 DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); |
2636 }; | 2621 }; |
2637 | 2622 |
2638 | 2623 |
2639 class LoadFastElementStub : public HandlerStub { | 2624 class LoadFastElementStub : public HandlerStub { |
2640 public: | 2625 public: |
2641 LoadFastElementStub(Isolate* isolate, bool is_js_array, | 2626 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
2642 ElementsKind elements_kind, | 2627 ElementsKind elements_kind, |
2643 bool convert_hole_to_undefined = false) | 2628 bool convert_hole_to_undefined = false) |
2644 : HandlerStub(isolate) { | 2629 : HandlerStub(isolate) { |
(...skipping 12 matching lines...) Expand all Loading... |
2657 | 2642 |
2658 ElementsKind elements_kind() const { | 2643 ElementsKind elements_kind() const { |
2659 return ElementsKindBits::decode(sub_minor_key()); | 2644 return ElementsKindBits::decode(sub_minor_key()); |
2660 } | 2645 } |
2661 | 2646 |
2662 private: | 2647 private: |
2663 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2648 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2664 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2649 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2665 class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {}; | 2650 class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {}; |
2666 | 2651 |
| 2652 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
2667 DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub); | 2653 DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub); |
2668 }; | 2654 }; |
2669 | 2655 |
2670 | 2656 |
2671 class StoreFastElementStub : public HydrogenCodeStub { | 2657 class StoreFastElementStub : public HydrogenCodeStub { |
2672 public: | 2658 public: |
2673 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2659 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2674 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2660 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
2675 : HydrogenCodeStub(isolate) { | 2661 : HydrogenCodeStub(isolate) { |
2676 set_sub_minor_key(CommonStoreModeBits::encode(mode) | | 2662 set_sub_minor_key(CommonStoreModeBits::encode(mode) | |
2677 ElementsKindBits::encode(elements_kind) | | 2663 ElementsKindBits::encode(elements_kind) | |
2678 IsJSArrayBits::encode(is_js_array)); | 2664 IsJSArrayBits::encode(is_js_array)); |
2679 } | 2665 } |
2680 | 2666 |
2681 static void GenerateAheadOfTime(Isolate* isolate); | 2667 static void GenerateAheadOfTime(Isolate* isolate); |
2682 | 2668 |
2683 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2669 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2684 | 2670 |
2685 ElementsKind elements_kind() const { | 2671 ElementsKind elements_kind() const { |
2686 return ElementsKindBits::decode(sub_minor_key()); | 2672 return ElementsKindBits::decode(sub_minor_key()); |
2687 } | 2673 } |
2688 | 2674 |
2689 KeyedAccessStoreMode store_mode() const { | 2675 KeyedAccessStoreMode store_mode() const { |
2690 return CommonStoreModeBits::decode(sub_minor_key()); | 2676 return CommonStoreModeBits::decode(sub_minor_key()); |
2691 } | 2677 } |
2692 | 2678 |
2693 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | |
2694 return StoreWithVectorDescriptor(isolate()); | |
2695 } | |
2696 | |
2697 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 2679 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
2698 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } | 2680 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } |
2699 | 2681 |
2700 private: | 2682 private: |
2701 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; | 2683 class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; |
2702 class IsJSArrayBits : public BitField<bool, 11, 1> {}; | 2684 class IsJSArrayBits : public BitField<bool, 11, 1> {}; |
2703 | 2685 |
| 2686 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); |
2704 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); | 2687 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); |
2705 }; | 2688 }; |
2706 | 2689 |
2707 | 2690 |
2708 class TransitionElementsKindStub : public HydrogenCodeStub { | 2691 class TransitionElementsKindStub : public HydrogenCodeStub { |
2709 public: | 2692 public: |
2710 TransitionElementsKindStub(Isolate* isolate, ElementsKind from_kind, | 2693 TransitionElementsKindStub(Isolate* isolate, ElementsKind from_kind, |
2711 ElementsKind to_kind) | 2694 ElementsKind to_kind) |
2712 : HydrogenCodeStub(isolate) { | 2695 : HydrogenCodeStub(isolate) { |
2713 set_sub_minor_key(FromKindBits::encode(from_kind) | | 2696 set_sub_minor_key(FromKindBits::encode(from_kind) | |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2989 IsJSArrayBits::encode(is_jsarray)); | 2972 IsJSArrayBits::encode(is_jsarray)); |
2990 } | 2973 } |
2991 | 2974 |
2992 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } | 2975 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } |
2993 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } | 2976 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } |
2994 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2977 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2995 KeyedAccessStoreMode store_mode() const { | 2978 KeyedAccessStoreMode store_mode() const { |
2996 return CommonStoreModeBits::decode(sub_minor_key()); | 2979 return CommonStoreModeBits::decode(sub_minor_key()); |
2997 } | 2980 } |
2998 | 2981 |
2999 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override; | |
3000 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 2982 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
3001 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } | 2983 ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } |
3002 | 2984 |
3003 private: | 2985 private: |
3004 class FromBits : public BitField<ElementsKind, 3, 8> {}; | 2986 class FromBits : public BitField<ElementsKind, 3, 8> {}; |
3005 class ToBits : public BitField<ElementsKind, 11, 8> {}; | 2987 class ToBits : public BitField<ElementsKind, 11, 8> {}; |
3006 class IsJSArrayBits : public BitField<bool, 19, 1> {}; | 2988 class IsJSArrayBits : public BitField<bool, 19, 1> {}; |
3007 | 2989 |
| 2990 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition); |
3008 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); | 2991 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); |
3009 }; | 2992 }; |
3010 | 2993 |
3011 | 2994 |
3012 class StubFailureTrampolineStub : public PlatformCodeStub { | 2995 class StubFailureTrampolineStub : public PlatformCodeStub { |
3013 public: | 2996 public: |
3014 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2997 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
3015 : PlatformCodeStub(isolate) { | 2998 : PlatformCodeStub(isolate) { |
3016 minor_key_ = FunctionModeField::encode(function_mode); | 2999 minor_key_ = FunctionModeField::encode(function_mode); |
3017 } | 3000 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3111 #undef DEFINE_HYDROGEN_CODE_STUB | 3094 #undef DEFINE_HYDROGEN_CODE_STUB |
3112 #undef DEFINE_CODE_STUB | 3095 #undef DEFINE_CODE_STUB |
3113 #undef DEFINE_CODE_STUB_BASE | 3096 #undef DEFINE_CODE_STUB_BASE |
3114 | 3097 |
3115 extern Representation RepresentationFromType(Type* type); | 3098 extern Representation RepresentationFromType(Type* type); |
3116 | 3099 |
3117 } // namespace internal | 3100 } // namespace internal |
3118 } // namespace v8 | 3101 } // namespace v8 |
3119 | 3102 |
3120 #endif // V8_CODE_STUBS_H_ | 3103 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |