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 | |
136 // - Cell | 125 // - Cell |
137 // - PropertyCell | 126 // - PropertyCell |
138 // - Code | 127 // - Code |
139 // - AbstractCode, a wrapper around Code or BytecodeArray | 128 // - AbstractCode, a wrapper around Code or BytecodeArray |
140 // - Map | 129 // - Map |
141 // - Oddball | 130 // - Oddball |
142 // - Foreign | 131 // - Foreign |
143 // - SharedFunctionInfo | 132 // - SharedFunctionInfo |
144 // - Struct | 133 // - Struct |
145 // - Box | 134 // - Box |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 V(EXTERNAL_ONE_BYTE_STRING_TYPE) \ | 312 V(EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
324 V(SLICED_ONE_BYTE_STRING_TYPE) \ | 313 V(SLICED_ONE_BYTE_STRING_TYPE) \ |
325 V(THIN_ONE_BYTE_STRING_TYPE) \ | 314 V(THIN_ONE_BYTE_STRING_TYPE) \ |
326 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 315 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
327 V(SHORT_EXTERNAL_STRING_TYPE) \ | 316 V(SHORT_EXTERNAL_STRING_TYPE) \ |
328 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \ | 317 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
329 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 318 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
330 \ | 319 \ |
331 V(SYMBOL_TYPE) \ | 320 V(SYMBOL_TYPE) \ |
332 V(HEAP_NUMBER_TYPE) \ | 321 V(HEAP_NUMBER_TYPE) \ |
333 V(SIMD128_VALUE_TYPE) \ | |
334 V(ODDBALL_TYPE) \ | 322 V(ODDBALL_TYPE) \ |
335 \ | 323 \ |
336 V(MAP_TYPE) \ | 324 V(MAP_TYPE) \ |
337 V(CODE_TYPE) \ | 325 V(CODE_TYPE) \ |
338 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 326 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
339 V(FOREIGN_TYPE) \ | 327 V(FOREIGN_TYPE) \ |
340 V(BYTE_ARRAY_TYPE) \ | 328 V(BYTE_ARRAY_TYPE) \ |
341 V(BYTECODE_ARRAY_TYPE) \ | 329 V(BYTECODE_ARRAY_TYPE) \ |
342 V(FREE_SPACE_TYPE) \ | 330 V(FREE_SPACE_TYPE) \ |
343 \ | 331 \ |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 kNotInternalizedTag, | 649 kNotInternalizedTag, |
662 THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag, | 650 THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag, |
663 THIN_ONE_BYTE_STRING_TYPE = | 651 THIN_ONE_BYTE_STRING_TYPE = |
664 kOneByteStringTag | kThinStringTag | kNotInternalizedTag, | 652 kOneByteStringTag | kThinStringTag | kNotInternalizedTag, |
665 | 653 |
666 // Non-string names | 654 // Non-string names |
667 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE | 655 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE |
668 | 656 |
669 // Other primitives (cannot contain non-map-word pointers to heap objects). | 657 // Other primitives (cannot contain non-map-word pointers to heap objects). |
670 HEAP_NUMBER_TYPE, | 658 HEAP_NUMBER_TYPE, |
671 SIMD128_VALUE_TYPE, | |
672 ODDBALL_TYPE, // LAST_PRIMITIVE_TYPE | 659 ODDBALL_TYPE, // LAST_PRIMITIVE_TYPE |
673 | 660 |
674 // Objects allocated in their own spaces (never in new space). | 661 // Objects allocated in their own spaces (never in new space). |
675 MAP_TYPE, | 662 MAP_TYPE, |
676 CODE_TYPE, | 663 CODE_TYPE, |
677 | 664 |
678 // "Data", objects that cannot contain non-map-word pointers to heap | 665 // "Data", objects that cannot contain non-map-word pointers to heap |
679 // objects. | 666 // objects. |
680 MUTABLE_HEAP_NUMBER_TYPE, | 667 MUTABLE_HEAP_NUMBER_TYPE, |
681 FOREIGN_TYPE, | 668 FOREIGN_TYPE, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 #define OBJECT_TYPE_LIST(V) \ | 965 #define OBJECT_TYPE_LIST(V) \ |
979 V(Smi) \ | 966 V(Smi) \ |
980 V(LayoutDescriptor) \ | 967 V(LayoutDescriptor) \ |
981 V(HeapObject) \ | 968 V(HeapObject) \ |
982 V(Primitive) \ | 969 V(Primitive) \ |
983 V(Number) | 970 V(Number) |
984 | 971 |
985 #define HEAP_OBJECT_TYPE_LIST(V) \ | 972 #define HEAP_OBJECT_TYPE_LIST(V) \ |
986 V(HeapNumber) \ | 973 V(HeapNumber) \ |
987 V(MutableHeapNumber) \ | 974 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) \ | |
999 V(Name) \ | 975 V(Name) \ |
1000 V(UniqueName) \ | 976 V(UniqueName) \ |
1001 V(String) \ | 977 V(String) \ |
1002 V(SeqString) \ | 978 V(SeqString) \ |
1003 V(ExternalString) \ | 979 V(ExternalString) \ |
1004 V(ConsString) \ | 980 V(ConsString) \ |
1005 V(SlicedString) \ | 981 V(SlicedString) \ |
1006 V(ExternalTwoByteString) \ | 982 V(ExternalTwoByteString) \ |
1007 V(ExternalOneByteString) \ | 983 V(ExternalOneByteString) \ |
1008 V(SeqTwoByteString) \ | 984 V(SeqTwoByteString) \ |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 static const int kExponentShift = 20; | 1835 static const int kExponentShift = 20; |
1860 static const int kInfinityOrNanExponent = | 1836 static const int kInfinityOrNanExponent = |
1861 (kExponentMask >> kExponentShift) - kExponentBias; | 1837 (kExponentMask >> kExponentShift) - kExponentBias; |
1862 static const int kMantissaBitsInTopWord = 20; | 1838 static const int kMantissaBitsInTopWord = 20; |
1863 static const int kNonMantissaBitsInTopWord = 12; | 1839 static const int kNonMantissaBitsInTopWord = 12; |
1864 | 1840 |
1865 private: | 1841 private: |
1866 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1842 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
1867 }; | 1843 }; |
1868 | 1844 |
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 | |
1934 enum EnsureElementsMode { | 1845 enum EnsureElementsMode { |
1935 DONT_ALLOW_DOUBLE_ELEMENTS, | 1846 DONT_ALLOW_DOUBLE_ELEMENTS, |
1936 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1847 ALLOW_COPIED_DOUBLE_ELEMENTS, |
1937 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1848 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
1938 }; | 1849 }; |
1939 | 1850 |
1940 | 1851 |
1941 // Indicator for one component of an AccessorPair. | 1852 // Indicator for one component of an AccessorPair. |
1942 enum AccessorComponent { | 1853 enum AccessorComponent { |
1943 ACCESSOR_GETTER, | 1854 ACCESSOR_GETTER, |
(...skipping 9692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11636 } | 11547 } |
11637 }; | 11548 }; |
11638 | 11549 |
11639 | 11550 |
11640 } // NOLINT, false-positive due to second-order macros. | 11551 } // NOLINT, false-positive due to second-order macros. |
11641 } // NOLINT, false-positive due to second-order macros. | 11552 } // NOLINT, false-positive due to second-order macros. |
11642 | 11553 |
11643 #include "src/objects/object-macros-undef.h" | 11554 #include "src/objects/object-macros-undef.h" |
11644 | 11555 |
11645 #endif // V8_OBJECTS_H_ | 11556 #endif // V8_OBJECTS_H_ |
OLD | NEW |