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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // - InterceptorInfo | 137 // - InterceptorInfo |
138 // - CallHandlerInfo | 138 // - CallHandlerInfo |
139 // - TemplateInfo | 139 // - TemplateInfo |
140 // - FunctionTemplateInfo | 140 // - FunctionTemplateInfo |
141 // - ObjectTemplateInfo | 141 // - ObjectTemplateInfo |
142 // - Script | 142 // - Script |
143 // - TypeSwitchInfo | 143 // - TypeSwitchInfo |
144 // - DebugInfo | 144 // - DebugInfo |
145 // - BreakPointInfo | 145 // - BreakPointInfo |
146 // - CodeCache | 146 // - CodeCache |
| 147 // - PrototypeInfo |
147 // - WeakCell | 148 // - WeakCell |
148 // | 149 // |
149 // Formats of Object*: | 150 // Formats of Object*: |
150 // Smi: [31 bit signed int] 0 | 151 // Smi: [31 bit signed int] 0 |
151 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 152 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
152 | 153 |
153 namespace v8 { | 154 namespace v8 { |
154 namespace internal { | 155 namespace internal { |
155 | 156 |
156 enum KeyedAccessStoreMode { | 157 enum KeyedAccessStoreMode { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 V(SIGNATURE_INFO_TYPE) \ | 414 V(SIGNATURE_INFO_TYPE) \ |
414 V(TYPE_SWITCH_INFO_TYPE) \ | 415 V(TYPE_SWITCH_INFO_TYPE) \ |
415 V(ALLOCATION_MEMENTO_TYPE) \ | 416 V(ALLOCATION_MEMENTO_TYPE) \ |
416 V(ALLOCATION_SITE_TYPE) \ | 417 V(ALLOCATION_SITE_TYPE) \ |
417 V(SCRIPT_TYPE) \ | 418 V(SCRIPT_TYPE) \ |
418 V(CODE_CACHE_TYPE) \ | 419 V(CODE_CACHE_TYPE) \ |
419 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 420 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
420 V(TYPE_FEEDBACK_INFO_TYPE) \ | 421 V(TYPE_FEEDBACK_INFO_TYPE) \ |
421 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 422 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
422 V(BOX_TYPE) \ | 423 V(BOX_TYPE) \ |
| 424 V(PROTOTYPE_INFO_TYPE) \ |
423 \ | 425 \ |
424 V(FIXED_ARRAY_TYPE) \ | 426 V(FIXED_ARRAY_TYPE) \ |
425 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 427 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
426 V(CONSTANT_POOL_ARRAY_TYPE) \ | 428 V(CONSTANT_POOL_ARRAY_TYPE) \ |
427 V(SHARED_FUNCTION_INFO_TYPE) \ | 429 V(SHARED_FUNCTION_INFO_TYPE) \ |
428 V(WEAK_CELL_TYPE) \ | 430 V(WEAK_CELL_TYPE) \ |
429 \ | 431 \ |
430 V(JS_MESSAGE_OBJECT_TYPE) \ | 432 V(JS_MESSAGE_OBJECT_TYPE) \ |
431 \ | 433 \ |
432 V(JS_VALUE_TYPE) \ | 434 V(JS_VALUE_TYPE) \ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 512 |
511 // A struct is a simple object a set of object-valued fields. Including an | 513 // A struct is a simple object a set of object-valued fields. Including an |
512 // object type in this causes the compiler to generate most of the boilerplate | 514 // object type in this causes the compiler to generate most of the boilerplate |
513 // code for the class including allocation and garbage collection routines, | 515 // code for the class including allocation and garbage collection routines, |
514 // casts and predicates. All you need to define is the class, methods and | 516 // casts and predicates. All you need to define is the class, methods and |
515 // object verification routines. Easy, no? | 517 // object verification routines. Easy, no? |
516 // | 518 // |
517 // Note that for subtle reasons related to the ordering or numerical values of | 519 // Note that for subtle reasons related to the ordering or numerical values of |
518 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 520 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
519 // manually. | 521 // manually. |
520 #define STRUCT_LIST(V) \ | 522 #define STRUCT_LIST(V) \ |
521 V(BOX, Box, box) \ | 523 V(BOX, Box, box) \ |
522 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ | 524 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, \ |
523 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 525 executable_accessor_info) \ |
524 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 526 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
525 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 527 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
526 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 528 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
527 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 529 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
528 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 530 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
529 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 531 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
530 V(SCRIPT, Script, script) \ | 532 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
531 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 533 V(SCRIPT, Script, script) \ |
532 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 534 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
533 V(CODE_CACHE, CodeCache, code_cache) \ | 535 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
534 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ | 536 V(CODE_CACHE, CodeCache, code_cache) \ |
535 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 537 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
536 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 538 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
537 V(DEBUG_INFO, DebugInfo, debug_info) \ | 539 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
538 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 540 V(DEBUG_INFO, DebugInfo, debug_info) \ |
| 541 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
| 542 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) |
539 | 543 |
540 // We use the full 8 bits of the instance_type field to encode heap object | 544 // We use the full 8 bits of the instance_type field to encode heap object |
541 // instance types. The high-order bit (bit 7) is set if the object is not a | 545 // instance types. The high-order bit (bit 7) is set if the object is not a |
542 // string, and cleared if it is a string. | 546 // string, and cleared if it is a string. |
543 const uint32_t kIsNotStringMask = 0x80; | 547 const uint32_t kIsNotStringMask = 0x80; |
544 const uint32_t kStringTag = 0x0; | 548 const uint32_t kStringTag = 0x0; |
545 const uint32_t kNotStringTag = 0x80; | 549 const uint32_t kNotStringTag = 0x80; |
546 | 550 |
547 // Bit 6 indicates that the object is an internalized string (if set) or not. | 551 // Bit 6 indicates that the object is an internalized string (if set) or not. |
548 // Bit 7 has to be clear as well. | 552 // Bit 7 has to be clear as well. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 TYPE_FEEDBACK_INFO_TYPE, | 715 TYPE_FEEDBACK_INFO_TYPE, |
712 ALIASED_ARGUMENTS_ENTRY_TYPE, | 716 ALIASED_ARGUMENTS_ENTRY_TYPE, |
713 BOX_TYPE, | 717 BOX_TYPE, |
714 DEBUG_INFO_TYPE, | 718 DEBUG_INFO_TYPE, |
715 BREAK_POINT_INFO_TYPE, | 719 BREAK_POINT_INFO_TYPE, |
716 FIXED_ARRAY_TYPE, | 720 FIXED_ARRAY_TYPE, |
717 CONSTANT_POOL_ARRAY_TYPE, | 721 CONSTANT_POOL_ARRAY_TYPE, |
718 SHARED_FUNCTION_INFO_TYPE, | 722 SHARED_FUNCTION_INFO_TYPE, |
719 WEAK_CELL_TYPE, | 723 WEAK_CELL_TYPE, |
720 PROPERTY_CELL_TYPE, | 724 PROPERTY_CELL_TYPE, |
| 725 PROTOTYPE_INFO_TYPE, |
721 | 726 |
722 // All the following types are subtypes of JSReceiver, which corresponds to | 727 // All the following types are subtypes of JSReceiver, which corresponds to |
723 // objects in the JS sense. The first and the last type in this range are | 728 // objects in the JS sense. The first and the last type in this range are |
724 // the two forms of function. This organization enables using the same | 729 // the two forms of function. This organization enables using the same |
725 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 730 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
726 // NONCALLABLE_JS_OBJECT range. | 731 // NONCALLABLE_JS_OBJECT range. |
727 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 732 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
728 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 733 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
729 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 734 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
730 JS_MESSAGE_OBJECT_TYPE, | 735 JS_MESSAGE_OBJECT_TYPE, |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 // Returns the number of enumerable elements. | 2047 // Returns the number of enumerable elements. |
2043 int GetEnumElementKeys(FixedArray* storage); | 2048 int GetEnumElementKeys(FixedArray* storage); |
2044 | 2049 |
2045 // Returns a new map with all transitions dropped from the object's current | 2050 // Returns a new map with all transitions dropped from the object's current |
2046 // map and the ElementsKind set. | 2051 // map and the ElementsKind set. |
2047 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, | 2052 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
2048 ElementsKind to_kind); | 2053 ElementsKind to_kind); |
2049 static void TransitionElementsKind(Handle<JSObject> object, | 2054 static void TransitionElementsKind(Handle<JSObject> object, |
2050 ElementsKind to_kind); | 2055 ElementsKind to_kind); |
2051 | 2056 |
2052 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2057 // Always use this to migrate an object to a new map. |
| 2058 // |expected_additional_properties| is only used for fast-to-slow transitions |
| 2059 // and ignored otherwise. |
| 2060 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map, |
| 2061 int expected_additional_properties = 0); |
2053 | 2062 |
2054 // Convert the object to use the canonical dictionary | 2063 // Convert the object to use the canonical dictionary |
2055 // representation. If the object is expected to have additional properties | 2064 // representation. If the object is expected to have additional properties |
2056 // added this number can be indicated to have the backing store allocated to | 2065 // added this number can be indicated to have the backing store allocated to |
2057 // an initial capacity for holding these properties. | 2066 // an initial capacity for holding these properties. |
2058 static void NormalizeProperties(Handle<JSObject> object, | 2067 static void NormalizeProperties(Handle<JSObject> object, |
2059 PropertyNormalizationMode mode, | 2068 PropertyNormalizationMode mode, |
2060 int expected_additional_properties, | 2069 int expected_additional_properties, |
2061 const char* reason); | 2070 const char* reason); |
2062 | 2071 |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. | 2605 // If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated. |
2597 static Handle<WeakFixedArray> Add( | 2606 static Handle<WeakFixedArray> Add( |
2598 Handle<Object> maybe_array, Handle<HeapObject> value, | 2607 Handle<Object> maybe_array, Handle<HeapObject> value, |
2599 SearchForDuplicates search_for_duplicates = kAlwaysAdd); | 2608 SearchForDuplicates search_for_duplicates = kAlwaysAdd); |
2600 | 2609 |
2601 void Remove(Handle<HeapObject> value); | 2610 void Remove(Handle<HeapObject> value); |
2602 | 2611 |
2603 inline Object* Get(int index) const; | 2612 inline Object* Get(int index) const; |
2604 inline int Length() const; | 2613 inline int Length() const; |
2605 | 2614 |
| 2615 static Object* Empty() { return Smi::FromInt(0); } |
| 2616 |
2606 DECLARE_CAST(WeakFixedArray) | 2617 DECLARE_CAST(WeakFixedArray) |
2607 | 2618 |
2608 private: | 2619 private: |
2609 static const int kLastUsedIndexIndex = 0; | 2620 static const int kLastUsedIndexIndex = 0; |
2610 static const int kFirstIndex = 1; | 2621 static const int kFirstIndex = 1; |
2611 | 2622 |
2612 static Handle<WeakFixedArray> Allocate( | 2623 static Handle<WeakFixedArray> Allocate( |
2613 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); | 2624 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); |
2614 | 2625 |
2615 static void Set(Handle<WeakFixedArray> array, int index, | 2626 static void Set(Handle<WeakFixedArray> array, int index, |
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5789 // Instance type. | 5800 // Instance type. |
5790 inline InstanceType instance_type(); | 5801 inline InstanceType instance_type(); |
5791 inline void set_instance_type(InstanceType value); | 5802 inline void set_instance_type(InstanceType value); |
5792 | 5803 |
5793 // Tells how many unused property fields are available in the | 5804 // Tells how many unused property fields are available in the |
5794 // instance (only used for JSObject in fast mode). | 5805 // instance (only used for JSObject in fast mode). |
5795 inline int unused_property_fields(); | 5806 inline int unused_property_fields(); |
5796 inline void set_unused_property_fields(int value); | 5807 inline void set_unused_property_fields(int value); |
5797 | 5808 |
5798 // Bit field. | 5809 // Bit field. |
5799 inline byte bit_field(); | 5810 inline byte bit_field() const; |
5800 inline void set_bit_field(byte value); | 5811 inline void set_bit_field(byte value); |
5801 | 5812 |
5802 // Bit field 2. | 5813 // Bit field 2. |
5803 inline byte bit_field2(); | 5814 inline byte bit_field2() const; |
5804 inline void set_bit_field2(byte value); | 5815 inline void set_bit_field2(byte value); |
5805 | 5816 |
5806 // Bit field 3. | 5817 // Bit field 3. |
5807 inline uint32_t bit_field3(); | 5818 inline uint32_t bit_field3() const; |
5808 inline void set_bit_field3(uint32_t bits); | 5819 inline void set_bit_field3(uint32_t bits); |
5809 | 5820 |
5810 class EnumLengthBits: public BitField<int, | 5821 class EnumLengthBits: public BitField<int, |
5811 0, kDescriptorIndexBitCount> {}; // NOLINT | 5822 0, kDescriptorIndexBitCount> {}; // NOLINT |
5812 class NumberOfOwnDescriptorsBits: public BitField<int, | 5823 class NumberOfOwnDescriptorsBits: public BitField<int, |
5813 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT | 5824 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT |
5814 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20); | 5825 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20); |
5815 class DictionaryMap : public BitField<bool, 20, 1> {}; | 5826 class DictionaryMap : public BitField<bool, 20, 1> {}; |
5816 class OwnsDescriptors : public BitField<bool, 21, 1> {}; | 5827 class OwnsDescriptors : public BitField<bool, 21, 1> {}; |
5817 class HasInstanceCallHandler : public BitField<bool, 22, 1> {}; | 5828 class HasInstanceCallHandler : public BitField<bool, 22, 1> {}; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5892 set_bit_field(bit_field() | (1 << kIsObserved)); | 5903 set_bit_field(bit_field() | (1 << kIsObserved)); |
5893 } | 5904 } |
5894 | 5905 |
5895 inline bool is_observed() { | 5906 inline bool is_observed() { |
5896 return ((1 << kIsObserved) & bit_field()) != 0; | 5907 return ((1 << kIsObserved) & bit_field()) != 0; |
5897 } | 5908 } |
5898 | 5909 |
5899 inline void set_is_extensible(bool value); | 5910 inline void set_is_extensible(bool value); |
5900 inline bool is_extensible(); | 5911 inline bool is_extensible(); |
5901 inline void set_is_prototype_map(bool value); | 5912 inline void set_is_prototype_map(bool value); |
5902 inline bool is_prototype_map(); | 5913 inline bool is_prototype_map() const; |
5903 | 5914 |
5904 inline void set_elements_kind(ElementsKind elements_kind) { | 5915 inline void set_elements_kind(ElementsKind elements_kind) { |
5905 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount); | 5916 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount); |
5906 DCHECK(kElementsKindCount <= (1 << Map::ElementsKindBits::kSize)); | 5917 DCHECK(kElementsKindCount <= (1 << Map::ElementsKindBits::kSize)); |
5907 set_bit_field2(Map::ElementsKindBits::update(bit_field2(), elements_kind)); | 5918 set_bit_field2(Map::ElementsKindBits::update(bit_field2(), elements_kind)); |
5908 DCHECK(this->elements_kind() == elements_kind); | 5919 DCHECK(this->elements_kind() == elements_kind); |
5909 } | 5920 } |
5910 | 5921 |
5911 inline ElementsKind elements_kind() { | 5922 inline ElementsKind elements_kind() { |
5912 return Map::ElementsKindBits::decode(bit_field2()); | 5923 return Map::ElementsKindBits::decode(bit_field2()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 bool DictionaryElementsInPrototypeChainOnly(); | 5974 bool DictionaryElementsInPrototypeChainOnly(); |
5964 | 5975 |
5965 inline Map* ElementsTransitionMap(); | 5976 inline Map* ElementsTransitionMap(); |
5966 | 5977 |
5967 inline FixedArrayBase* GetInitialElements(); | 5978 inline FixedArrayBase* GetInitialElements(); |
5968 | 5979 |
5969 // [raw_transitions]: Provides access to the transitions storage field. | 5980 // [raw_transitions]: Provides access to the transitions storage field. |
5970 // Don't call set_raw_transitions() directly to overwrite transitions, use | 5981 // Don't call set_raw_transitions() directly to overwrite transitions, use |
5971 // the TransitionArray::ReplaceTransitions() wrapper instead! | 5982 // the TransitionArray::ReplaceTransitions() wrapper instead! |
5972 DECL_ACCESSORS(raw_transitions, Object) | 5983 DECL_ACCESSORS(raw_transitions, Object) |
| 5984 // [prototype_info]: Per-prototype metadata. Aliased with transitions |
| 5985 // (which prototype maps don't have). |
| 5986 DECL_ACCESSORS(prototype_info, Object) |
5973 | 5987 |
5974 Map* FindRootMap(); | 5988 Map* FindRootMap(); |
5975 Map* FindFieldOwner(int descriptor); | 5989 Map* FindFieldOwner(int descriptor); |
5976 | 5990 |
5977 inline int GetInObjectPropertyOffset(int index); | 5991 inline int GetInObjectPropertyOffset(int index); |
5978 | 5992 |
5979 int NumberOfFields(); | 5993 int NumberOfFields(); |
5980 | 5994 |
5981 // TODO(ishell): candidate with JSObject::MigrateToMap(). | 5995 // TODO(ishell): candidate with JSObject::MigrateToMap(). |
5982 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, | 5996 bool InstancesNeedRewriting(Map* target, int target_number_of_fields, |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6321 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 6335 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
6322 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 6336 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
6323 static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize; | 6337 static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize; |
6324 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; | 6338 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; |
6325 static const int kConstructorOrBackPointerOffset = | 6339 static const int kConstructorOrBackPointerOffset = |
6326 kPrototypeOffset + kPointerSize; | 6340 kPrototypeOffset + kPointerSize; |
6327 // When there is only one transition, it is stored directly in this field; | 6341 // When there is only one transition, it is stored directly in this field; |
6328 // otherwise a transition array is used. | 6342 // otherwise a transition array is used. |
6329 // For prototype maps, this slot is used to store a pointer to the prototype | 6343 // For prototype maps, this slot is used to store a pointer to the prototype |
6330 // object using this map. | 6344 // object using this map. |
6331 static const int kTransitionsOffset = | 6345 static const int kTransitionsOrPrototypeInfoOffset = |
6332 kConstructorOrBackPointerOffset + kPointerSize; | 6346 kConstructorOrBackPointerOffset + kPointerSize; |
6333 static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize; | 6347 static const int kDescriptorsOffset = |
| 6348 kTransitionsOrPrototypeInfoOffset + kPointerSize; |
6334 #if V8_DOUBLE_FIELDS_UNBOXING | 6349 #if V8_DOUBLE_FIELDS_UNBOXING |
6335 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; | 6350 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; |
6336 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; | 6351 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; |
6337 #else | 6352 #else |
6338 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed. | 6353 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed. |
6339 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; | 6354 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; |
6340 #endif | 6355 #endif |
6341 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; | 6356 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; |
6342 static const int kWeakCellCacheOffset = kDependentCodeOffset + kPointerSize; | 6357 static const int kWeakCellCacheOffset = kDependentCodeOffset + kPointerSize; |
6343 static const int kSize = kWeakCellCacheOffset + kPointerSize; | 6358 static const int kSize = kWeakCellCacheOffset + kPointerSize; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6528 DECLARE_VERIFIER(Box) | 6543 DECLARE_VERIFIER(Box) |
6529 | 6544 |
6530 static const int kValueOffset = HeapObject::kHeaderSize; | 6545 static const int kValueOffset = HeapObject::kHeaderSize; |
6531 static const int kSize = kValueOffset + kPointerSize; | 6546 static const int kSize = kValueOffset + kPointerSize; |
6532 | 6547 |
6533 private: | 6548 private: |
6534 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); | 6549 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); |
6535 }; | 6550 }; |
6536 | 6551 |
6537 | 6552 |
| 6553 // Container for metadata stored on each prototype map. |
| 6554 class PrototypeInfo : public Struct { |
| 6555 public: |
| 6556 // [prototype_users]: WeakFixedArray containing maps using this prototype, |
| 6557 // or Smi(0) if uninitialized. |
| 6558 DECL_ACCESSORS(prototype_users, Object) |
| 6559 // [validity_cell]: Cell containing the validity bit for prototype chains |
| 6560 // going through this object, or Smi(0) if uninitialized. |
| 6561 DECL_ACCESSORS(validity_cell, Object) |
| 6562 |
| 6563 DECLARE_CAST(PrototypeInfo) |
| 6564 |
| 6565 // Dispatched behavior. |
| 6566 DECLARE_PRINTER(PrototypeInfo) |
| 6567 DECLARE_VERIFIER(PrototypeInfo) |
| 6568 |
| 6569 static const int kPrototypeObjectOffset = HeapObject::kHeaderSize; |
| 6570 static const int kPrototypeUsersOffset = |
| 6571 kPrototypeObjectOffset + kPointerSize; |
| 6572 static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize; |
| 6573 static const int kSize = kValidityCellOffset + kPointerSize; |
| 6574 |
| 6575 private: |
| 6576 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); |
| 6577 }; |
| 6578 |
| 6579 |
6538 // Script describes a script which has been added to the VM. | 6580 // Script describes a script which has been added to the VM. |
6539 class Script: public Struct { | 6581 class Script: public Struct { |
6540 public: | 6582 public: |
6541 // Script types. | 6583 // Script types. |
6542 enum Type { | 6584 enum Type { |
6543 TYPE_NATIVE = 0, | 6585 TYPE_NATIVE = 0, |
6544 TYPE_EXTENSION = 1, | 6586 TYPE_EXTENSION = 1, |
6545 TYPE_NORMAL = 2 | 6587 TYPE_NORMAL = 2 |
6546 }; | 6588 }; |
6547 | 6589 |
(...skipping 4447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10995 } else { | 11037 } else { |
10996 value &= ~(1 << bit_position); | 11038 value &= ~(1 << bit_position); |
10997 } | 11039 } |
10998 return value; | 11040 return value; |
10999 } | 11041 } |
11000 }; | 11042 }; |
11001 | 11043 |
11002 } } // namespace v8::internal | 11044 } } // namespace v8::internal |
11003 | 11045 |
11004 #endif // V8_OBJECTS_H_ | 11046 #endif // V8_OBJECTS_H_ |
OLD | NEW |