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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 V(INTERNALIZED_STRING_TYPE) \ | 368 V(INTERNALIZED_STRING_TYPE) \ |
369 V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 369 V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
370 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 370 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
371 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 371 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
372 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 372 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
373 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 373 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
374 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ | 374 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
375 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 375 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
376 \ | 376 \ |
377 V(SYMBOL_TYPE) \ | 377 V(SYMBOL_TYPE) \ |
378 V(FLOAT32X4_TYPE) \ | 378 V(SIMD128_VALUE_TYPE) \ |
379 V(INT32X4_TYPE) \ | |
380 V(BOOL32X4_TYPE) \ | |
381 V(INT16X8_TYPE) \ | |
382 V(BOOL16X8_TYPE) \ | |
383 V(INT8X16_TYPE) \ | |
384 V(BOOL8X16_TYPE) \ | |
385 \ | 379 \ |
386 V(MAP_TYPE) \ | 380 V(MAP_TYPE) \ |
387 V(CODE_TYPE) \ | 381 V(CODE_TYPE) \ |
388 V(ODDBALL_TYPE) \ | 382 V(ODDBALL_TYPE) \ |
389 V(CELL_TYPE) \ | 383 V(CELL_TYPE) \ |
390 V(PROPERTY_CELL_TYPE) \ | 384 V(PROPERTY_CELL_TYPE) \ |
391 \ | 385 \ |
392 V(HEAP_NUMBER_TYPE) \ | 386 V(HEAP_NUMBER_TYPE) \ |
393 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 387 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
394 V(FOREIGN_TYPE) \ | 388 V(FOREIGN_TYPE) \ |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 662 |
669 // Objects allocated in their own spaces (never in new space). | 663 // Objects allocated in their own spaces (never in new space). |
670 MAP_TYPE, | 664 MAP_TYPE, |
671 CODE_TYPE, | 665 CODE_TYPE, |
672 ODDBALL_TYPE, | 666 ODDBALL_TYPE, |
673 | 667 |
674 // "Data", objects that cannot contain non-map-word pointers to heap | 668 // "Data", objects that cannot contain non-map-word pointers to heap |
675 // objects. | 669 // objects. |
676 HEAP_NUMBER_TYPE, | 670 HEAP_NUMBER_TYPE, |
677 MUTABLE_HEAP_NUMBER_TYPE, | 671 MUTABLE_HEAP_NUMBER_TYPE, |
678 FLOAT32X4_TYPE, // FIRST_SIMD_VALUE_TYPE | 672 SIMD128_VALUE_TYPE, |
679 INT32X4_TYPE, | |
680 BOOL32X4_TYPE, | |
681 INT16X8_TYPE, | |
682 BOOL16X8_TYPE, | |
683 INT8X16_TYPE, | |
684 BOOL8X16_TYPE, // LAST_SIMD_VALUE_TYPE | |
685 FOREIGN_TYPE, | 673 FOREIGN_TYPE, |
686 BYTE_ARRAY_TYPE, | 674 BYTE_ARRAY_TYPE, |
687 BYTECODE_ARRAY_TYPE, | 675 BYTECODE_ARRAY_TYPE, |
688 FREE_SPACE_TYPE, | 676 FREE_SPACE_TYPE, |
689 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE | 677 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE |
690 FIXED_UINT8_ARRAY_TYPE, | 678 FIXED_UINT8_ARRAY_TYPE, |
691 FIXED_INT16_ARRAY_TYPE, | 679 FIXED_INT16_ARRAY_TYPE, |
692 FIXED_UINT16_ARRAY_TYPE, | 680 FIXED_UINT16_ARRAY_TYPE, |
693 FIXED_INT32_ARRAY_TYPE, | 681 FIXED_INT32_ARRAY_TYPE, |
694 FIXED_UINT32_ARRAY_TYPE, | 682 FIXED_UINT32_ARRAY_TYPE, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 746 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
759 | 747 |
760 // Pseudo-types | 748 // Pseudo-types |
761 FIRST_TYPE = 0x0, | 749 FIRST_TYPE = 0x0, |
762 LAST_TYPE = JS_FUNCTION_TYPE, | 750 LAST_TYPE = JS_FUNCTION_TYPE, |
763 FIRST_NAME_TYPE = FIRST_TYPE, | 751 FIRST_NAME_TYPE = FIRST_TYPE, |
764 LAST_NAME_TYPE = SYMBOL_TYPE, | 752 LAST_NAME_TYPE = SYMBOL_TYPE, |
765 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, | 753 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
766 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, | 754 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
767 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, | 755 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
768 // Boundaries for testing for a SIMD types. | |
769 FIRST_SIMD_VALUE_TYPE = FLOAT32X4_TYPE, | |
770 LAST_SIMD_VALUE_TYPE = BOOL8X16_TYPE, | |
771 // Boundaries for testing for a fixed typed array. | 756 // Boundaries for testing for a fixed typed array. |
772 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 757 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
773 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 758 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
774 // Boundary for promotion to old space. | 759 // Boundary for promotion to old space. |
775 LAST_DATA_TYPE = FILLER_TYPE, | 760 LAST_DATA_TYPE = FILLER_TYPE, |
776 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 761 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
777 // Note that there is no range for JSObject or JSProxy, since their subtypes | 762 // Note that there is no range for JSObject or JSProxy, since their subtypes |
778 // are not continuous in this enum! The enum ranges instead reflect the | 763 // are not continuous in this enum! The enum ranges instead reflect the |
779 // external class names, where proxies are treated as either ordinary objects, | 764 // external class names, where proxies are treated as either ordinary objects, |
780 // or functions. | 765 // or functions. |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 static const int kInfinityOrNanExponent = | 1580 static const int kInfinityOrNanExponent = |
1596 (kExponentMask >> kExponentShift) - kExponentBias; | 1581 (kExponentMask >> kExponentShift) - kExponentBias; |
1597 static const int kMantissaBitsInTopWord = 20; | 1582 static const int kMantissaBitsInTopWord = 20; |
1598 static const int kNonMantissaBitsInTopWord = 12; | 1583 static const int kNonMantissaBitsInTopWord = 12; |
1599 | 1584 |
1600 private: | 1585 private: |
1601 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1586 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
1602 }; | 1587 }; |
1603 | 1588 |
1604 | 1589 |
1605 // The SimdValue128 class describes heap allocated 128 bit SIMD values. | 1590 // The Simd128Value class describes heap allocated 128 bit SIMD values. |
1606 class Simd128Value : public HeapObject { | 1591 class Simd128Value : public HeapObject { |
1607 public: | 1592 public: |
1608 DECLARE_CAST(Simd128Value) | 1593 DECLARE_CAST(Simd128Value) |
1609 | 1594 |
| 1595 DECLARE_PRINTER(Simd128Value) |
| 1596 DECLARE_VERIFIER(Simd128Value) |
| 1597 |
1610 // Checks that another instance is bit-wise equal. | 1598 // Checks that another instance is bit-wise equal. |
1611 bool BitwiseEquals(const Simd128Value* other) const; | 1599 bool BitwiseEquals(const Simd128Value* other) const; |
1612 // Computes a hash from the 128 bit value, viewed as 4 32-bit integers. | 1600 // Computes a hash from the 128 bit value, viewed as 4 32-bit integers. |
1613 uint32_t Hash() const; | 1601 uint32_t Hash() const; |
1614 // Copies the 16 bytes of SIMD data to the destination address. | 1602 // Copies the 16 bytes of SIMD data to the destination address. |
1615 void CopyBits(void* destination) const; | 1603 void CopyBits(void* destination) const; |
1616 | 1604 |
1617 // Layout description. | 1605 // Layout description. |
1618 static const int kValueOffset = HeapObject::kHeaderSize; | 1606 static const int kValueOffset = HeapObject::kHeaderSize; |
1619 static const int kSize = kValueOffset + kSimd128Size; | 1607 static const int kSize = kValueOffset + kSimd128Size; |
1620 | 1608 |
1621 private: | 1609 private: |
1622 DISALLOW_IMPLICIT_CONSTRUCTORS(Simd128Value); | 1610 DISALLOW_IMPLICIT_CONSTRUCTORS(Simd128Value); |
1623 }; | 1611 }; |
1624 | 1612 |
1625 | 1613 |
1626 #define SIMD128_TYPES(V) \ | 1614 // V has parameters (TYPE, Type, type, lane count, lane type) |
1627 V(Float32x4, float32x4, 4, float) \ | 1615 #define SIMD128_TYPES(V) \ |
1628 V(Int32x4, int32x4, 4, int32_t) \ | 1616 V(FLOAT32X4, Float32x4, float32x4, 4, float) \ |
1629 V(Bool32x4, bool32x4, 4, bool) \ | 1617 V(INT32X4, Int32x4, int32x4, 4, int32_t) \ |
1630 V(Int16x8, int16x8, 8, int16_t) \ | 1618 V(BOOL32X4, Bool32x4, bool32x4, 4, bool) \ |
1631 V(Bool16x8, bool16x8, 8, bool) \ | 1619 V(INT16X8, Int16x8, int16x8, 8, int16_t) \ |
1632 V(Int8x16, int8x16, 16, int8_t) \ | 1620 V(BOOL16X8, Bool16x8, bool16x8, 8, bool) \ |
1633 V(Bool8x16, bool8x16, 16, bool) | 1621 V(INT8X16, Int8x16, int8x16, 16, int8_t) \ |
| 1622 V(BOOL8X16, Bool8x16, bool8x16, 16, bool) |
1634 | 1623 |
1635 #define SIMD128_VALUE_CLASS(name, type, lane_count, lane_type) \ | 1624 #define SIMD128_VALUE_CLASS(TYPE, Type, type, lane_count, lane_type) \ |
1636 class name : public Simd128Value { \ | 1625 class Type final : public Simd128Value { \ |
1637 public: \ | 1626 public: \ |
1638 inline lane_type get_lane(int lane) const; \ | 1627 inline lane_type get_lane(int lane) const; \ |
1639 inline void set_lane(int lane, lane_type value); \ | 1628 inline void set_lane(int lane, lane_type value); \ |
1640 \ | 1629 \ |
1641 DECLARE_CAST(name) \ | 1630 DECLARE_CAST(Type) \ |
1642 \ | 1631 \ |
1643 DECLARE_PRINTER(name) \ | 1632 DECLARE_PRINTER(Type) \ |
1644 DECLARE_VERIFIER(name) \ | 1633 \ |
1645 \ | 1634 private: \ |
1646 private: \ | 1635 DISALLOW_IMPLICIT_CONSTRUCTORS(Type); \ |
1647 DISALLOW_IMPLICIT_CONSTRUCTORS(name); \ | |
1648 }; | 1636 }; |
1649 | |
1650 SIMD128_TYPES(SIMD128_VALUE_CLASS) | 1637 SIMD128_TYPES(SIMD128_VALUE_CLASS) |
| 1638 #undef SIMD128_VALUE_CLASS |
1651 | 1639 |
1652 | 1640 |
1653 enum EnsureElementsMode { | 1641 enum EnsureElementsMode { |
1654 DONT_ALLOW_DOUBLE_ELEMENTS, | 1642 DONT_ALLOW_DOUBLE_ELEMENTS, |
1655 ALLOW_COPIED_DOUBLE_ELEMENTS, | 1643 ALLOW_COPIED_DOUBLE_ELEMENTS, |
1656 ALLOW_CONVERTED_DOUBLE_ELEMENTS | 1644 ALLOW_CONVERTED_DOUBLE_ELEMENTS |
1657 }; | 1645 }; |
1658 | 1646 |
1659 | 1647 |
1660 // Indicator for one component of an AccessorPair. | 1648 // Indicator for one component of an AccessorPair. |
(...skipping 8899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10560 } else { | 10548 } else { |
10561 value &= ~(1 << bit_position); | 10549 value &= ~(1 << bit_position); |
10562 } | 10550 } |
10563 return value; | 10551 return value; |
10564 } | 10552 } |
10565 }; | 10553 }; |
10566 | 10554 |
10567 } } // namespace v8::internal | 10555 } } // namespace v8::internal |
10568 | 10556 |
10569 #endif // V8_OBJECTS_H_ | 10557 #endif // V8_OBJECTS_H_ |
OLD | NEW |