| 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 "allocation.h" | 8 #include "allocation.h" |
| 9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
| 10 #include "builtins.h" | 10 #include "builtins.h" |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE, | 801 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE, |
| 802 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, | 802 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, |
| 803 // Note that the types for which typeof is "function" are not continuous. | 803 // Note that the types for which typeof is "function" are not continuous. |
| 804 // Define this so that we can put assertions on discrete checks. | 804 // Define this so that we can put assertions on discrete checks. |
| 805 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 | 805 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 |
| 806 }; | 806 }; |
| 807 | 807 |
| 808 const int kExternalArrayTypeCount = | 808 const int kExternalArrayTypeCount = |
| 809 LAST_EXTERNAL_ARRAY_TYPE - FIRST_EXTERNAL_ARRAY_TYPE + 1; | 809 LAST_EXTERNAL_ARRAY_TYPE - FIRST_EXTERNAL_ARRAY_TYPE + 1; |
| 810 | 810 |
| 811 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); | 811 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 812 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 812 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
| 813 STATIC_CHECK(ODDBALL_TYPE == Internals::kOddballType); | 813 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
| 814 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); | 814 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
| 815 | 815 |
| 816 | 816 |
| 817 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ | 817 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ |
| 818 V(FAST_ELEMENTS_SUB_TYPE) \ | 818 V(FAST_ELEMENTS_SUB_TYPE) \ |
| 819 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ | 819 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ |
| 820 V(FAST_PROPERTIES_SUB_TYPE) \ | 820 V(FAST_PROPERTIES_SUB_TYPE) \ |
| 821 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ | 821 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ |
| 822 V(MAP_CODE_CACHE_SUB_TYPE) \ | 822 V(MAP_CODE_CACHE_SUB_TYPE) \ |
| 823 V(SCOPE_INFO_SUB_TYPE) \ | 823 V(SCOPE_INFO_SUB_TYPE) \ |
| 824 V(STRING_TABLE_SUB_TYPE) \ | 824 V(STRING_TABLE_SUB_TYPE) \ |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 // Verify a pointer is a valid HeapObject pointer that points to object | 1737 // Verify a pointer is a valid HeapObject pointer that points to object |
| 1738 // areas in the heap. | 1738 // areas in the heap. |
| 1739 static void VerifyHeapPointer(Object* p); | 1739 static void VerifyHeapPointer(Object* p); |
| 1740 #endif | 1740 #endif |
| 1741 | 1741 |
| 1742 // Layout description. | 1742 // Layout description. |
| 1743 // First field in a heap object is map. | 1743 // First field in a heap object is map. |
| 1744 static const int kMapOffset = Object::kHeaderSize; | 1744 static const int kMapOffset = Object::kHeaderSize; |
| 1745 static const int kHeaderSize = kMapOffset + kPointerSize; | 1745 static const int kHeaderSize = kMapOffset + kPointerSize; |
| 1746 | 1746 |
| 1747 STATIC_CHECK(kMapOffset == Internals::kHeapObjectMapOffset); | 1747 STATIC_ASSERT(kMapOffset == Internals::kHeapObjectMapOffset); |
| 1748 | 1748 |
| 1749 protected: | 1749 protected: |
| 1750 // helpers for calling an ObjectVisitor to iterate over pointers in the | 1750 // helpers for calling an ObjectVisitor to iterate over pointers in the |
| 1751 // half-open range [start, end) specified as integer offsets | 1751 // half-open range [start, end) specified as integer offsets |
| 1752 inline void IteratePointers(ObjectVisitor* v, int start, int end); | 1752 inline void IteratePointers(ObjectVisitor* v, int start, int end); |
| 1753 // as above, for the single element at "offset" | 1753 // as above, for the single element at "offset" |
| 1754 inline void IteratePointer(ObjectVisitor* v, int offset); | 1754 inline void IteratePointer(ObjectVisitor* v, int offset); |
| 1755 // as above, for the next code link of a code object. | 1755 // as above, for the next code link of a code object. |
| 1756 inline void IterateNextCodeLink(ObjectVisitor* v, int offset); | 1756 inline void IterateNextCodeLink(ObjectVisitor* v, int offset); |
| 1757 | 1757 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 // When extending the backing storage for property values, we increase | 2646 // When extending the backing storage for property values, we increase |
| 2647 // its size by more than the 1 entry necessary, so sequentially adding fields | 2647 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 2648 // to the same object requires fewer allocations and copies. | 2648 // to the same object requires fewer allocations and copies. |
| 2649 static const int kFieldsAdded = 3; | 2649 static const int kFieldsAdded = 3; |
| 2650 | 2650 |
| 2651 // Layout description. | 2651 // Layout description. |
| 2652 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 2652 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| 2653 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 2653 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
| 2654 static const int kHeaderSize = kElementsOffset + kPointerSize; | 2654 static const int kHeaderSize = kElementsOffset + kPointerSize; |
| 2655 | 2655 |
| 2656 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); | 2656 STATIC_ASSERT(kHeaderSize == Internals::kJSObjectHeaderSize); |
| 2657 | 2657 |
| 2658 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { | 2658 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { |
| 2659 public: | 2659 public: |
| 2660 static inline int SizeOf(Map* map, HeapObject* object); | 2660 static inline int SizeOf(Map* map, HeapObject* object); |
| 2661 }; | 2661 }; |
| 2662 | 2662 |
| 2663 Context* GetCreationContext(); | 2663 Context* GetCreationContext(); |
| 2664 | 2664 |
| 2665 // Enqueue change record for Object.observe. May cause GC. | 2665 // Enqueue change record for Object.observe. May cause GC. |
| 2666 static void EnqueueChangeRecord(Handle<JSObject> object, | 2666 static void EnqueueChangeRecord(Handle<JSObject> object, |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 Object* value); | 3028 Object* value); |
| 3029 | 3029 |
| 3030 // Set operation on FixedArray without incremental write barrier. Can | 3030 // Set operation on FixedArray without incremental write barrier. Can |
| 3031 // only be used if the object is guaranteed to be white (whiteness witness | 3031 // only be used if the object is guaranteed to be white (whiteness witness |
| 3032 // is present). | 3032 // is present). |
| 3033 static inline void NoIncrementalWriteBarrierSet(FixedArray* array, | 3033 static inline void NoIncrementalWriteBarrierSet(FixedArray* array, |
| 3034 int index, | 3034 int index, |
| 3035 Object* value); | 3035 Object* value); |
| 3036 | 3036 |
| 3037 private: | 3037 private: |
| 3038 STATIC_CHECK(kHeaderSize == Internals::kFixedArrayHeaderSize); | 3038 STATIC_ASSERT(kHeaderSize == Internals::kFixedArrayHeaderSize); |
| 3039 | 3039 |
| 3040 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 3040 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
| 3041 }; | 3041 }; |
| 3042 | 3042 |
| 3043 | 3043 |
| 3044 // FixedDoubleArray describes fixed-sized arrays with element type double. | 3044 // FixedDoubleArray describes fixed-sized arrays with element type double. |
| 3045 class FixedDoubleArray: public FixedArrayBase { | 3045 class FixedDoubleArray: public FixedArrayBase { |
| 3046 public: | 3046 public: |
| 3047 // Setter and getter for elements. | 3047 // Setter and getter for elements. |
| 3048 inline double get_scalar(int index); | 3048 inline double get_scalar(int index); |
| (...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6548 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 6548 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
| 6549 static const int kVisitorIdByte = 3; | 6549 static const int kVisitorIdByte = 3; |
| 6550 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; | 6550 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; |
| 6551 | 6551 |
| 6552 // Byte offsets within kInstanceAttributesOffset attributes. | 6552 // Byte offsets within kInstanceAttributesOffset attributes. |
| 6553 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; | 6553 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; |
| 6554 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; | 6554 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; |
| 6555 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; | 6555 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; |
| 6556 static const int kBitField2Offset = kInstanceAttributesOffset + 3; | 6556 static const int kBitField2Offset = kInstanceAttributesOffset + 3; |
| 6557 | 6557 |
| 6558 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); | 6558 STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); |
| 6559 | 6559 |
| 6560 // Bit positions for bit field. | 6560 // Bit positions for bit field. |
| 6561 static const int kHasNonInstancePrototype = 0; | 6561 static const int kHasNonInstancePrototype = 0; |
| 6562 static const int kIsHiddenPrototype = 1; | 6562 static const int kIsHiddenPrototype = 1; |
| 6563 static const int kHasNamedInterceptor = 2; | 6563 static const int kHasNamedInterceptor = 2; |
| 6564 static const int kHasIndexedInterceptor = 3; | 6564 static const int kHasIndexedInterceptor = 3; |
| 6565 static const int kIsUndetectable = 4; | 6565 static const int kIsUndetectable = 4; |
| 6566 static const int kIsObserved = 5; | 6566 static const int kIsObserved = 5; |
| 6567 static const int kIsAccessCheckNeeded = 6; | 6567 static const int kIsAccessCheckNeeded = 6; |
| 6568 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; | 6568 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; |
| (...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8777 // Array index strings this short can keep their index in the hash field. | 8777 // Array index strings this short can keep their index in the hash field. |
| 8778 static const int kMaxCachedArrayIndexLength = 7; | 8778 static const int kMaxCachedArrayIndexLength = 7; |
| 8779 | 8779 |
| 8780 // For strings which are array indexes the hash value has the string length | 8780 // For strings which are array indexes the hash value has the string length |
| 8781 // mixed into the hash, mainly to avoid a hash value of zero which would be | 8781 // mixed into the hash, mainly to avoid a hash value of zero which would be |
| 8782 // the case for the string '0'. 24 bits are used for the array index value. | 8782 // the case for the string '0'. 24 bits are used for the array index value. |
| 8783 static const int kArrayIndexValueBits = 24; | 8783 static const int kArrayIndexValueBits = 24; |
| 8784 static const int kArrayIndexLengthBits = | 8784 static const int kArrayIndexLengthBits = |
| 8785 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; | 8785 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; |
| 8786 | 8786 |
| 8787 STATIC_CHECK((kArrayIndexLengthBits > 0)); | 8787 STATIC_ASSERT((kArrayIndexLengthBits > 0)); |
| 8788 | 8788 |
| 8789 static const int kArrayIndexHashLengthShift = | 8789 static const int kArrayIndexHashLengthShift = |
| 8790 kArrayIndexValueBits + kNofHashBitFields; | 8790 kArrayIndexValueBits + kNofHashBitFields; |
| 8791 | 8791 |
| 8792 static const int kArrayIndexHashMask = (1 << kArrayIndexHashLengthShift) - 1; | 8792 static const int kArrayIndexHashMask = (1 << kArrayIndexHashLengthShift) - 1; |
| 8793 | 8793 |
| 8794 static const int kArrayIndexValueMask = | 8794 static const int kArrayIndexValueMask = |
| 8795 ((1 << kArrayIndexValueBits) - 1) << kHashShift; | 8795 ((1 << kArrayIndexValueBits) - 1) << kHashShift; |
| 8796 | 8796 |
| 8797 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we | 8797 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we |
| 8798 // could use a mask to test if the length of string is less than or equal to | 8798 // could use a mask to test if the length of string is less than or equal to |
| 8799 // kMaxCachedArrayIndexLength. | 8799 // kMaxCachedArrayIndexLength. |
| 8800 STATIC_CHECK(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 8800 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
| 8801 | 8801 |
| 8802 static const unsigned int kContainsCachedArrayIndexMask = | 8802 static const unsigned int kContainsCachedArrayIndexMask = |
| 8803 (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) | | 8803 (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) | |
| 8804 kIsNotArrayIndexMask; | 8804 kIsNotArrayIndexMask; |
| 8805 | 8805 |
| 8806 // Value of empty hash field indicating that the hash is not computed. | 8806 // Value of empty hash field indicating that the hash is not computed. |
| 8807 static const int kEmptyHashField = | 8807 static const int kEmptyHashField = |
| 8808 kIsNotArrayIndexMask | kHashNotComputedMask; | 8808 kIsNotArrayIndexMask | kHashNotComputedMask; |
| 8809 | 8809 |
| 8810 protected: | 8810 protected: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9039 | 9039 |
| 9040 inline bool IsFlat(); | 9040 inline bool IsFlat(); |
| 9041 | 9041 |
| 9042 // Layout description. | 9042 // Layout description. |
| 9043 static const int kLengthOffset = Name::kSize; | 9043 static const int kLengthOffset = Name::kSize; |
| 9044 static const int kSize = kLengthOffset + kPointerSize; | 9044 static const int kSize = kLengthOffset + kPointerSize; |
| 9045 | 9045 |
| 9046 // Maximum number of characters to consider when trying to convert a string | 9046 // Maximum number of characters to consider when trying to convert a string |
| 9047 // value into an array index. | 9047 // value into an array index. |
| 9048 static const int kMaxArrayIndexSize = 10; | 9048 static const int kMaxArrayIndexSize = 10; |
| 9049 STATIC_CHECK(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits)); | 9049 STATIC_ASSERT(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits)); |
| 9050 | 9050 |
| 9051 // Max char codes. | 9051 // Max char codes. |
| 9052 static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar; | 9052 static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar; |
| 9053 static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar; | 9053 static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar; |
| 9054 static const int kMaxUtf16CodeUnit = 0xffff; | 9054 static const int kMaxUtf16CodeUnit = 0xffff; |
| 9055 static const uint32_t kMaxUtf16CodeUnitU = kMaxUtf16CodeUnit; | 9055 static const uint32_t kMaxUtf16CodeUnitU = kMaxUtf16CodeUnit; |
| 9056 | 9056 |
| 9057 // Value of hash field containing computed hash equal to zero. | 9057 // Value of hash field containing computed hash equal to zero. |
| 9058 static const int kEmptyStringHash = kIsNotArrayIndexMask; | 9058 static const int kEmptyStringHash = kIsNotArrayIndexMask; |
| 9059 | 9059 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9197 // instance. | 9197 // instance. |
| 9198 inline int SeqOneByteStringSize(InstanceType instance_type); | 9198 inline int SeqOneByteStringSize(InstanceType instance_type); |
| 9199 | 9199 |
| 9200 // Computes the size for an AsciiString instance of a given length. | 9200 // Computes the size for an AsciiString instance of a given length. |
| 9201 static int SizeFor(int length) { | 9201 static int SizeFor(int length) { |
| 9202 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 9202 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
| 9203 } | 9203 } |
| 9204 | 9204 |
| 9205 // Maximal memory usage for a single sequential ASCII string. | 9205 // Maximal memory usage for a single sequential ASCII string. |
| 9206 static const int kMaxSize = 512 * MB - 1; | 9206 static const int kMaxSize = 512 * MB - 1; |
| 9207 STATIC_CHECK((kMaxSize - kHeaderSize) >= String::kMaxLength); | 9207 STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength); |
| 9208 | 9208 |
| 9209 private: | 9209 private: |
| 9210 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); | 9210 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); |
| 9211 }; | 9211 }; |
| 9212 | 9212 |
| 9213 | 9213 |
| 9214 // The TwoByteString class captures sequential unicode string objects. | 9214 // The TwoByteString class captures sequential unicode string objects. |
| 9215 // Each character in the TwoByteString is a two-byte uint16_t. | 9215 // Each character in the TwoByteString is a two-byte uint16_t. |
| 9216 class SeqTwoByteString: public SeqString { | 9216 class SeqTwoByteString: public SeqString { |
| 9217 public: | 9217 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 9237 // instance. | 9237 // instance. |
| 9238 inline int SeqTwoByteStringSize(InstanceType instance_type); | 9238 inline int SeqTwoByteStringSize(InstanceType instance_type); |
| 9239 | 9239 |
| 9240 // Computes the size for a TwoByteString instance of a given length. | 9240 // Computes the size for a TwoByteString instance of a given length. |
| 9241 static int SizeFor(int length) { | 9241 static int SizeFor(int length) { |
| 9242 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); | 9242 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); |
| 9243 } | 9243 } |
| 9244 | 9244 |
| 9245 // Maximal memory usage for a single sequential two-byte string. | 9245 // Maximal memory usage for a single sequential two-byte string. |
| 9246 static const int kMaxSize = 512 * MB - 1; | 9246 static const int kMaxSize = 512 * MB - 1; |
| 9247 STATIC_CHECK(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >= | 9247 STATIC_ASSERT(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >= |
| 9248 String::kMaxLength); | 9248 String::kMaxLength); |
| 9249 | 9249 |
| 9250 private: | 9250 private: |
| 9251 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); | 9251 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); |
| 9252 }; | 9252 }; |
| 9253 | 9253 |
| 9254 | 9254 |
| 9255 // The ConsString class describes string values built by using the | 9255 // The ConsString class describes string values built by using the |
| 9256 // addition operator on strings. A ConsString is a pair where the | 9256 // addition operator on strings. A ConsString is a pair where the |
| 9257 // first and second components are pointers to other string values. | 9257 // first and second components are pointers to other string values. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9366 static const int kShortSize = kResourceOffset + kPointerSize; | 9366 static const int kShortSize = kResourceOffset + kPointerSize; |
| 9367 static const int kResourceDataOffset = kResourceOffset + kPointerSize; | 9367 static const int kResourceDataOffset = kResourceOffset + kPointerSize; |
| 9368 static const int kSize = kResourceDataOffset + kPointerSize; | 9368 static const int kSize = kResourceDataOffset + kPointerSize; |
| 9369 | 9369 |
| 9370 static const int kMaxShortLength = | 9370 static const int kMaxShortLength = |
| 9371 (kShortSize - SeqString::kHeaderSize) / kCharSize; | 9371 (kShortSize - SeqString::kHeaderSize) / kCharSize; |
| 9372 | 9372 |
| 9373 // Return whether external string is short (data pointer is not cached). | 9373 // Return whether external string is short (data pointer is not cached). |
| 9374 inline bool is_short(); | 9374 inline bool is_short(); |
| 9375 | 9375 |
| 9376 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset); | 9376 STATIC_ASSERT(kResourceOffset == Internals::kStringResourceOffset); |
| 9377 | 9377 |
| 9378 private: | 9378 private: |
| 9379 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); | 9379 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); |
| 9380 }; | 9380 }; |
| 9381 | 9381 |
| 9382 | 9382 |
| 9383 // The ExternalAsciiString class is an external string backed by an | 9383 // The ExternalAsciiString class is an external string backed by an |
| 9384 // ASCII string. | 9384 // ASCII string. |
| 9385 class ExternalAsciiString: public ExternalString { | 9385 class ExternalAsciiString: public ExternalString { |
| 9386 public: | 9386 public: |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9636 static const byte kArgumentMarker = 4; | 9636 static const byte kArgumentMarker = 4; |
| 9637 static const byte kUndefined = 5; | 9637 static const byte kUndefined = 5; |
| 9638 static const byte kUninitialized = 6; | 9638 static const byte kUninitialized = 6; |
| 9639 static const byte kOther = 7; | 9639 static const byte kOther = 7; |
| 9640 static const byte kException = 8; | 9640 static const byte kException = 8; |
| 9641 | 9641 |
| 9642 typedef FixedBodyDescriptor<kToStringOffset, | 9642 typedef FixedBodyDescriptor<kToStringOffset, |
| 9643 kToNumberOffset + kPointerSize, | 9643 kToNumberOffset + kPointerSize, |
| 9644 kSize> BodyDescriptor; | 9644 kSize> BodyDescriptor; |
| 9645 | 9645 |
| 9646 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset); | 9646 STATIC_ASSERT(kKindOffset == Internals::kOddballKindOffset); |
| 9647 STATIC_CHECK(kNull == Internals::kNullOddballKind); | 9647 STATIC_ASSERT(kNull == Internals::kNullOddballKind); |
| 9648 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind); | 9648 STATIC_ASSERT(kUndefined == Internals::kUndefinedOddballKind); |
| 9649 | 9649 |
| 9650 private: | 9650 private: |
| 9651 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); | 9651 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); |
| 9652 }; | 9652 }; |
| 9653 | 9653 |
| 9654 | 9654 |
| 9655 class Cell: public HeapObject { | 9655 class Cell: public HeapObject { |
| 9656 public: | 9656 public: |
| 9657 // [value]: value of the global property. | 9657 // [value]: value of the global property. |
| 9658 DECL_ACCESSORS(value, Object) | 9658 DECL_ACCESSORS(value, Object) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9807 // Layout description. We add padding so that a proxy has the same | 9807 // Layout description. We add padding so that a proxy has the same |
| 9808 // size as a virgin JSObject. This is essential for becoming a JSObject | 9808 // size as a virgin JSObject. This is essential for becoming a JSObject |
| 9809 // upon freeze. | 9809 // upon freeze. |
| 9810 static const int kHandlerOffset = HeapObject::kHeaderSize; | 9810 static const int kHandlerOffset = HeapObject::kHeaderSize; |
| 9811 static const int kHashOffset = kHandlerOffset + kPointerSize; | 9811 static const int kHashOffset = kHandlerOffset + kPointerSize; |
| 9812 static const int kPaddingOffset = kHashOffset + kPointerSize; | 9812 static const int kPaddingOffset = kHashOffset + kPointerSize; |
| 9813 static const int kSize = JSObject::kHeaderSize; | 9813 static const int kSize = JSObject::kHeaderSize; |
| 9814 static const int kHeaderSize = kPaddingOffset; | 9814 static const int kHeaderSize = kPaddingOffset; |
| 9815 static const int kPaddingSize = kSize - kPaddingOffset; | 9815 static const int kPaddingSize = kSize - kPaddingOffset; |
| 9816 | 9816 |
| 9817 STATIC_CHECK(kPaddingSize >= 0); | 9817 STATIC_ASSERT(kPaddingSize >= 0); |
| 9818 | 9818 |
| 9819 typedef FixedBodyDescriptor<kHandlerOffset, | 9819 typedef FixedBodyDescriptor<kHandlerOffset, |
| 9820 kPaddingOffset, | 9820 kPaddingOffset, |
| 9821 kSize> BodyDescriptor; | 9821 kSize> BodyDescriptor; |
| 9822 | 9822 |
| 9823 private: | 9823 private: |
| 9824 friend class JSReceiver; | 9824 friend class JSReceiver; |
| 9825 | 9825 |
| 9826 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( | 9826 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( |
| 9827 Handle<JSProxy> proxy, | 9827 Handle<JSProxy> proxy, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9873 DECLARE_PRINTER(JSFunctionProxy) | 9873 DECLARE_PRINTER(JSFunctionProxy) |
| 9874 DECLARE_VERIFIER(JSFunctionProxy) | 9874 DECLARE_VERIFIER(JSFunctionProxy) |
| 9875 | 9875 |
| 9876 // Layout description. | 9876 // Layout description. |
| 9877 static const int kCallTrapOffset = JSProxy::kPaddingOffset; | 9877 static const int kCallTrapOffset = JSProxy::kPaddingOffset; |
| 9878 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize; | 9878 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize; |
| 9879 static const int kPaddingOffset = kConstructTrapOffset + kPointerSize; | 9879 static const int kPaddingOffset = kConstructTrapOffset + kPointerSize; |
| 9880 static const int kSize = JSFunction::kSize; | 9880 static const int kSize = JSFunction::kSize; |
| 9881 static const int kPaddingSize = kSize - kPaddingOffset; | 9881 static const int kPaddingSize = kSize - kPaddingOffset; |
| 9882 | 9882 |
| 9883 STATIC_CHECK(kPaddingSize >= 0); | 9883 STATIC_ASSERT(kPaddingSize >= 0); |
| 9884 | 9884 |
| 9885 typedef FixedBodyDescriptor<kHandlerOffset, | 9885 typedef FixedBodyDescriptor<kHandlerOffset, |
| 9886 kConstructTrapOffset + kPointerSize, | 9886 kConstructTrapOffset + kPointerSize, |
| 9887 kSize> BodyDescriptor; | 9887 kSize> BodyDescriptor; |
| 9888 | 9888 |
| 9889 private: | 9889 private: |
| 9890 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); | 9890 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); |
| 9891 }; | 9891 }; |
| 9892 | 9892 |
| 9893 | 9893 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10247 | 10247 |
| 10248 // Dispatched behavior. | 10248 // Dispatched behavior. |
| 10249 DECLARE_PRINTER(Foreign) | 10249 DECLARE_PRINTER(Foreign) |
| 10250 DECLARE_VERIFIER(Foreign) | 10250 DECLARE_VERIFIER(Foreign) |
| 10251 | 10251 |
| 10252 // Layout description. | 10252 // Layout description. |
| 10253 | 10253 |
| 10254 static const int kForeignAddressOffset = HeapObject::kHeaderSize; | 10254 static const int kForeignAddressOffset = HeapObject::kHeaderSize; |
| 10255 static const int kSize = kForeignAddressOffset + kPointerSize; | 10255 static const int kSize = kForeignAddressOffset + kPointerSize; |
| 10256 | 10256 |
| 10257 STATIC_CHECK(kForeignAddressOffset == Internals::kForeignAddressOffset); | 10257 STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset); |
| 10258 | 10258 |
| 10259 private: | 10259 private: |
| 10260 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); | 10260 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); |
| 10261 }; | 10261 }; |
| 10262 | 10262 |
| 10263 | 10263 |
| 10264 // The JSArray describes JavaScript Arrays | 10264 // The JSArray describes JavaScript Arrays |
| 10265 // Such an array can be in one of two modes: | 10265 // Such an array can be in one of two modes: |
| 10266 // - fast, backing storage is a FixedArray and length <= elements.length(); | 10266 // - fast, backing storage is a FixedArray and length <= elements.length(); |
| 10267 // Please note: push and pop can be used to grow and shrink the array. | 10267 // Please note: push and pop can be used to grow and shrink the array. |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11063 } else { | 11063 } else { |
| 11064 value &= ~(1 << bit_position); | 11064 value &= ~(1 << bit_position); |
| 11065 } | 11065 } |
| 11066 return value; | 11066 return value; |
| 11067 } | 11067 } |
| 11068 }; | 11068 }; |
| 11069 | 11069 |
| 11070 } } // namespace v8::internal | 11070 } } // namespace v8::internal |
| 11071 | 11071 |
| 11072 #endif // V8_OBJECTS_H_ | 11072 #endif // V8_OBJECTS_H_ |
| OLD | NEW |