OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // - InternalizedString | 115 // - InternalizedString |
116 // - SeqInternalizedString | 116 // - SeqInternalizedString |
117 // - SeqOneByteInternalizedString | 117 // - SeqOneByteInternalizedString |
118 // - SeqTwoByteInternalizedString | 118 // - SeqTwoByteInternalizedString |
119 // - ConsInternalizedString | 119 // - ConsInternalizedString |
120 // - ExternalInternalizedString | 120 // - ExternalInternalizedString |
121 // - ExternalOneByteInternalizedString | 121 // - ExternalOneByteInternalizedString |
122 // - ExternalTwoByteInternalizedString | 122 // - ExternalTwoByteInternalizedString |
123 // - Symbol | 123 // - Symbol |
124 // - HeapNumber | 124 // - HeapNumber |
| 125 // - Simd128Value |
| 126 // - Float32x4 |
| 127 // - Int32x4 |
| 128 // - Uint32x4 |
| 129 // - Bool32x4 |
| 130 // - Int16x8 |
| 131 // - Uint16x8 |
| 132 // - Bool16x8 |
| 133 // - Int8x16 |
| 134 // - Uint8x16 |
| 135 // - Bool8x16 |
125 // - Cell | 136 // - Cell |
126 // - PropertyCell | 137 // - PropertyCell |
127 // - Code | 138 // - Code |
128 // - AbstractCode, a wrapper around Code or BytecodeArray | 139 // - AbstractCode, a wrapper around Code or BytecodeArray |
129 // - Map | 140 // - Map |
130 // - Oddball | 141 // - Oddball |
131 // - Foreign | 142 // - Foreign |
132 // - SharedFunctionInfo | 143 // - SharedFunctionInfo |
133 // - Struct | 144 // - Struct |
134 // - Box | 145 // - Box |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 V(EXTERNAL_ONE_BYTE_STRING_TYPE) \ | 323 V(EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
313 V(SLICED_ONE_BYTE_STRING_TYPE) \ | 324 V(SLICED_ONE_BYTE_STRING_TYPE) \ |
314 V(THIN_ONE_BYTE_STRING_TYPE) \ | 325 V(THIN_ONE_BYTE_STRING_TYPE) \ |
315 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 326 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
316 V(SHORT_EXTERNAL_STRING_TYPE) \ | 327 V(SHORT_EXTERNAL_STRING_TYPE) \ |
317 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \ | 328 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
318 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 329 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
319 \ | 330 \ |
320 V(SYMBOL_TYPE) \ | 331 V(SYMBOL_TYPE) \ |
321 V(HEAP_NUMBER_TYPE) \ | 332 V(HEAP_NUMBER_TYPE) \ |
| 333 V(SIMD128_VALUE_TYPE) \ |
322 V(ODDBALL_TYPE) \ | 334 V(ODDBALL_TYPE) \ |
323 \ | 335 \ |
324 V(MAP_TYPE) \ | 336 V(MAP_TYPE) \ |
325 V(CODE_TYPE) \ | 337 V(CODE_TYPE) \ |
326 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 338 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
327 V(FOREIGN_TYPE) \ | 339 V(FOREIGN_TYPE) \ |
328 V(BYTE_ARRAY_TYPE) \ | 340 V(BYTE_ARRAY_TYPE) \ |
329 V(BYTECODE_ARRAY_TYPE) \ | 341 V(BYTECODE_ARRAY_TYPE) \ |
330 V(FREE_SPACE_TYPE) \ | 342 V(FREE_SPACE_TYPE) \ |
331 \ | 343 \ |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 kNotInternalizedTag, | 661 kNotInternalizedTag, |
650 THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag, | 662 THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag, |
651 THIN_ONE_BYTE_STRING_TYPE = | 663 THIN_ONE_BYTE_STRING_TYPE = |
652 kOneByteStringTag | kThinStringTag | kNotInternalizedTag, | 664 kOneByteStringTag | kThinStringTag | kNotInternalizedTag, |
653 | 665 |
654 // Non-string names | 666 // Non-string names |
655 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE | 667 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE |
656 | 668 |
657 // Other primitives (cannot contain non-map-word pointers to heap objects). | 669 // Other primitives (cannot contain non-map-word pointers to heap objects). |
658 HEAP_NUMBER_TYPE, | 670 HEAP_NUMBER_TYPE, |
| 671 SIMD128_VALUE_TYPE, |
659 ODDBALL_TYPE, // LAST_PRIMITIVE_TYPE | 672 ODDBALL_TYPE, // LAST_PRIMITIVE_TYPE |
660 | 673 |
661 // Objects allocated in their own spaces (never in new space). | 674 // Objects allocated in their own spaces (never in new space). |
662 MAP_TYPE, | 675 MAP_TYPE, |
663 CODE_TYPE, | 676 CODE_TYPE, |
664 | 677 |
665 // "Data", objects that cannot contain non-map-word pointers to heap | 678 // "Data", objects that cannot contain non-map-word pointers to heap |
666 // objects. | 679 // objects. |
667 MUTABLE_HEAP_NUMBER_TYPE, | 680 MUTABLE_HEAP_NUMBER_TYPE, |
668 FOREIGN_TYPE, | 681 FOREIGN_TYPE, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 #define OBJECT_TYPE_LIST(V) \ | 978 #define OBJECT_TYPE_LIST(V) \ |
966 V(Smi) \ | 979 V(Smi) \ |
967 V(LayoutDescriptor) \ | 980 V(LayoutDescriptor) \ |
968 V(HeapObject) \ | 981 V(HeapObject) \ |
969 V(Primitive) \ | 982 V(Primitive) \ |
970 V(Number) | 983 V(Number) |
971 | 984 |
972 #define HEAP_OBJECT_TYPE_LIST(V) \ | 985 #define HEAP_OBJECT_TYPE_LIST(V) \ |
973 V(HeapNumber) \ | 986 V(HeapNumber) \ |
974 V(MutableHeapNumber) \ | 987 V(MutableHeapNumber) \ |
| 988 V(Simd128Value) \ |
| 989 V(Float32x4) \ |
| 990 V(Int32x4) \ |
| 991 V(Uint32x4) \ |
| 992 V(Bool32x4) \ |
| 993 V(Int16x8) \ |
| 994 V(Uint16x8) \ |
| 995 V(Bool16x8) \ |
| 996 V(Int8x16) \ |
| 997 V(Uint8x16) \ |
| 998 V(Bool8x16) \ |
975 V(Name) \ | 999 V(Name) \ |
976 V(UniqueName) \ | 1000 V(UniqueName) \ |
977 V(String) \ | 1001 V(String) \ |
978 V(SeqString) \ | 1002 V(SeqString) \ |
979 V(ExternalString) \ | 1003 V(ExternalString) \ |
980 V(ConsString) \ | 1004 V(ConsString) \ |
981 V(SlicedString) \ | 1005 V(SlicedString) \ |
982 V(ExternalTwoByteString) \ | 1006 V(ExternalTwoByteString) \ |
983 V(ExternalOneByteString) \ | 1007 V(ExternalOneByteString) \ |
984 V(SeqTwoByteString) \ | 1008 V(SeqTwoByteString) \ |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 static const int kExponentShift = 20; | 1859 static const int kExponentShift = 20; |
1836 static const int kInfinityOrNanExponent = | 1860 static const int kInfinityOrNanExponent = |
1837 (kExponentMask >> kExponentShift) - kExponentBias; | 1861 (kExponentMask >> kExponentShift) - kExponentBias; |
1838 static const int kMantissaBitsInTopWord = 20; | 1862 static const int kMantissaBitsInTopWord = 20; |
1839 static const int kNonMantissaBitsInTopWord = 12; | 1863 static const int kNonMantissaBitsInTopWord = 12; |
1840 | 1864 |
1841 private: | 1865 private: |
1842 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1866 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
1843 }; | 1867 }; |
1844 | 1868 |
| 1869 |
| 1870 // The Simd128Value class describes heap allocated 128 bit SIMD values. |
| 1871 class Simd128Value : public HeapObject { |
| 1872 public: |
| 1873 DECLARE_CAST(Simd128Value) |
| 1874 |
| 1875 DECLARE_PRINTER(Simd128Value) |
| 1876 DECLARE_VERIFIER(Simd128Value) |
| 1877 |
| 1878 static Handle<String> ToString(Handle<Simd128Value> input); |
| 1879 |
| 1880 // Equality operations. |
| 1881 inline bool Equals(Simd128Value* that); |
| 1882 static inline bool Equals(Handle<Simd128Value> one, Handle<Simd128Value> two); |
| 1883 |
| 1884 // Checks that another instance is bit-wise equal. |
| 1885 bool BitwiseEquals(const Simd128Value* other) const; |
| 1886 // Computes a hash from the 128 bit value, viewed as 4 32-bit integers. |
| 1887 uint32_t Hash() const; |
| 1888 // Copies the 16 bytes of SIMD data to the destination address. |
| 1889 void CopyBits(void* destination) const; |
| 1890 |
| 1891 // Layout description. |
| 1892 static const int kValueOffset = HeapObject::kHeaderSize; |
| 1893 static const int kSize = kValueOffset + kSimd128Size; |
| 1894 |
| 1895 private: |
| 1896 DISALLOW_IMPLICIT_CONSTRUCTORS(Simd128Value); |
| 1897 }; |
| 1898 |
| 1899 |
| 1900 // V has parameters (TYPE, Type, type, lane count, lane type) |
| 1901 #define SIMD128_TYPES(V) \ |
| 1902 V(FLOAT32X4, Float32x4, float32x4, 4, float) \ |
| 1903 V(INT32X4, Int32x4, int32x4, 4, int32_t) \ |
| 1904 V(UINT32X4, Uint32x4, uint32x4, 4, uint32_t) \ |
| 1905 V(BOOL32X4, Bool32x4, bool32x4, 4, bool) \ |
| 1906 V(INT16X8, Int16x8, int16x8, 8, int16_t) \ |
| 1907 V(UINT16X8, Uint16x8, uint16x8, 8, uint16_t) \ |
| 1908 V(BOOL16X8, Bool16x8, bool16x8, 8, bool) \ |
| 1909 V(INT8X16, Int8x16, int8x16, 16, int8_t) \ |
| 1910 V(UINT8X16, Uint8x16, uint8x16, 16, uint8_t) \ |
| 1911 V(BOOL8X16, Bool8x16, bool8x16, 16, bool) |
| 1912 |
| 1913 #define SIMD128_VALUE_CLASS(TYPE, Type, type, lane_count, lane_type) \ |
| 1914 class Type final : public Simd128Value { \ |
| 1915 public: \ |
| 1916 inline lane_type get_lane(int lane) const; \ |
| 1917 inline void set_lane(int lane, lane_type value); \ |
| 1918 \ |
| 1919 DECLARE_CAST(Type) \ |
| 1920 \ |
| 1921 DECLARE_PRINTER(Type) \ |
| 1922 \ |
| 1923 static Handle<String> ToString(Handle<Type> input); \ |
| 1924 \ |
| 1925 inline bool Equals(Type* that); \ |
| 1926 \ |
| 1927 private: \ |
| 1928 DISALLOW_IMPLICIT_CONSTRUCTORS(Type); \ |
| 1929 }; |
| 1930 SIMD128_TYPES(SIMD128_VALUE_CLASS) |
| 1931 #undef SIMD128_VALUE_CLASS |
| 1932 |
| 1933 |
1845 enum EnsureElementsMode { | 1934 enum EnsureElementsMode { |
1846 DONT_ALLOW_DOUBLE_ELEMENTS, | 1935 DONT_ALLOW_DOUBLE_ELEMENTS, |
1847 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1936 ALLOW_COPIED_DOUBLE_ELEMENTS, |
1848 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1937 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
1849 }; | 1938 }; |
1850 | 1939 |
1851 | 1940 |
1852 // Indicator for one component of an AccessorPair. | 1941 // Indicator for one component of an AccessorPair. |
1853 enum AccessorComponent { | 1942 enum AccessorComponent { |
1854 ACCESSOR_GETTER, | 1943 ACCESSOR_GETTER, |
(...skipping 9692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11547 } | 11636 } |
11548 }; | 11637 }; |
11549 | 11638 |
11550 | 11639 |
11551 } // NOLINT, false-positive due to second-order macros. | 11640 } // NOLINT, false-positive due to second-order macros. |
11552 } // NOLINT, false-positive due to second-order macros. | 11641 } // NOLINT, false-positive due to second-order macros. |
11553 | 11642 |
11554 #include "src/objects/object-macros-undef.h" | 11643 #include "src/objects/object-macros-undef.h" |
11555 | 11644 |
11556 #endif // V8_OBJECTS_H_ | 11645 #endif // V8_OBJECTS_H_ |
OLD | NEW |