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