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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // - InternalizedString | 106 // - InternalizedString |
107 // - SeqInternalizedString | 107 // - SeqInternalizedString |
108 // - SeqOneByteInternalizedString | 108 // - SeqOneByteInternalizedString |
109 // - SeqTwoByteInternalizedString | 109 // - SeqTwoByteInternalizedString |
110 // - ConsInternalizedString | 110 // - ConsInternalizedString |
111 // - ExternalInternalizedString | 111 // - ExternalInternalizedString |
112 // - ExternalOneByteInternalizedString | 112 // - ExternalOneByteInternalizedString |
113 // - ExternalTwoByteInternalizedString | 113 // - ExternalTwoByteInternalizedString |
114 // - Symbol | 114 // - Symbol |
115 // - HeapNumber | 115 // - HeapNumber |
116 // - Float32x4 | 116 // - Simd128Value |
| 117 // - Float32x4 |
| 118 // - Int32x4 |
| 119 // - Bool32x4 |
| 120 // - Int16x8 |
| 121 // - Bool16x8 |
| 122 // - Int8x16 |
| 123 // - Bool8x16 |
117 // - Cell | 124 // - Cell |
118 // - PropertyCell | 125 // - PropertyCell |
119 // - Code | 126 // - Code |
120 // - Map | 127 // - Map |
121 // - Oddball | 128 // - Oddball |
122 // - Foreign | 129 // - Foreign |
123 // - SharedFunctionInfo | 130 // - SharedFunctionInfo |
124 // - Struct | 131 // - Struct |
125 // - Box | 132 // - Box |
126 // - AccessorInfo | 133 // - AccessorInfo |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 370 V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
364 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 371 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
365 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 372 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
366 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 373 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
367 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 374 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
368 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 375 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
369 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 376 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
370 \ | 377 \ |
371 V(SYMBOL_TYPE) \ | 378 V(SYMBOL_TYPE) \ |
372 V(FLOAT32X4_TYPE) \ | 379 V(FLOAT32X4_TYPE) \ |
| 380 V(INT32X4_TYPE) \ |
| 381 V(BOOL32X4_TYPE) \ |
| 382 V(INT16X8_TYPE) \ |
| 383 V(BOOL16X8_TYPE) \ |
| 384 V(INT8X16_TYPE) \ |
| 385 V(BOOL8X16_TYPE) \ |
373 \ | 386 \ |
374 V(MAP_TYPE) \ | 387 V(MAP_TYPE) \ |
375 V(CODE_TYPE) \ | 388 V(CODE_TYPE) \ |
376 V(ODDBALL_TYPE) \ | 389 V(ODDBALL_TYPE) \ |
377 V(CELL_TYPE) \ | 390 V(CELL_TYPE) \ |
378 V(PROPERTY_CELL_TYPE) \ | 391 V(PROPERTY_CELL_TYPE) \ |
379 \ | 392 \ |
380 V(HEAP_NUMBER_TYPE) \ | 393 V(HEAP_NUMBER_TYPE) \ |
381 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 394 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
382 V(FOREIGN_TYPE) \ | 395 V(FOREIGN_TYPE) \ |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 | 669 |
657 // Objects allocated in their own spaces (never in new space). | 670 // Objects allocated in their own spaces (never in new space). |
658 MAP_TYPE, | 671 MAP_TYPE, |
659 CODE_TYPE, | 672 CODE_TYPE, |
660 ODDBALL_TYPE, | 673 ODDBALL_TYPE, |
661 | 674 |
662 // "Data", objects that cannot contain non-map-word pointers to heap | 675 // "Data", objects that cannot contain non-map-word pointers to heap |
663 // objects. | 676 // objects. |
664 HEAP_NUMBER_TYPE, | 677 HEAP_NUMBER_TYPE, |
665 MUTABLE_HEAP_NUMBER_TYPE, | 678 MUTABLE_HEAP_NUMBER_TYPE, |
666 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE | 679 FLOAT32X4_TYPE, // FIRST_SIMD_VALUE_TYPE |
| 680 INT32X4_TYPE, |
| 681 BOOL32X4_TYPE, |
| 682 INT16X8_TYPE, |
| 683 BOOL16X8_TYPE, |
| 684 INT8X16_TYPE, |
| 685 BOOL8X16_TYPE, // LAST_SIMD_VALUE_TYPE |
667 FOREIGN_TYPE, | 686 FOREIGN_TYPE, |
668 BYTE_ARRAY_TYPE, | 687 BYTE_ARRAY_TYPE, |
669 BYTECODE_ARRAY_TYPE, | 688 BYTECODE_ARRAY_TYPE, |
670 FREE_SPACE_TYPE, | 689 FREE_SPACE_TYPE, |
671 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE | 690 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE |
672 FIXED_UINT8_ARRAY_TYPE, | 691 FIXED_UINT8_ARRAY_TYPE, |
673 FIXED_INT16_ARRAY_TYPE, | 692 FIXED_INT16_ARRAY_TYPE, |
674 FIXED_UINT16_ARRAY_TYPE, | 693 FIXED_UINT16_ARRAY_TYPE, |
675 FIXED_INT32_ARRAY_TYPE, | 694 FIXED_INT32_ARRAY_TYPE, |
676 FIXED_UINT32_ARRAY_TYPE, | 695 FIXED_UINT32_ARRAY_TYPE, |
677 FIXED_FLOAT32_ARRAY_TYPE, | 696 FIXED_FLOAT32_ARRAY_TYPE, |
678 FIXED_FLOAT64_ARRAY_TYPE, | 697 FIXED_FLOAT64_ARRAY_TYPE, |
679 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE | 698 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE |
680 FIXED_DOUBLE_ARRAY_TYPE, | 699 FIXED_DOUBLE_ARRAY_TYPE, |
681 FILLER_TYPE, // LAST_DATA_TYPE | 700 FILLER_TYPE, // LAST_DATA_TYPE |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 759 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
741 | 760 |
742 // Pseudo-types | 761 // Pseudo-types |
743 FIRST_TYPE = 0x0, | 762 FIRST_TYPE = 0x0, |
744 LAST_TYPE = JS_FUNCTION_TYPE, | 763 LAST_TYPE = JS_FUNCTION_TYPE, |
745 FIRST_NAME_TYPE = FIRST_TYPE, | 764 FIRST_NAME_TYPE = FIRST_TYPE, |
746 LAST_NAME_TYPE = SYMBOL_TYPE, | 765 LAST_NAME_TYPE = SYMBOL_TYPE, |
747 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, | 766 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
748 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, | 767 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
749 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, | 768 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
750 // Boundaries for testing for a SIMD type. | 769 // Boundaries for testing for a SIMD types. |
751 FIRST_SIMD_TYPE = FLOAT32X4_TYPE, | 770 FIRST_SIMD_VALUE_TYPE = FLOAT32X4_TYPE, |
752 LAST_SIMD_TYPE = FLOAT32X4_TYPE, | 771 LAST_SIMD_VALUE_TYPE = BOOL8X16_TYPE, |
753 // Boundaries for testing for a fixed typed array. | 772 // Boundaries for testing for a fixed typed array. |
754 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 773 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
755 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 774 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
756 // Boundary for promotion to old space. | 775 // Boundary for promotion to old space. |
757 LAST_DATA_TYPE = FILLER_TYPE, | 776 LAST_DATA_TYPE = FILLER_TYPE, |
758 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 777 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
759 // Note that there is no range for JSObject or JSProxy, since their subtypes | 778 // Note that there is no range for JSObject or JSProxy, since their subtypes |
760 // are not continuous in this enum! The enum ranges instead reflect the | 779 // are not continuous in this enum! The enum ranges instead reflect the |
761 // external class names, where proxies are treated as either ordinary objects, | 780 // external class names, where proxies are treated as either ordinary objects, |
762 // or functions. | 781 // or functions. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 | 894 |
876 | 895 |
877 #define OBJECT_TYPE_LIST(V) \ | 896 #define OBJECT_TYPE_LIST(V) \ |
878 V(Smi) \ | 897 V(Smi) \ |
879 V(HeapObject) \ | 898 V(HeapObject) \ |
880 V(Number) | 899 V(Number) |
881 | 900 |
882 #define HEAP_OBJECT_TYPE_LIST(V) \ | 901 #define HEAP_OBJECT_TYPE_LIST(V) \ |
883 V(HeapNumber) \ | 902 V(HeapNumber) \ |
884 V(MutableHeapNumber) \ | 903 V(MutableHeapNumber) \ |
| 904 V(Simd128Value) \ |
885 V(Float32x4) \ | 905 V(Float32x4) \ |
| 906 V(Int32x4) \ |
| 907 V(Bool32x4) \ |
| 908 V(Int16x8) \ |
| 909 V(Bool16x8) \ |
| 910 V(Int8x16) \ |
| 911 V(Bool8x16) \ |
886 V(Name) \ | 912 V(Name) \ |
887 V(UniqueName) \ | 913 V(UniqueName) \ |
888 V(String) \ | 914 V(String) \ |
889 V(SeqString) \ | 915 V(SeqString) \ |
890 V(ExternalString) \ | 916 V(ExternalString) \ |
891 V(ConsString) \ | 917 V(ConsString) \ |
892 V(SlicedString) \ | 918 V(SlicedString) \ |
893 V(ExternalTwoByteString) \ | 919 V(ExternalTwoByteString) \ |
894 V(ExternalOneByteString) \ | 920 V(ExternalOneByteString) \ |
895 V(SeqTwoByteString) \ | 921 V(SeqTwoByteString) \ |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 static const int kInfinityOrNanExponent = | 1597 static const int kInfinityOrNanExponent = |
1572 (kExponentMask >> kExponentShift) - kExponentBias; | 1598 (kExponentMask >> kExponentShift) - kExponentBias; |
1573 static const int kMantissaBitsInTopWord = 20; | 1599 static const int kMantissaBitsInTopWord = 20; |
1574 static const int kNonMantissaBitsInTopWord = 12; | 1600 static const int kNonMantissaBitsInTopWord = 12; |
1575 | 1601 |
1576 private: | 1602 private: |
1577 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1603 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
1578 }; | 1604 }; |
1579 | 1605 |
1580 | 1606 |
1581 // The Float32x4 class describes heap allocated SIMD values holding 4 32-bit | 1607 // The SimdValue128 class describes heap allocated 128 bit SIMD values. |
1582 // IEEE floats. | 1608 class Simd128Value : public HeapObject { |
1583 class Float32x4 : public HeapObject { | |
1584 public: | 1609 public: |
1585 inline float get_lane(int lane) const; | 1610 DECLARE_CAST(Simd128Value) |
1586 inline void set_lane(int lane, float value); | |
1587 | 1611 |
1588 DECLARE_CAST(Float32x4) | 1612 // Checks that another instance is bit-wise equal. |
1589 | 1613 bool BitwiseEquals(const Simd128Value* other) const; |
1590 // Dispatched behavior. | 1614 // Computes a hash from the 128 bit value, viewed as 4 32-bit integers. |
1591 void Float32x4Print(std::ostream& os); // NOLINT | 1615 uint32_t Hash() const; |
1592 DECLARE_VERIFIER(Float32x4) | |
1593 | 1616 |
1594 // Layout description. | 1617 // Layout description. |
1595 static const int kValueOffset = HeapObject::kHeaderSize; | 1618 static const int kValueOffset = HeapObject::kHeaderSize; |
1596 static const int kSize = kValueOffset + kSimd128Size; | 1619 static const int kSize = kValueOffset + kSimd128Size; |
1597 | 1620 |
1598 private: | 1621 private: |
1599 DISALLOW_IMPLICIT_CONSTRUCTORS(Float32x4); | 1622 DISALLOW_IMPLICIT_CONSTRUCTORS(Simd128Value); |
1600 }; | 1623 }; |
1601 | 1624 |
1602 | 1625 |
| 1626 #define SIMD128_TYPES(V) \ |
| 1627 V(Float32x4, float32x4, 4, float) \ |
| 1628 V(Int32x4, int32x4, 4, int32_t) \ |
| 1629 V(Bool32x4, bool32x4, 4, bool) \ |
| 1630 V(Int16x8, int16x8, 8, int16_t) \ |
| 1631 V(Bool16x8, bool16x8, 8, bool) \ |
| 1632 V(Int8x16, int8x16, 16, int8_t) \ |
| 1633 V(Bool8x16, bool8x16, 16, bool) |
| 1634 |
| 1635 #define SIMD128_VALUE_CLASS(name, type, lane_count, lane_type) \ |
| 1636 class name : public Simd128Value { \ |
| 1637 public: \ |
| 1638 inline lane_type get_lane(int lane) const; \ |
| 1639 inline void set_lane(int lane, lane_type value); \ |
| 1640 \ |
| 1641 DECLARE_CAST(name) \ |
| 1642 \ |
| 1643 DECLARE_PRINTER(name) \ |
| 1644 DECLARE_VERIFIER(name) \ |
| 1645 \ |
| 1646 private: \ |
| 1647 DISALLOW_IMPLICIT_CONSTRUCTORS(name); \ |
| 1648 }; |
| 1649 |
| 1650 SIMD128_TYPES(SIMD128_VALUE_CLASS) |
| 1651 |
| 1652 |
1603 enum EnsureElementsMode { | 1653 enum EnsureElementsMode { |
1604 DONT_ALLOW_DOUBLE_ELEMENTS, | 1654 DONT_ALLOW_DOUBLE_ELEMENTS, |
1605 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1655 ALLOW_COPIED_DOUBLE_ELEMENTS, |
1606 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1656 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
1607 }; | 1657 }; |
1608 | 1658 |
1609 | 1659 |
1610 // Indicator for one component of an AccessorPair. | 1660 // Indicator for one component of an AccessorPair. |
1611 enum AccessorComponent { | 1661 enum AccessorComponent { |
1612 ACCESSOR_GETTER, | 1662 ACCESSOR_GETTER, |
(...skipping 8928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10541 } else { | 10591 } else { |
10542 value &= ~(1 << bit_position); | 10592 value &= ~(1 << bit_position); |
10543 } | 10593 } |
10544 return value; | 10594 return value; |
10545 } | 10595 } |
10546 }; | 10596 }; |
10547 | 10597 |
10548 } } // namespace v8::internal | 10598 } } // namespace v8::internal |
10549 | 10599 |
10550 #endif // V8_OBJECTS_H_ | 10600 #endif // V8_OBJECTS_H_ |
OLD | NEW |