Chromium Code Reviews| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 // - InternalizedString | 114 // - InternalizedString |
| 115 // - SeqInternalizedString | 115 // - SeqInternalizedString |
| 116 // - SeqOneByteInternalizedString | 116 // - SeqOneByteInternalizedString |
| 117 // - SeqTwoByteInternalizedString | 117 // - SeqTwoByteInternalizedString |
| 118 // - ConsInternalizedString | 118 // - ConsInternalizedString |
| 119 // - ExternalInternalizedString | 119 // - ExternalInternalizedString |
| 120 // - ExternalOneByteInternalizedString | 120 // - ExternalOneByteInternalizedString |
| 121 // - ExternalTwoByteInternalizedString | 121 // - ExternalTwoByteInternalizedString |
| 122 // - Symbol | 122 // - Symbol |
| 123 // - HeapNumber | 123 // - HeapNumber |
| 124 // - Float32x4 | |
| 124 // - Cell | 125 // - Cell |
| 125 // - PropertyCell | 126 // - PropertyCell |
| 126 // - Code | 127 // - Code |
| 127 // - Map | 128 // - Map |
| 128 // - Oddball | 129 // - Oddball |
| 129 // - Foreign | 130 // - Foreign |
| 130 // - SharedFunctionInfo | 131 // - SharedFunctionInfo |
| 131 // - Struct | 132 // - Struct |
| 132 // - Box | 133 // - Box |
| 133 // - AccessorInfo | 134 // - AccessorInfo |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 V(SYMBOL_TYPE) \ | 388 V(SYMBOL_TYPE) \ |
| 388 \ | 389 \ |
| 389 V(MAP_TYPE) \ | 390 V(MAP_TYPE) \ |
| 390 V(CODE_TYPE) \ | 391 V(CODE_TYPE) \ |
| 391 V(ODDBALL_TYPE) \ | 392 V(ODDBALL_TYPE) \ |
| 392 V(CELL_TYPE) \ | 393 V(CELL_TYPE) \ |
| 393 V(PROPERTY_CELL_TYPE) \ | 394 V(PROPERTY_CELL_TYPE) \ |
| 394 \ | 395 \ |
| 395 V(HEAP_NUMBER_TYPE) \ | 396 V(HEAP_NUMBER_TYPE) \ |
| 396 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 397 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
| 398 V(FLOAT32X4_TYPE) \ | |
| 397 V(FOREIGN_TYPE) \ | 399 V(FOREIGN_TYPE) \ |
| 398 V(BYTE_ARRAY_TYPE) \ | 400 V(BYTE_ARRAY_TYPE) \ |
| 399 V(FREE_SPACE_TYPE) \ | 401 V(FREE_SPACE_TYPE) \ |
| 400 /* Note: the order of these external array */ \ | 402 /* Note: the order of these external array */ \ |
| 401 /* types is relied upon in */ \ | 403 /* types is relied upon in */ \ |
| 402 /* Object::IsExternalArray(). */ \ | 404 /* Object::IsExternalArray(). */ \ |
| 403 V(EXTERNAL_INT8_ARRAY_TYPE) \ | 405 V(EXTERNAL_INT8_ARRAY_TYPE) \ |
| 404 V(EXTERNAL_UINT8_ARRAY_TYPE) \ | 406 V(EXTERNAL_UINT8_ARRAY_TYPE) \ |
| 405 V(EXTERNAL_INT16_ARRAY_TYPE) \ | 407 V(EXTERNAL_INT16_ARRAY_TYPE) \ |
| 406 V(EXTERNAL_UINT16_ARRAY_TYPE) \ | 408 V(EXTERNAL_UINT16_ARRAY_TYPE) \ |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 682 | 684 |
| 683 // Objects allocated in their own spaces (never in new space). | 685 // Objects allocated in their own spaces (never in new space). |
| 684 MAP_TYPE, | 686 MAP_TYPE, |
| 685 CODE_TYPE, | 687 CODE_TYPE, |
| 686 ODDBALL_TYPE, | 688 ODDBALL_TYPE, |
| 687 | 689 |
| 688 // "Data", objects that cannot contain non-map-word pointers to heap | 690 // "Data", objects that cannot contain non-map-word pointers to heap |
| 689 // objects. | 691 // objects. |
| 690 HEAP_NUMBER_TYPE, | 692 HEAP_NUMBER_TYPE, |
| 691 MUTABLE_HEAP_NUMBER_TYPE, | 693 MUTABLE_HEAP_NUMBER_TYPE, |
| 694 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE | |
| 692 FOREIGN_TYPE, | 695 FOREIGN_TYPE, |
| 693 BYTE_ARRAY_TYPE, | 696 BYTE_ARRAY_TYPE, |
| 694 FREE_SPACE_TYPE, | 697 FREE_SPACE_TYPE, |
| 695 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 698 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 696 EXTERNAL_UINT8_ARRAY_TYPE, | 699 EXTERNAL_UINT8_ARRAY_TYPE, |
| 697 EXTERNAL_INT16_ARRAY_TYPE, | 700 EXTERNAL_INT16_ARRAY_TYPE, |
| 698 EXTERNAL_UINT16_ARRAY_TYPE, | 701 EXTERNAL_UINT16_ARRAY_TYPE, |
| 699 EXTERNAL_INT32_ARRAY_TYPE, | 702 EXTERNAL_INT32_ARRAY_TYPE, |
| 700 EXTERNAL_UINT32_ARRAY_TYPE, | 703 EXTERNAL_UINT32_ARRAY_TYPE, |
| 701 EXTERNAL_FLOAT32_ARRAY_TYPE, | 704 EXTERNAL_FLOAT32_ARRAY_TYPE, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 776 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
| 774 | 777 |
| 775 // Pseudo-types | 778 // Pseudo-types |
| 776 FIRST_TYPE = 0x0, | 779 FIRST_TYPE = 0x0, |
| 777 LAST_TYPE = JS_FUNCTION_TYPE, | 780 LAST_TYPE = JS_FUNCTION_TYPE, |
| 778 FIRST_NAME_TYPE = FIRST_TYPE, | 781 FIRST_NAME_TYPE = FIRST_TYPE, |
| 779 LAST_NAME_TYPE = SYMBOL_TYPE, | 782 LAST_NAME_TYPE = SYMBOL_TYPE, |
| 780 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, | 783 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
| 781 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, | 784 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
| 782 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, | 785 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
| 786 // Boundaries for testing for a SIMD type. | |
| 787 FIRST_SIMD_TYPE = FLOAT32X4_TYPE, | |
| 788 LAST_SIMD_TYPE = FLOAT32X4_TYPE, | |
| 783 // Boundaries for testing for an external array. | 789 // Boundaries for testing for an external array. |
| 784 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE, | 790 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE, |
| 785 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, | 791 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, |
| 786 // Boundaries for testing for a fixed typed array. | 792 // Boundaries for testing for a fixed typed array. |
| 787 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 793 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
| 788 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 794 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
| 789 // Boundary for promotion to old space. | 795 // Boundary for promotion to old space. |
| 790 LAST_DATA_TYPE = FILLER_TYPE, | 796 LAST_DATA_TYPE = FILLER_TYPE, |
| 791 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 797 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
| 792 // Note that there is no range for JSObject or JSProxy, since their subtypes | 798 // Note that there is no range for JSObject or JSProxy, since their subtypes |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 V(FixedTypedArrayBase) \ | 945 V(FixedTypedArrayBase) \ |
| 940 V(FixedUint8Array) \ | 946 V(FixedUint8Array) \ |
| 941 V(FixedInt8Array) \ | 947 V(FixedInt8Array) \ |
| 942 V(FixedUint16Array) \ | 948 V(FixedUint16Array) \ |
| 943 V(FixedInt16Array) \ | 949 V(FixedInt16Array) \ |
| 944 V(FixedUint32Array) \ | 950 V(FixedUint32Array) \ |
| 945 V(FixedInt32Array) \ | 951 V(FixedInt32Array) \ |
| 946 V(FixedFloat32Array) \ | 952 V(FixedFloat32Array) \ |
| 947 V(FixedFloat64Array) \ | 953 V(FixedFloat64Array) \ |
| 948 V(FixedUint8ClampedArray) \ | 954 V(FixedUint8ClampedArray) \ |
| 955 V(Float32x4) \ | |
| 949 V(ByteArray) \ | 956 V(ByteArray) \ |
| 950 V(FreeSpace) \ | 957 V(FreeSpace) \ |
| 951 V(JSReceiver) \ | 958 V(JSReceiver) \ |
| 952 V(JSObject) \ | 959 V(JSObject) \ |
| 953 V(JSContextExtensionObject) \ | 960 V(JSContextExtensionObject) \ |
| 954 V(JSGeneratorObject) \ | 961 V(JSGeneratorObject) \ |
| 955 V(JSModule) \ | 962 V(JSModule) \ |
| 956 V(LayoutDescriptor) \ | 963 V(LayoutDescriptor) \ |
| 957 V(Map) \ | 964 V(Map) \ |
| 958 V(DescriptorArray) \ | 965 V(DescriptorArray) \ |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1600 static const int kInfinityOrNanExponent = | 1607 static const int kInfinityOrNanExponent = |
| 1601 (kExponentMask >> kExponentShift) - kExponentBias; | 1608 (kExponentMask >> kExponentShift) - kExponentBias; |
| 1602 static const int kMantissaBitsInTopWord = 20; | 1609 static const int kMantissaBitsInTopWord = 20; |
| 1603 static const int kNonMantissaBitsInTopWord = 12; | 1610 static const int kNonMantissaBitsInTopWord = 12; |
| 1604 | 1611 |
| 1605 private: | 1612 private: |
| 1606 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1613 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
| 1607 }; | 1614 }; |
| 1608 | 1615 |
| 1609 | 1616 |
| 1617 // The Float32x4 class describes heap allocated SIMD values holding 4 32-bit | |
| 1618 // IEEE floats. | |
| 1619 class Float32x4 : public HeapObject { | |
| 1620 public: | |
| 1621 inline double get_lane(int lane) const; | |
|
titzer
2015/06/03 13:27:15
I think we should float here too.
bbudge
2015/06/03 20:31:48
Done.
| |
| 1622 inline void set_lane(int lane, double value); | |
| 1623 | |
| 1624 DECLARE_CAST(Float32x4) | |
| 1625 | |
| 1626 // Dispatched behavior. | |
| 1627 bool Float32x4BooleanValue(); | |
| 1628 | |
| 1629 void Float32x4Print(std::ostream& os); // NOLINT | |
| 1630 DECLARE_VERIFIER(Float32x4) | |
| 1631 | |
| 1632 // Layout description. | |
| 1633 static const int kValueOffset = HeapObject::kHeaderSize; | |
| 1634 #if defined(V8_TARGET_LITTLE_ENDIAN) | |
|
titzer
2015/06/03 13:27:15
Can we leave these out of the header to force user
bbudge
2015/06/03 20:31:48
Done (I just deleted them, since they're not used
| |
| 1635 static const int kLane0Offset = kValueOffset; | |
| 1636 static const int kLane1Offset = kValueOffset + 4; | |
| 1637 static const int kLane2Offset = kValueOffset + 8; | |
| 1638 static const int kLane3Offset = kValueOffset + 12; | |
| 1639 #elif defined(V8_TARGET_BIG_ENDIAN) | |
| 1640 static const int kLane0Offset = kValueOffset + 12; | |
| 1641 static const int kLane1Offset = kValueOffset + 8; | |
| 1642 static const int kLane2Offset = kValueOffset + 4; | |
| 1643 static const int kLane3Offset = kValueOffset; | |
| 1644 #else | |
| 1645 #error Unknown byte ordering | |
| 1646 #endif | |
| 1647 | |
| 1648 static const int kSize = kValueOffset + kSimd128Size; | |
| 1649 | |
| 1650 private: | |
| 1651 DISALLOW_IMPLICIT_CONSTRUCTORS(Float32x4); | |
| 1652 }; | |
| 1653 | |
| 1654 | |
| 1610 enum EnsureElementsMode { | 1655 enum EnsureElementsMode { |
| 1611 DONT_ALLOW_DOUBLE_ELEMENTS, | 1656 DONT_ALLOW_DOUBLE_ELEMENTS, |
| 1612 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1657 ALLOW_COPIED_DOUBLE_ELEMENTS, |
| 1613 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1658 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
| 1614 }; | 1659 }; |
| 1615 | 1660 |
| 1616 | 1661 |
| 1617 // Indicates whether a property should be set or (re)defined. Setting of a | 1662 // Indicates whether a property should be set or (re)defined. Setting of a |
| 1618 // property causes attributes to remain unchanged, writability to be checked | 1663 // property causes attributes to remain unchanged, writability to be checked |
| 1619 // and callbacks to be called. Defining of a property causes attributes to | 1664 // and callbacks to be called. Defining of a property causes attributes to |
| (...skipping 9218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10838 } else { | 10883 } else { |
| 10839 value &= ~(1 << bit_position); | 10884 value &= ~(1 << bit_position); |
| 10840 } | 10885 } |
| 10841 return value; | 10886 return value; |
| 10842 } | 10887 } |
| 10843 }; | 10888 }; |
| 10844 | 10889 |
| 10845 } } // namespace v8::internal | 10890 } } // namespace v8::internal |
| 10846 | 10891 |
| 10847 #endif // V8_OBJECTS_H_ | 10892 #endif // V8_OBJECTS_H_ |
| OLD | NEW |