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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 // wrappers. | 784 // wrappers. |
785 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE, | 785 LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE, |
786 }; | 786 }; |
787 | 787 |
788 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); | 788 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
789 STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType); | 789 STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType); |
790 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 790 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
791 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); | 791 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
792 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); | 792 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
793 | 793 |
794 | 794 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
795 std::ostream& operator<<(std::ostream& os, InstanceType instance_type); | 795 InstanceType instance_type); |
796 | 796 |
797 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ | 797 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ |
798 V(BYTECODE_ARRAY_CONSTANT_POOL_SUB_TYPE) \ | 798 V(BYTECODE_ARRAY_CONSTANT_POOL_SUB_TYPE) \ |
799 V(BYTECODE_ARRAY_HANDLER_TABLE_SUB_TYPE) \ | 799 V(BYTECODE_ARRAY_HANDLER_TABLE_SUB_TYPE) \ |
800 V(CODE_STUBS_TABLE_SUB_TYPE) \ | 800 V(CODE_STUBS_TABLE_SUB_TYPE) \ |
801 V(COMPILATION_CACHE_TABLE_SUB_TYPE) \ | 801 V(COMPILATION_CACHE_TABLE_SUB_TYPE) \ |
802 V(CONTEXT_SUB_TYPE) \ | 802 V(CONTEXT_SUB_TYPE) \ |
803 V(COPY_ON_WRITE_SUB_TYPE) \ | 803 V(COPY_ON_WRITE_SUB_TYPE) \ |
804 V(DEOPTIMIZATION_DATA_SUB_TYPE) \ | 804 V(DEOPTIMIZATION_DATA_SUB_TYPE) \ |
805 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ | 805 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 // Returns whether value can be represented in a Smi. | 1519 // Returns whether value can be represented in a Smi. |
1520 static inline bool IsValid(intptr_t value) { | 1520 static inline bool IsValid(intptr_t value) { |
1521 bool result = Internals::IsValidSmi(value); | 1521 bool result = Internals::IsValidSmi(value); |
1522 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue); | 1522 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue); |
1523 return result; | 1523 return result; |
1524 } | 1524 } |
1525 | 1525 |
1526 DECLARE_CAST(Smi) | 1526 DECLARE_CAST(Smi) |
1527 | 1527 |
1528 // Dispatched behavior. | 1528 // Dispatched behavior. |
1529 void SmiPrint(std::ostream& os) const; // NOLINT | 1529 V8_EXPORT_PRIVATE void SmiPrint(std::ostream& os) const; // NOLINT |
1530 DECLARE_VERIFIER(Smi) | 1530 DECLARE_VERIFIER(Smi) |
1531 | 1531 |
1532 V8_EXPORT_PRIVATE static Smi* const kZero; | 1532 V8_EXPORT_PRIVATE static Smi* const kZero; |
1533 static const int kMinValue = | 1533 static const int kMinValue = |
1534 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); | 1534 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); |
1535 static const int kMaxValue = -(kMinValue + 1); | 1535 static const int kMaxValue = -(kMinValue + 1); |
1536 | 1536 |
1537 private: | 1537 private: |
1538 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); | 1538 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); |
1539 }; | 1539 }; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 public: | 1748 public: |
1749 // [value]: number value. | 1749 // [value]: number value. |
1750 inline double value() const; | 1750 inline double value() const; |
1751 inline void set_value(double value); | 1751 inline void set_value(double value); |
1752 | 1752 |
1753 DECLARE_CAST(HeapNumber) | 1753 DECLARE_CAST(HeapNumber) |
1754 | 1754 |
1755 // Dispatched behavior. | 1755 // Dispatched behavior. |
1756 bool HeapNumberBooleanValue(); | 1756 bool HeapNumberBooleanValue(); |
1757 | 1757 |
1758 void HeapNumberPrint(std::ostream& os); // NOLINT | 1758 V8_EXPORT_PRIVATE void HeapNumberPrint(std::ostream& os); // NOLINT |
1759 DECLARE_VERIFIER(HeapNumber) | 1759 DECLARE_VERIFIER(HeapNumber) |
1760 | 1760 |
1761 inline int get_exponent(); | 1761 inline int get_exponent(); |
1762 inline int get_sign(); | 1762 inline int get_sign(); |
1763 | 1763 |
1764 // Layout description. | 1764 // Layout description. |
1765 static const int kValueOffset = HeapObject::kHeaderSize; | 1765 static const int kValueOffset = HeapObject::kHeaderSize; |
1766 // IEEE doubles are two 32 bit words. The first is just mantissa, the second | 1766 // IEEE doubles are two 32 bit words. The first is just mantissa, the second |
1767 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit | 1767 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit |
1768 // words within double numbers are endian dependent and they are set | 1768 // words within double numbers are endian dependent and they are set |
(...skipping 8059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9828 | 9828 |
9829 // Second string of the cons cell. | 9829 // Second string of the cons cell. |
9830 inline String* second(); | 9830 inline String* second(); |
9831 // Doesn't check that the result is a string, even in debug mode. This is | 9831 // Doesn't check that the result is a string, even in debug mode. This is |
9832 // useful during GC where the mark bits confuse the checks. | 9832 // useful during GC where the mark bits confuse the checks. |
9833 inline Object* unchecked_second(); | 9833 inline Object* unchecked_second(); |
9834 inline void set_second(String* second, | 9834 inline void set_second(String* second, |
9835 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9835 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
9836 | 9836 |
9837 // Dispatched behavior. | 9837 // Dispatched behavior. |
9838 uint16_t ConsStringGet(int index); | 9838 V8_EXPORT_PRIVATE uint16_t ConsStringGet(int index); |
9839 | 9839 |
9840 DECLARE_CAST(ConsString) | 9840 DECLARE_CAST(ConsString) |
9841 | 9841 |
9842 // Layout description. | 9842 // Layout description. |
9843 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize); | 9843 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize); |
9844 static const int kSecondOffset = kFirstOffset + kPointerSize; | 9844 static const int kSecondOffset = kFirstOffset + kPointerSize; |
9845 static const int kSize = kSecondOffset + kPointerSize; | 9845 static const int kSize = kSecondOffset + kPointerSize; |
9846 | 9846 |
9847 // Minimum length for a cons string. | 9847 // Minimum length for a cons string. |
9848 static const int kMinLength = 13; | 9848 static const int kMinLength = 13; |
(...skipping 22 matching lines...) Expand all Loading... |
9871 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. | 9871 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. |
9872 class SlicedString: public String { | 9872 class SlicedString: public String { |
9873 public: | 9873 public: |
9874 inline String* parent(); | 9874 inline String* parent(); |
9875 inline void set_parent(String* parent, | 9875 inline void set_parent(String* parent, |
9876 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9876 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
9877 inline int offset() const; | 9877 inline int offset() const; |
9878 inline void set_offset(int offset); | 9878 inline void set_offset(int offset); |
9879 | 9879 |
9880 // Dispatched behavior. | 9880 // Dispatched behavior. |
9881 uint16_t SlicedStringGet(int index); | 9881 V8_EXPORT_PRIVATE uint16_t SlicedStringGet(int index); |
9882 | 9882 |
9883 DECLARE_CAST(SlicedString) | 9883 DECLARE_CAST(SlicedString) |
9884 | 9884 |
9885 // Layout description. | 9885 // Layout description. |
9886 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); | 9886 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); |
9887 static const int kOffsetOffset = kParentOffset + kPointerSize; | 9887 static const int kOffsetOffset = kParentOffset + kPointerSize; |
9888 static const int kSize = kOffsetOffset + kPointerSize; | 9888 static const int kSize = kOffsetOffset + kPointerSize; |
9889 | 9889 |
9890 // Minimum length for a sliced string. | 9890 // Minimum length for a sliced string. |
9891 static const int kMinLength = 13; | 9891 static const int kMinLength = 13; |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11555 } | 11555 } |
11556 return value; | 11556 return value; |
11557 } | 11557 } |
11558 }; | 11558 }; |
11559 | 11559 |
11560 | 11560 |
11561 } // NOLINT, false-positive due to second-order macros. | 11561 } // NOLINT, false-positive due to second-order macros. |
11562 } // NOLINT, false-positive due to second-order macros. | 11562 } // NOLINT, false-positive due to second-order macros. |
11563 | 11563 |
11564 #endif // V8_OBJECTS_H_ | 11564 #endif // V8_OBJECTS_H_ |
OLD | NEW |