| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 5961dc060f82ac581ccda19073d2375e2dfe9b34..6f24312e9d376443d3ac8ff350ec0c046c2a76b1 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) \
|
| + 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
|
| @@ -2603,6 +2612,8 @@ class WeakFixedArray : public FixedArray {
|
| inline Object* Get(int index) const;
|
| inline int Length() const;
|
|
|
| + static Object* Empty() { return Smi::FromInt(0); }
|
| +
|
| DECLARE_CAST(WeakFixedArray)
|
|
|
| private:
|
| @@ -5796,15 +5807,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 +5910,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 +5981,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 +6342,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;
|
| @@ -6535,6 +6550,33 @@ class Box : public Struct {
|
| };
|
|
|
|
|
| +// Container for metadata stored on each prototype map.
|
| +class PrototypeInfo : public Struct {
|
| + public:
|
| + // [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:
|
|
|