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 5941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5952 // Bit field 3. | 5952 // Bit field 3. |
5953 inline uint32_t bit_field3(); | 5953 inline uint32_t bit_field3(); |
5954 inline void set_bit_field3(uint32_t bits); | 5954 inline void set_bit_field3(uint32_t bits); |
5955 | 5955 |
5956 class EnumLengthBits: public BitField<int, | 5956 class EnumLengthBits: public BitField<int, |
5957 0, kDescriptorIndexBitCount> {}; // NOLINT | 5957 0, kDescriptorIndexBitCount> {}; // NOLINT |
5958 class NumberOfOwnDescriptorsBits: public BitField<int, | 5958 class NumberOfOwnDescriptorsBits: public BitField<int, |
5959 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT | 5959 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT |
5960 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20); | 5960 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20); |
5961 class IsShared: public BitField<bool, 20, 1> {}; | 5961 class IsShared: public BitField<bool, 20, 1> {}; |
5962 class DictionaryMap: public BitField<bool, 21, 1> {}; | 5962 class FunctionWithPrototype: public BitField<bool, 21, 1> {}; |
5963 class OwnsDescriptors: public BitField<bool, 22, 1> {}; | 5963 class DictionaryMap: public BitField<bool, 22, 1> {}; |
5964 class HasInstanceCallHandler: public BitField<bool, 23, 1> {}; | 5964 class OwnsDescriptors: public BitField<bool, 23, 1> {}; |
5965 class Deprecated: public BitField<bool, 24, 1> {}; | 5965 class HasInstanceCallHandler: public BitField<bool, 24, 1> {}; |
5966 class IsFrozen: public BitField<bool, 25, 1> {}; | 5966 class Deprecated: public BitField<bool, 25, 1> {}; |
5967 class IsUnstable: public BitField<bool, 26, 1> {}; | 5967 class IsFrozen: public BitField<bool, 26, 1> {}; |
5968 class IsMigrationTarget: public BitField<bool, 27, 1> {}; | 5968 class IsUnstable: public BitField<bool, 27, 1> {}; |
| 5969 class IsMigrationTarget: public BitField<bool, 28, 1> {}; |
5969 | 5970 |
5970 // Tells whether the object in the prototype property will be used | 5971 // Tells whether the object in the prototype property will be used |
5971 // for instances created from this function. If the prototype | 5972 // for instances created from this function. If the prototype |
5972 // property is set to a value that is not a JSObject, the prototype | 5973 // property is set to a value that is not a JSObject, the prototype |
5973 // property will not be used to create instances of the function. | 5974 // property will not be used to create instances of the function. |
5974 // See ECMA-262, 13.2.2. | 5975 // See ECMA-262, 13.2.2. |
5975 inline void set_non_instance_prototype(bool value); | 5976 inline void set_non_instance_prototype(bool value); |
5976 inline bool has_non_instance_prototype(); | 5977 inline bool has_non_instance_prototype(); |
5977 | 5978 |
5978 // Tells whether function has special prototype property. If not, prototype | 5979 // Tells whether function has special prototype property. If not, prototype |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6473 // and the values are the maps the are transitioned to. | 6474 // and the values are the maps the are transitioned to. |
6474 static const int kMaxCachedPrototypeTransitions = 256; | 6475 static const int kMaxCachedPrototypeTransitions = 256; |
6475 static Handle<Map> TransitionToPrototype(Handle<Map> map, | 6476 static Handle<Map> TransitionToPrototype(Handle<Map> map, |
6476 Handle<Object> prototype); | 6477 Handle<Object> prototype); |
6477 | 6478 |
6478 static const int kMaxPreAllocatedPropertyFields = 255; | 6479 static const int kMaxPreAllocatedPropertyFields = 255; |
6479 | 6480 |
6480 // Layout description. | 6481 // Layout description. |
6481 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 6482 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
6482 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 6483 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
6483 static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize; | 6484 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
6484 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; | |
6485 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 6485 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; |
6486 // Storage for the transition array is overloaded to directly contain a back | 6486 // Storage for the transition array is overloaded to directly contain a back |
6487 // pointer if unused. When the map has transitions, the back pointer is | 6487 // pointer if unused. When the map has transitions, the back pointer is |
6488 // transferred to the transition array and accessed through an extra | 6488 // transferred to the transition array and accessed through an extra |
6489 // indirection. | 6489 // indirection. |
6490 static const int kTransitionsOrBackPointerOffset = | 6490 static const int kTransitionsOrBackPointerOffset = |
6491 kConstructorOffset + kPointerSize; | 6491 kConstructorOffset + kPointerSize; |
6492 static const int kDescriptorsOffset = | 6492 static const int kDescriptorsOffset = |
6493 kTransitionsOrBackPointerOffset + kPointerSize; | 6493 kTransitionsOrBackPointerOffset + kPointerSize; |
6494 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; | 6494 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; |
6495 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; | 6495 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; |
6496 static const int kSize = kDependentCodeOffset + kPointerSize; | 6496 static const int kBitField3Offset = kDependentCodeOffset + kPointerSize; |
| 6497 static const int kSize = kBitField3Offset + kPointerSize; |
6497 | 6498 |
6498 // Layout of pointer fields. Heap iteration code relies on them | 6499 // Layout of pointer fields. Heap iteration code relies on them |
6499 // being continuously allocated. | 6500 // being continuously allocated. |
6500 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 6501 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
6501 static const int kPointerFieldsEndOffset = kSize; | 6502 static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize; |
6502 | 6503 |
6503 // Byte offsets within kInstanceSizesOffset. | 6504 // Byte offsets within kInstanceSizesOffset. |
6504 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 6505 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
6505 static const int kInObjectPropertiesByte = 1; | 6506 static const int kInObjectPropertiesByte = 1; |
6506 static const int kInObjectPropertiesOffset = | 6507 static const int kInObjectPropertiesOffset = |
6507 kInstanceSizesOffset + kInObjectPropertiesByte; | 6508 kInstanceSizesOffset + kInObjectPropertiesByte; |
6508 static const int kPreAllocatedPropertyFieldsByte = 2; | 6509 static const int kPreAllocatedPropertyFieldsByte = 2; |
6509 static const int kPreAllocatedPropertyFieldsOffset = | 6510 static const int kPreAllocatedPropertyFieldsOffset = |
6510 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 6511 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
6511 static const int kVisitorIdByte = 3; | 6512 static const int kVisitorIdByte = 3; |
6512 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; | 6513 static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte; |
6513 | 6514 |
6514 // Byte offsets within kInstanceAttributesOffset attributes. | 6515 // Byte offsets within kInstanceAttributesOffset attributes. |
6515 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; | 6516 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; |
6516 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; | 6517 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1; |
6517 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; | 6518 static const int kBitFieldOffset = kInstanceAttributesOffset + 2; |
6518 static const int kBitField2Offset = kInstanceAttributesOffset + 3; | 6519 static const int kBitField2Offset = kInstanceAttributesOffset + 3; |
6519 | 6520 |
6520 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); | 6521 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); |
6521 | 6522 |
6522 // Bit positions for bit field. | 6523 // Bit positions for bit field. |
6523 static const int kHasNonInstancePrototype = 0; | 6524 static const int kUnused = 0; // To be used for marking recently used maps. |
6524 static const int kIsHiddenPrototype = 1; | 6525 static const int kHasNonInstancePrototype = 1; |
6525 static const int kHasNamedInterceptor = 2; | 6526 static const int kIsHiddenPrototype = 2; |
6526 static const int kHasIndexedInterceptor = 3; | 6527 static const int kHasNamedInterceptor = 3; |
6527 static const int kIsUndetectable = 4; | 6528 static const int kHasIndexedInterceptor = 4; |
6528 static const int kIsObserved = 5; | 6529 static const int kIsUndetectable = 5; |
6529 static const int kIsAccessCheckNeeded = 6; | 6530 static const int kIsObserved = 6; |
6530 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; | 6531 static const int kIsAccessCheckNeeded = 7; |
6531 | 6532 |
6532 // Bit positions for bit field 2 | 6533 // Bit positions for bit field 2 |
6533 static const int kIsExtensible = 0; | 6534 static const int kIsExtensible = 0; |
6534 static const int kStringWrapperSafeForDefaultValueOf = 1; | 6535 static const int kStringWrapperSafeForDefaultValueOf = 1; |
6535 static const int kAttachedToSharedFunctionInfo = 2; | 6536 static const int kAttachedToSharedFunctionInfo = 2; |
6536 // No bits can be used after kElementsKindFirstBit, they are all reserved for | 6537 // No bits can be used after kElementsKindFirstBit, they are all reserved for |
6537 // storing ElementKind. | 6538 // storing ElementKind. |
6538 static const int kElementsKindShift = 3; | 6539 static const int kElementsKindShift = 3; |
6539 static const int kElementsKindBitCount = 5; | 6540 static const int kElementsKindBitCount = 5; |
6540 | 6541 |
(...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11119 } else { | 11120 } else { |
11120 value &= ~(1 << bit_position); | 11121 value &= ~(1 << bit_position); |
11121 } | 11122 } |
11122 return value; | 11123 return value; |
11123 } | 11124 } |
11124 }; | 11125 }; |
11125 | 11126 |
11126 } } // namespace v8::internal | 11127 } } // namespace v8::internal |
11127 | 11128 |
11128 #endif // V8_OBJECTS_H_ | 11129 #endif // V8_OBJECTS_H_ |
OLD | NEW |