Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 706c06496fef1313552ecea4387cf3970db95eea..2fe600d5236e0cc0c898649e8ce520096db431b0 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -144,6 +144,7 @@ |
| // - DebugInfo |
| // - BreakPointInfo |
| // - CodeCache |
| +// - PrototypeInfo |
| // - WeakCell |
| // |
| // Formats of Object*: |
| @@ -420,6 +421,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
| V(TYPE_FEEDBACK_INFO_TYPE) \ |
| V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| V(BOX_TYPE) \ |
| + V(PROTOTYPE_INFO_TYPE) \ |
| \ |
| V(FIXED_ARRAY_TYPE) \ |
| V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| @@ -517,25 +519,27 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
| // Note that for subtle reasons related to the ordering or numerical values of |
| // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
| // manually. |
| -#define STRUCT_LIST(V) \ |
| - V(BOX, Box, box) \ |
| - V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ |
| - V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
| - V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
| - V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
| - V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
| - V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| - V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| - V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
| - V(SCRIPT, Script, script) \ |
| - V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
| - V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
| - V(CODE_CACHE, CodeCache, code_cache) \ |
| - V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
| - V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
| - V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
| - V(DEBUG_INFO, DebugInfo, debug_info) \ |
| - V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
| +#define STRUCT_LIST(V) \ |
|
Jakob Kummerow
2015/03/24 10:40:14
clang-format...
|
| + V(BOX, Box, box) \ |
| + V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, \ |
| + executable_accessor_info) \ |
| + V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
| + V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
| + V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
| + V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
| + V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| + V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| + V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
| + V(SCRIPT, Script, script) \ |
| + V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
| + V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
| + V(CODE_CACHE, CodeCache, code_cache) \ |
| + V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
| + V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
| + V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
| + V(DEBUG_INFO, DebugInfo, debug_info) \ |
| + V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
| + V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) |
| // We use the full 8 bits of the instance_type field to encode heap object |
| // instance types. The high-order bit (bit 7) is set if the object is not a |
| @@ -718,6 +722,7 @@ enum InstanceType { |
| SHARED_FUNCTION_INFO_TYPE, |
| WEAK_CELL_TYPE, |
| PROPERTY_CELL_TYPE, |
| + PROTOTYPE_INFO_TYPE, |
| // All the following types are subtypes of JSReceiver, which corresponds to |
| // objects in the JS sense. The first and the last type in this range are |
| @@ -2049,7 +2054,11 @@ class JSObject: public JSReceiver { |
| static void TransitionElementsKind(Handle<JSObject> object, |
| ElementsKind to_kind); |
| - static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
| + // Always use this to migrate an object to a new map. |
| + // |expected_additional_properties| is only used for fast-to-slow transitions |
| + // and ignored otherwise. |
| + static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map, |
| + int expected_additional_properties = 0); |
| // Convert the object to use the canonical dictionary |
| // representation. If the object is expected to have additional properties |
| @@ -5796,15 +5805,15 @@ class Map: public HeapObject { |
| inline void set_unused_property_fields(int value); |
| // Bit field. |
| - inline byte bit_field(); |
| + inline byte bit_field() const; |
| inline void set_bit_field(byte value); |
| // Bit field 2. |
| - inline byte bit_field2(); |
| + inline byte bit_field2() const; |
| inline void set_bit_field2(byte value); |
| // Bit field 3. |
| - inline uint32_t bit_field3(); |
| + inline uint32_t bit_field3() const; |
| inline void set_bit_field3(uint32_t bits); |
| class EnumLengthBits: public BitField<int, |
| @@ -5899,7 +5908,7 @@ class Map: public HeapObject { |
| inline void set_is_extensible(bool value); |
| inline bool is_extensible(); |
| inline void set_is_prototype_map(bool value); |
| - inline bool is_prototype_map(); |
| + inline bool is_prototype_map() const; |
| inline void set_elements_kind(ElementsKind elements_kind) { |
| DCHECK(static_cast<int>(elements_kind) < kElementsKindCount); |
| @@ -5970,6 +5979,9 @@ class Map: public HeapObject { |
| // Don't call set_raw_transitions() directly to overwrite transitions, use |
| // the TransitionArray::ReplaceTransitions() wrapper instead! |
| DECL_ACCESSORS(raw_transitions, Object) |
| + // [prototype_info]: Per-prototype metadata. Aliased with transitions |
| + // (which prototype maps don't have). |
| + DECL_ACCESSORS(prototype_info, Object) |
| Map* FindRootMap(); |
| Map* FindFieldOwner(int descriptor); |
| @@ -6328,9 +6340,10 @@ class Map: public HeapObject { |
| // otherwise a transition array is used. |
| // For prototype maps, this slot is used to store a pointer to the prototype |
| // object using this map. |
| - static const int kTransitionsOffset = |
| + static const int kTransitionsOrPrototypeInfoOffset = |
| kConstructorOrBackPointerOffset + kPointerSize; |
| - static const int kDescriptorsOffset = kTransitionsOffset + kPointerSize; |
| + static const int kDescriptorsOffset = |
| + kTransitionsOrPrototypeInfoOffset + kPointerSize; |
| #if V8_DOUBLE_FIELDS_UNBOXING |
| static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; |
| static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; |
| @@ -6532,6 +6545,35 @@ class Box : public Struct { |
| }; |
| +// Container for metadata stored on each prototype map. |
| +class PrototypeInfo : public Struct { |
| + public: |
| + // [prototype_object]: The object using the map holding this PrototypeInfo. |
| + DECL_ACCESSORS(prototype_object, JSObject) |
| + // [prototype_users]: WeakFixedArray containing maps using this prototype, |
| + // or Smi(0) if uninitialized. |
| + DECL_ACCESSORS(prototype_users, Object) |
| + // [validity_cell]: Cell containing the validity bit for prototype chains |
| + // going through this object, or Smi(0) if uninitialized. |
| + DECL_ACCESSORS(validity_cell, Object) |
| + |
| + DECLARE_CAST(PrototypeInfo) |
| + |
| + // Dispatched behavior. |
| + DECLARE_PRINTER(PrototypeInfo) |
| + DECLARE_VERIFIER(PrototypeInfo) |
| + |
| + static const int kPrototypeObjectOffset = HeapObject::kHeaderSize; |
| + static const int kPrototypeUsersOffset = |
| + kPrototypeObjectOffset + kPointerSize; |
| + static const int kValidityCellOffset = kPrototypeUsersOffset + kPointerSize; |
| + static const int kSize = kValidityCellOffset + kPointerSize; |
| + |
| + private: |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); |
| +}; |
| + |
| + |
| // Script describes a script which has been added to the VM. |
| class Script: public Struct { |
| public: |