LCOV - code coverage report
Current view: top level - src/objects - map.h (source / functions) Hit Total Coverage
Test: app.info Lines: 4 4 100.0 %
Date: 2019-02-19 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2017 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_OBJECTS_MAP_H_
       6             : #define V8_OBJECTS_MAP_H_
       7             : 
       8             : #include "src/globals.h"
       9             : #include "src/objects.h"
      10             : #include "src/objects/code.h"
      11             : #include "src/objects/heap-object.h"
      12             : 
      13             : // Has to be the last include (doesn't have include guards):
      14             : #include "src/objects/object-macros.h"
      15             : 
      16             : namespace v8 {
      17             : namespace internal {
      18             : 
      19             : enum InstanceType : uint16_t;
      20             : 
      21             : #define DATA_ONLY_VISITOR_ID_LIST(V) \
      22             :   V(BigInt)                          \
      23             :   V(ByteArray)                       \
      24             :   V(DataObject)                      \
      25             :   V(FixedDoubleArray)                \
      26             :   V(SeqOneByteString)                \
      27             :   V(SeqTwoByteString)
      28             : 
      29             : #define POINTER_VISITOR_ID_LIST(V)     \
      30             :   V(AllocationSite)                    \
      31             :   V(BytecodeArray)                     \
      32             :   V(Cell)                              \
      33             :   V(Code)                              \
      34             :   V(CodeDataContainer)                 \
      35             :   V(ConsString)                        \
      36             :   V(Context)                           \
      37             :   V(DataHandler)                       \
      38             :   V(DescriptorArray)                   \
      39             :   V(EmbedderDataArray)                 \
      40             :   V(EphemeronHashTable)                \
      41             :   V(FeedbackCell)                      \
      42             :   V(FeedbackVector)                    \
      43             :   V(FixedArray)                        \
      44             :   V(FixedFloat64Array)                 \
      45             :   V(FixedTypedArrayBase)               \
      46             :   V(FreeSpace)                         \
      47             :   V(JSApiObject)                       \
      48             :   V(JSArrayBuffer)                     \
      49             :   V(JSDataView)                        \
      50             :   V(JSFunction)                        \
      51             :   V(JSObject)                          \
      52             :   V(JSObjectFast)                      \
      53             :   V(JSTypedArray)                      \
      54             :   V(JSWeakRef)                         \
      55             :   V(JSWeakCollection)                  \
      56             :   V(Map)                               \
      57             :   V(NativeContext)                     \
      58             :   V(Oddball)                           \
      59             :   V(PreparseData)                      \
      60             :   V(PropertyArray)                     \
      61             :   V(PropertyCell)                      \
      62             :   V(PrototypeInfo)                     \
      63             :   V(SharedFunctionInfo)                \
      64             :   V(ShortcutCandidate)                 \
      65             :   V(SlicedString)                      \
      66             :   V(SmallOrderedHashMap)               \
      67             :   V(SmallOrderedHashSet)               \
      68             :   V(SmallOrderedNameDictionary)        \
      69             :   V(Struct)                            \
      70             :   V(Symbol)                            \
      71             :   V(ThinString)                        \
      72             :   V(TransitionArray)                   \
      73             :   V(UncompiledDataWithoutPreparseData) \
      74             :   V(UncompiledDataWithPreparseData)    \
      75             :   V(WasmInstanceObject)                \
      76             :   V(WeakArray)                         \
      77             :   V(WeakCell)
      78             : 
      79             : // Objects with the same visitor id are processed in the same way by
      80             : // the heap visitors. The visitor ids for data only objects must precede
      81             : // other visitor ids. We rely on kDataOnlyVisitorIdCount for quick check
      82             : // of whether an object contains only data or may contain pointers.
      83             : enum VisitorId {
      84             : #define VISITOR_ID_ENUM_DECL(id) kVisit##id,
      85             :   DATA_ONLY_VISITOR_ID_LIST(VISITOR_ID_ENUM_DECL) kDataOnlyVisitorIdCount,
      86             :   POINTER_VISITOR_ID_LIST(VISITOR_ID_ENUM_DECL)
      87             : #undef VISITOR_ID_ENUM_DECL
      88             :       kVisitorIdCount
      89             : };
      90             : 
      91             : enum class ObjectFields {
      92             :   kDataOnly,
      93             :   kMaybePointers,
      94             : };
      95             : 
      96             : typedef std::vector<Handle<Map>> MapHandles;
      97             : 
      98             : // All heap objects have a Map that describes their structure.
      99             : //  A Map contains information about:
     100             : //  - Size information about the object
     101             : //  - How to iterate over an object (for garbage collection)
     102             : //
     103             : // Map layout:
     104             : // +---------------+---------------------------------------------+
     105             : // |   _ Type _    | _ Description _                             |
     106             : // +---------------+---------------------------------------------+
     107             : // | TaggedPointer | map - Always a pointer to the MetaMap root  |
     108             : // +---------------+---------------------------------------------+
     109             : // | Int           | The first int field                         |
     110             : //  `---+----------+---------------------------------------------+
     111             : //      | Byte     | [instance_size]                             |
     112             : //      +----------+---------------------------------------------+
     113             : //      | Byte     | If Map for a primitive type:                |
     114             : //      |          |   native context index for constructor fn   |
     115             : //      |          | If Map for an Object type:                  |
     116             : //      |          |   inobject properties start offset in words |
     117             : //      +----------+---------------------------------------------+
     118             : //      | Byte     | [used_or_unused_instance_size_in_words]     |
     119             : //      |          | For JSObject in fast mode this byte encodes |
     120             : //      |          | the size of the object that includes only   |
     121             : //      |          | the used property fields or the slack size  |
     122             : //      |          | in properties backing store.                |
     123             : //      +----------+---------------------------------------------+
     124             : //      | Byte     | [visitor_id]                                |
     125             : // +----+----------+---------------------------------------------+
     126             : // | Int           | The second int field                        |
     127             : //  `---+----------+---------------------------------------------+
     128             : //      | Short    | [instance_type]                             |
     129             : //      +----------+---------------------------------------------+
     130             : //      | Byte     | [bit_field]                                 |
     131             : //      |          |   - has_non_instance_prototype (bit 0)      |
     132             : //      |          |   - is_callable (bit 1)                     |
     133             : //      |          |   - has_named_interceptor (bit 2)           |
     134             : //      |          |   - has_indexed_interceptor (bit 3)         |
     135             : //      |          |   - is_undetectable (bit 4)                 |
     136             : //      |          |   - is_access_check_needed (bit 5)          |
     137             : //      |          |   - is_constructor (bit 6)                  |
     138             : //      |          |   - has_prototype_slot (bit 7)              |
     139             : //      +----------+---------------------------------------------+
     140             : //      | Byte     | [bit_field2]                                |
     141             : //      |          |   - is_extensible (bit 0)                   |
     142             : //      |          |   - is_prototype_map (bit 1)                |
     143             : //      |          |   - is_in_retained_map_list (bit 2)         |
     144             : //      |          |   - elements_kind (bits 3..7)               |
     145             : // +----+----------+---------------------------------------------+
     146             : // | Int           | [bit_field3]                                |
     147             : // |               |   - enum_length (bit 0..9)                  |
     148             : // |               |   - number_of_own_descriptors (bit 10..19)  |
     149             : // |               |   - is_dictionary_map (bit 20)              |
     150             : // |               |   - owns_descriptors (bit 21)               |
     151             : // |               |   - has_hidden_prototype (bit 22)           |
     152             : // |               |   - is_deprecated (bit 23)                  |
     153             : // |               |   - is_unstable (bit 24)                    |
     154             : // |               |   - is_migration_target (bit 25)            |
     155             : // |               |   - is_immutable_proto (bit 26)             |
     156             : // |               |   - new_target_is_base (bit 27)             |
     157             : // |               |   - may_have_interesting_symbols (bit 28)   |
     158             : // |               |   - construction_counter (bit 29..31)       |
     159             : // |               |                                             |
     160             : // +*************************************************************+
     161             : // | Int           | On systems with 64bit pointer types, there  |
     162             : // |               | is an unused 32bits after bit_field3        |
     163             : // +*************************************************************+
     164             : // | TaggedPointer | [prototype]                                 |
     165             : // +---------------+---------------------------------------------+
     166             : // | TaggedPointer | [constructor_or_backpointer]                |
     167             : // +---------------+---------------------------------------------+
     168             : // | TaggedPointer | If Map is a prototype map:                  |
     169             : // |               |   [prototype_info]                          |
     170             : // |               | Else:                                       |
     171             : // |               |   [raw_transitions]                         |
     172             : // +---------------+---------------------------------------------+
     173             : // | TaggedPointer | [instance_descriptors]                      |
     174             : // +*************************************************************+
     175             : // ! TaggedPointer ! [layout_descriptors]                        !
     176             : // !               ! Field is only present if compile-time flag  !
     177             : // !               ! FLAG_unbox_double_fields is enabled         !
     178             : // !               ! (basically on 64 bit architectures)         !
     179             : // +*************************************************************+
     180             : // | TaggedPointer | [dependent_code]                            |
     181             : // +---------------+---------------------------------------------+
     182             : 
     183             : class Map : public HeapObject {
     184             :  public:
     185             :   // Instance size.
     186             :   // Size in bytes or kVariableSizeSentinel if instances do not have
     187             :   // a fixed size.
     188             :   DECL_INT_ACCESSORS(instance_size)
     189             :   // Size in words or kVariableSizeSentinel if instances do not have
     190             :   // a fixed size.
     191             :   DECL_INT_ACCESSORS(instance_size_in_words)
     192             : 
     193             :   // [inobject_properties_start_or_constructor_function_index]:
     194             :   // Provides access to the inobject properties start offset in words in case of
     195             :   // JSObject maps, or the constructor function index in case of primitive maps.
     196             :   DECL_INT_ACCESSORS(inobject_properties_start_or_constructor_function_index)
     197             : 
     198             :   // Get/set the in-object property area start offset in words in the object.
     199             :   inline int GetInObjectPropertiesStartInWords() const;
     200             :   inline void SetInObjectPropertiesStartInWords(int value);
     201             :   // Count of properties allocated in the object (JSObject only).
     202             :   inline int GetInObjectProperties() const;
     203             :   // Index of the constructor function in the native context (primitives only),
     204             :   // or the special sentinel value to indicate that there is no object wrapper
     205             :   // for the primitive (i.e. in case of null or undefined).
     206             :   static const int kNoConstructorFunctionIndex = 0;
     207             :   inline int GetConstructorFunctionIndex() const;
     208             :   inline void SetConstructorFunctionIndex(int value);
     209             :   static MaybeHandle<JSFunction> GetConstructorFunction(
     210             :       Handle<Map> map, Handle<Context> native_context);
     211             : 
     212             :   // Retrieve interceptors.
     213             :   inline InterceptorInfo GetNamedInterceptor();
     214             :   inline InterceptorInfo GetIndexedInterceptor();
     215             : 
     216             :   // Instance type.
     217             :   DECL_PRIMITIVE_ACCESSORS(instance_type, InstanceType)
     218             : 
     219             :   // Returns the size of the used in-object area including object header
     220             :   // (only used for JSObject in fast mode, for the other kinds of objects it
     221             :   // is equal to the instance size).
     222             :   inline int UsedInstanceSize() const;
     223             : 
     224             :   // Tells how many unused property fields (in-object or out-of object) are
     225             :   // available in the instance (only used for JSObject in fast mode).
     226             :   inline int UnusedPropertyFields() const;
     227             :   // Tells how many unused in-object property words are present.
     228             :   inline int UnusedInObjectProperties() const;
     229             :   // Updates the counters tracking unused fields in the object.
     230             :   inline void SetInObjectUnusedPropertyFields(int unused_property_fields);
     231             :   // Updates the counters tracking unused fields in the property array.
     232             :   inline void SetOutOfObjectUnusedPropertyFields(int unused_property_fields);
     233             :   inline void CopyUnusedPropertyFields(Map map);
     234             :   inline void CopyUnusedPropertyFieldsAdjustedForInstanceSize(Map map);
     235             :   inline void AccountAddedPropertyField();
     236             :   inline void AccountAddedOutOfObjectPropertyField(
     237             :       int unused_in_property_array);
     238             : 
     239             :   //
     240             :   // Bit field.
     241             :   //
     242             :   DECL_PRIMITIVE_ACCESSORS(bit_field, byte)
     243             : 
     244             : // Bit positions for |bit_field|.
     245             : #define MAP_BIT_FIELD_FIELDS(V, _)          \
     246             :   V(HasNonInstancePrototypeBit, bool, 1, _) \
     247             :   V(IsCallableBit, bool, 1, _)              \
     248             :   V(HasNamedInterceptorBit, bool, 1, _)     \
     249             :   V(HasIndexedInterceptorBit, bool, 1, _)   \
     250             :   V(IsUndetectableBit, bool, 1, _)          \
     251             :   V(IsAccessCheckNeededBit, bool, 1, _)     \
     252             :   V(IsConstructorBit, bool, 1, _)           \
     253             :   V(HasPrototypeSlotBit, bool, 1, _)
     254             : 
     255             :   DEFINE_BIT_FIELDS(MAP_BIT_FIELD_FIELDS)
     256             : #undef MAP_BIT_FIELD_FIELDS
     257             : 
     258             :   //
     259             :   // Bit field 2.
     260             :   //
     261             :   DECL_PRIMITIVE_ACCESSORS(bit_field2, byte)
     262             : 
     263             : // Bit positions for |bit_field2|.
     264             : #define MAP_BIT_FIELD2_FIELDS(V, _)     \
     265             :   V(IsExtensibleBit, bool, 1, _)        \
     266             :   V(IsPrototypeMapBit, bool, 1, _)      \
     267             :   V(IsInRetainedMapListBit, bool, 1, _) \
     268             :   V(ElementsKindBits, ElementsKind, 5, _)
     269             : 
     270             :   DEFINE_BIT_FIELDS(MAP_BIT_FIELD2_FIELDS)
     271             : #undef MAP_BIT_FIELD2_FIELDS
     272             : 
     273             :   //
     274             :   // Bit field 3.
     275             :   //
     276             :   DECL_PRIMITIVE_ACCESSORS(bit_field3, uint32_t)
     277             : 
     278             : // Bit positions for |bit_field3|.
     279             : #define MAP_BIT_FIELD3_FIELDS(V, _)                               \
     280             :   V(EnumLengthBits, int, kDescriptorIndexBitCount, _)             \
     281             :   V(NumberOfOwnDescriptorsBits, int, kDescriptorIndexBitCount, _) \
     282             :   V(IsDictionaryMapBit, bool, 1, _)                               \
     283             :   V(OwnsDescriptorsBit, bool, 1, _)                               \
     284             :   V(HasHiddenPrototypeBit, bool, 1, _)                            \
     285             :   V(IsDeprecatedBit, bool, 1, _)                                  \
     286             :   V(IsUnstableBit, bool, 1, _)                                    \
     287             :   V(IsMigrationTargetBit, bool, 1, _)                             \
     288             :   V(IsImmutablePrototypeBit, bool, 1, _)                          \
     289             :   V(NewTargetIsBaseBit, bool, 1, _)                               \
     290             :   V(MayHaveInterestingSymbolsBit, bool, 1, _)                     \
     291             :   V(ConstructionCounterBits, int, 3, _)
     292             : 
     293             :   DEFINE_BIT_FIELDS(MAP_BIT_FIELD3_FIELDS)
     294             : #undef MAP_BIT_FIELD3_FIELDS
     295             : 
     296             :   STATIC_ASSERT(NumberOfOwnDescriptorsBits::kMax >= kMaxNumberOfDescriptors);
     297             : 
     298             :   static const int kSlackTrackingCounterStart = 7;
     299             :   static const int kSlackTrackingCounterEnd = 1;
     300             :   static const int kNoSlackTracking = 0;
     301             :   STATIC_ASSERT(kSlackTrackingCounterStart <= ConstructionCounterBits::kMax);
     302             : 
     303             :   // Inobject slack tracking is the way to reclaim unused inobject space.
     304             :   //
     305             :   // The instance size is initially determined by adding some slack to
     306             :   // expected_nof_properties (to allow for a few extra properties added
     307             :   // after the constructor). There is no guarantee that the extra space
     308             :   // will not be wasted.
     309             :   //
     310             :   // Here is the algorithm to reclaim the unused inobject space:
     311             :   // - Detect the first constructor call for this JSFunction.
     312             :   //   When it happens enter the "in progress" state: initialize construction
     313             :   //   counter in the initial_map.
     314             :   // - While the tracking is in progress initialize unused properties of a new
     315             :   //   object with one_pointer_filler_map instead of undefined_value (the "used"
     316             :   //   part is initialized with undefined_value as usual). This way they can
     317             :   //   be resized quickly and safely.
     318             :   // - Once enough objects have been created  compute the 'slack'
     319             :   //   (traverse the map transition tree starting from the
     320             :   //   initial_map and find the lowest value of unused_property_fields).
     321             :   // - Traverse the transition tree again and decrease the instance size
     322             :   //   of every map. Existing objects will resize automatically (they are
     323             :   //   filled with one_pointer_filler_map). All further allocations will
     324             :   //   use the adjusted instance size.
     325             :   // - SharedFunctionInfo's expected_nof_properties left unmodified since
     326             :   //   allocations made using different closures could actually create different
     327             :   //   kind of objects (see prototype inheritance pattern).
     328             :   //
     329             :   //  Important: inobject slack tracking is not attempted during the snapshot
     330             :   //  creation.
     331             : 
     332             :   static const int kGenerousAllocationCount =
     333             :       kSlackTrackingCounterStart - kSlackTrackingCounterEnd + 1;
     334             : 
     335             :   // Starts the tracking by initializing object constructions countdown counter.
     336             :   void StartInobjectSlackTracking();
     337             : 
     338             :   // True if the object constructions countdown counter is a range
     339             :   // [kSlackTrackingCounterEnd, kSlackTrackingCounterStart].
     340             :   inline bool IsInobjectSlackTrackingInProgress() const;
     341             : 
     342             :   // Does the tracking step.
     343             :   inline void InobjectSlackTrackingStep(Isolate* isolate);
     344             : 
     345             :   // Computes inobject slack for the transition tree starting at this initial
     346             :   // map.
     347             :   int ComputeMinObjectSlack(Isolate* isolate);
     348             :   inline int InstanceSizeFromSlack(int slack) const;
     349             : 
     350             :   // Completes inobject slack tracking for the transition tree starting at this
     351             :   // initial map.
     352             :   void CompleteInobjectSlackTracking(Isolate* isolate);
     353             : 
     354             :   // Tells whether the object in the prototype property will be used
     355             :   // for instances created from this function.  If the prototype
     356             :   // property is set to a value that is not a JSObject, the prototype
     357             :   // property will not be used to create instances of the function.
     358             :   // See ECMA-262, 13.2.2.
     359             :   DECL_BOOLEAN_ACCESSORS(has_non_instance_prototype)
     360             : 
     361             :   // Tells whether the instance has a [[Construct]] internal method.
     362             :   // This property is implemented according to ES6, section 7.2.4.
     363             :   DECL_BOOLEAN_ACCESSORS(is_constructor)
     364             : 
     365             :   // Tells whether the instance with this map may have properties for
     366             :   // interesting symbols on it.
     367             :   // An "interesting symbol" is one for which Name::IsInterestingSymbol()
     368             :   // returns true, i.e. a well-known symbol like @@toStringTag.
     369             :   DECL_BOOLEAN_ACCESSORS(may_have_interesting_symbols)
     370             : 
     371             :   DECL_BOOLEAN_ACCESSORS(has_prototype_slot)
     372             : 
     373             :   // Tells whether the instance with this map has a hidden prototype.
     374             :   DECL_BOOLEAN_ACCESSORS(has_hidden_prototype)
     375             : 
     376             :   // Records and queries whether the instance has a named interceptor.
     377             :   DECL_BOOLEAN_ACCESSORS(has_named_interceptor)
     378             : 
     379             :   // Records and queries whether the instance has an indexed interceptor.
     380             :   DECL_BOOLEAN_ACCESSORS(has_indexed_interceptor)
     381             : 
     382             :   // Tells whether the instance is undetectable.
     383             :   // An undetectable object is a special class of JSObject: 'typeof' operator
     384             :   // returns undefined, ToBoolean returns false. Otherwise it behaves like
     385             :   // a normal JS object.  It is useful for implementing undetectable
     386             :   // document.all in Firefox & Safari.
     387             :   // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549.
     388             :   DECL_BOOLEAN_ACCESSORS(is_undetectable)
     389             : 
     390             :   // Tells whether the instance has a [[Call]] internal method.
     391             :   // This property is implemented according to ES6, section 7.2.3.
     392             :   DECL_BOOLEAN_ACCESSORS(is_callable)
     393             : 
     394             :   DECL_BOOLEAN_ACCESSORS(new_target_is_base)
     395             :   DECL_BOOLEAN_ACCESSORS(is_extensible)
     396             :   DECL_BOOLEAN_ACCESSORS(is_prototype_map)
     397             :   inline bool is_abandoned_prototype_map() const;
     398             : 
     399             :   // Whether the instance has been added to the retained map list by
     400             :   // Heap::AddRetainedMap.
     401             :   DECL_BOOLEAN_ACCESSORS(is_in_retained_map_list)
     402             : 
     403             :   DECL_PRIMITIVE_ACCESSORS(elements_kind, ElementsKind)
     404             : 
     405             :   // Tells whether the instance has fast elements that are only Smis.
     406             :   inline bool has_fast_smi_elements() const;
     407             : 
     408             :   // Tells whether the instance has fast elements.
     409             :   inline bool has_fast_object_elements() const;
     410             :   inline bool has_fast_smi_or_object_elements() const;
     411             :   inline bool has_fast_double_elements() const;
     412             :   inline bool has_fast_elements() const;
     413             :   inline bool has_sloppy_arguments_elements() const;
     414             :   inline bool has_fast_sloppy_arguments_elements() const;
     415             :   inline bool has_fast_string_wrapper_elements() const;
     416             :   inline bool has_fixed_typed_array_elements() const;
     417             :   inline bool has_dictionary_elements() const;
     418             : 
     419             :   // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a
     420             :   // map with DICTIONARY_ELEMENTS was found in the prototype chain.
     421             :   bool DictionaryElementsInPrototypeChainOnly(Isolate* isolate);
     422             : 
     423             :   inline Map ElementsTransitionMap();
     424             : 
     425             :   inline FixedArrayBase GetInitialElements() const;
     426             : 
     427             :   // [raw_transitions]: Provides access to the transitions storage field.
     428             :   // Don't call set_raw_transitions() directly to overwrite transitions, use
     429             :   // the TransitionArray::ReplaceTransitions() wrapper instead!
     430             :   DECL_ACCESSORS(raw_transitions, MaybeObject)
     431             :   // [prototype_info]: Per-prototype metadata. Aliased with transitions
     432             :   // (which prototype maps don't have).
     433             :   DECL_ACCESSORS(prototype_info, Object)
     434             :   // PrototypeInfo is created lazily using this helper (which installs it on
     435             :   // the given prototype's map).
     436             :   static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
     437             :       Handle<JSObject> prototype, Isolate* isolate);
     438             :   static Handle<PrototypeInfo> GetOrCreatePrototypeInfo(
     439             :       Handle<Map> prototype_map, Isolate* isolate);
     440             :   inline bool should_be_fast_prototype_map() const;
     441             :   static void SetShouldBeFastPrototypeMap(Handle<Map> map, bool value,
     442             :                                           Isolate* isolate);
     443             : 
     444             :   // [prototype chain validity cell]: Associated with a prototype object,
     445             :   // stored in that object's map, indicates that prototype chains through this
     446             :   // object are currently valid. The cell will be invalidated and replaced when
     447             :   // the prototype chain changes. When there's nothing to guard (for example,
     448             :   // when direct prototype is null or Proxy) this function returns Smi with
     449             :   // |kPrototypeChainValid| sentinel value.
     450             :   static Handle<Object> GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
     451             :                                                               Isolate* isolate);
     452             :   static const int kPrototypeChainValid = 0;
     453             :   static const int kPrototypeChainInvalid = 1;
     454             : 
     455             :   static bool IsPrototypeChainInvalidated(Map map);
     456             : 
     457             :   // Return the map of the root of object's prototype chain.
     458             :   Map GetPrototypeChainRootMap(Isolate* isolate) const;
     459             : 
     460             :   Map FindRootMap(Isolate* isolate) const;
     461             :   Map FindFieldOwner(Isolate* isolate, int descriptor) const;
     462             : 
     463             :   inline int GetInObjectPropertyOffset(int index) const;
     464             : 
     465             :   class FieldCounts {
     466             :    public:
     467             :     FieldCounts(int mutable_count, int const_count)
     468             :         : mutable_count_(mutable_count), const_count_(const_count) {}
     469             : 
     470     2448053 :     int GetTotal() const { return mutable_count() + const_count(); }
     471             : 
     472             :     int mutable_count() const { return mutable_count_; }
     473             :     int const_count() const { return const_count_; }
     474             : 
     475             :    private:
     476             :     int mutable_count_;
     477             :     int const_count_;
     478             :   };
     479             : 
     480             :   FieldCounts GetFieldCounts() const;
     481             :   int NumberOfFields() const;
     482             : 
     483             :   bool HasOutOfObjectProperties() const;
     484             : 
     485             :   // Returns true if transition to the given map requires special
     486             :   // synchronization with the concurrent marker.
     487             :   bool TransitionRequiresSynchronizationWithGC(Map target) const;
     488             :   // Returns true if transition to the given map removes a tagged in-object
     489             :   // field.
     490             :   bool TransitionRemovesTaggedField(Map target) const;
     491             :   // Returns true if transition to the given map replaces a tagged in-object
     492             :   // field with an untagged in-object field.
     493             :   bool TransitionChangesTaggedFieldToUntaggedField(Map target) const;
     494             : 
     495             :   // TODO(ishell): candidate with JSObject::MigrateToMap().
     496             :   bool InstancesNeedRewriting(Map target) const;
     497             :   bool InstancesNeedRewriting(Map target, int target_number_of_fields,
     498             :                               int target_inobject, int target_unused,
     499             :                               int* old_number_of_fields) const;
     500             :   V8_WARN_UNUSED_RESULT static Handle<FieldType> GeneralizeFieldType(
     501             :       Representation rep1, Handle<FieldType> type1, Representation rep2,
     502             :       Handle<FieldType> type2, Isolate* isolate);
     503             :   static void GeneralizeField(Isolate* isolate, Handle<Map> map,
     504             :                               int modify_index, PropertyConstness new_constness,
     505             :                               Representation new_representation,
     506             :                               Handle<FieldType> new_field_type);
     507             :   // Returns true if the |field_type| is the most general one for
     508             :   // given |representation|.
     509             :   static inline bool IsMostGeneralFieldType(Representation representation,
     510             :                                             FieldType field_type);
     511             : 
     512             :   // Generalizes constness, representation and field_type if objects with given
     513             :   // instance type can have fast elements that can be transitioned by stubs or
     514             :   // optimized code to more general elements kind.
     515             :   // This generalization is necessary in order to ensure that elements kind
     516             :   // transitions performed by stubs / optimized code don't silently transition
     517             :   // PropertyConstness::kMutable fields back to VariableMode::kConst state or
     518             :   // fields with HeapObject representation and "Any" type back to "Class" type.
     519             :   static inline void GeneralizeIfCanHaveTransitionableFastElementsKind(
     520             :       Isolate* isolate, InstanceType instance_type,
     521             :       PropertyConstness* constness, Representation* representation,
     522             :       Handle<FieldType>* field_type);
     523             : 
     524             :   static Handle<Map> ReconfigureProperty(Isolate* isolate, Handle<Map> map,
     525             :                                          int modify_index,
     526             :                                          PropertyKind new_kind,
     527             :                                          PropertyAttributes new_attributes,
     528             :                                          Representation new_representation,
     529             :                                          Handle<FieldType> new_field_type);
     530             : 
     531             :   static Handle<Map> ReconfigureElementsKind(Isolate* isolate, Handle<Map> map,
     532             :                                              ElementsKind new_elements_kind);
     533             : 
     534             :   static Handle<Map> PrepareForDataProperty(Isolate* isolate,
     535             :                                             Handle<Map> old_map,
     536             :                                             int descriptor_number,
     537             :                                             PropertyConstness constness,
     538             :                                             Handle<Object> value);
     539             : 
     540             :   static Handle<Map> Normalize(Isolate* isolate, Handle<Map> map,
     541             :                                PropertyNormalizationMode mode,
     542             :                                const char* reason);
     543             : 
     544             :   // Tells whether the map is used for JSObjects in dictionary mode (ie
     545             :   // normalized objects, ie objects for which HasFastProperties returns false).
     546             :   // A map can never be used for both dictionary mode and fast mode JSObjects.
     547             :   // False by default and for HeapObjects that are not JSObjects.
     548             :   DECL_BOOLEAN_ACCESSORS(is_dictionary_map)
     549             : 
     550             :   // Tells whether the instance needs security checks when accessing its
     551             :   // properties.
     552             :   DECL_BOOLEAN_ACCESSORS(is_access_check_needed)
     553             : 
     554             :   // [prototype]: implicit prototype object.
     555             :   DECL_ACCESSORS(prototype, Object)
     556             :   // TODO(jkummerow): make set_prototype private.
     557             :   static void SetPrototype(Isolate* isolate, Handle<Map> map,
     558             :                            Handle<Object> prototype,
     559             :                            bool enable_prototype_setup_mode = true);
     560             : 
     561             :   // [constructor]: points back to the function or FunctionTemplateInfo
     562             :   // responsible for this map.
     563             :   // The field overlaps with the back pointer. All maps in a transition tree
     564             :   // have the same constructor, so maps with back pointers can walk the
     565             :   // back pointer chain until they find the map holding their constructor.
     566             :   // Returns null_value if there's neither a constructor function nor a
     567             :   // FunctionTemplateInfo available.
     568             :   DECL_ACCESSORS(constructor_or_backpointer, Object)
     569             :   inline Object GetConstructor() const;
     570             :   inline FunctionTemplateInfo GetFunctionTemplateInfo() const;
     571             :   inline void SetConstructor(Object constructor,
     572             :                              WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
     573             :   // [back pointer]: points back to the parent map from which a transition
     574             :   // leads to this map. The field overlaps with the constructor (see above).
     575             :   inline Object GetBackPointer() const;
     576             :   inline void SetBackPointer(Object value,
     577             :                              WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
     578             : 
     579             :   // [instance descriptors]: describes the object.
     580             :   inline DescriptorArray instance_descriptors() const;
     581             :   inline DescriptorArray synchronized_instance_descriptors() const;
     582             :   void SetInstanceDescriptors(Isolate* isolate, DescriptorArray descriptors,
     583             :                               int number_of_own_descriptors);
     584             : 
     585             :   // [layout descriptor]: describes the object layout.
     586             :   DECL_ACCESSORS(layout_descriptor, LayoutDescriptor)
     587             :   // |layout descriptor| accessor which can be used from GC.
     588             :   inline LayoutDescriptor layout_descriptor_gc_safe() const;
     589             :   inline bool HasFastPointerLayout() const;
     590             : 
     591             :   // |layout descriptor| accessor that is safe to call even when
     592             :   // FLAG_unbox_double_fields is disabled (in this case Map does not contain
     593             :   // |layout_descriptor| field at all).
     594             :   inline LayoutDescriptor GetLayoutDescriptor() const;
     595             : 
     596             :   inline void UpdateDescriptors(Isolate* isolate, DescriptorArray descriptors,
     597             :                                 LayoutDescriptor layout_descriptor,
     598             :                                 int number_of_own_descriptors);
     599             :   inline void InitializeDescriptors(Isolate* isolate,
     600             :                                     DescriptorArray descriptors,
     601             :                                     LayoutDescriptor layout_descriptor);
     602             : 
     603             :   // [dependent code]: list of optimized codes that weakly embed this map.
     604             :   DECL_ACCESSORS(dependent_code, DependentCode)
     605             : 
     606             :   // [prototype_validity_cell]: Cell containing the validity bit for prototype
     607             :   // chains or Smi(0) if uninitialized.
     608             :   // The meaning of this validity cell is different for prototype maps and
     609             :   // non-prototype maps.
     610             :   // For prototype maps the validity bit "guards" modifications of prototype
     611             :   // chains going through this object. When a prototype object changes, both its
     612             :   // own validity cell and those of all "downstream" prototypes are invalidated;
     613             :   // handlers for a given receiver embed the currently valid cell for that
     614             :   // receiver's prototype during their creation and check it on execution.
     615             :   // For non-prototype maps which are used as transitioning store handlers this
     616             :   // field contains the validity cell which guards modifications of this map's
     617             :   // prototype.
     618             :   DECL_ACCESSORS(prototype_validity_cell, Object)
     619             : 
     620             :   // Returns true if prototype validity cell value represents "valid" prototype
     621             :   // chain state.
     622             :   inline bool IsPrototypeValidityCellValid() const;
     623             : 
     624             :   inline PropertyDetails GetLastDescriptorDetails() const;
     625             : 
     626             :   inline int LastAdded() const;
     627             : 
     628             :   inline int NumberOfOwnDescriptors() const;
     629             :   inline void SetNumberOfOwnDescriptors(int number);
     630             : 
     631             :   inline Cell RetrieveDescriptorsPointer();
     632             : 
     633             :   // Checks whether all properties are stored either in the map or on the object
     634             :   // (inobject, properties, or elements backing store), requiring no special
     635             :   // checks.
     636             :   bool OnlyHasSimpleProperties() const;
     637             :   inline int EnumLength() const;
     638             :   inline void SetEnumLength(int length);
     639             : 
     640             :   DECL_BOOLEAN_ACCESSORS(owns_descriptors)
     641             : 
     642             :   inline void mark_unstable();
     643             :   inline bool is_stable() const;
     644             : 
     645             :   DECL_BOOLEAN_ACCESSORS(is_migration_target)
     646             : 
     647             :   DECL_BOOLEAN_ACCESSORS(is_immutable_proto)
     648             : 
     649             :   // This counter is used for in-object slack tracking.
     650             :   // The in-object slack tracking is considered enabled when the counter is
     651             :   // non zero. The counter only has a valid count for initial maps. For
     652             :   // transitioned maps only kNoSlackTracking has a meaning, namely that inobject
     653             :   // slack tracking already finished for the transition tree. Any other value
     654             :   // indicates that either inobject slack tracking is still in progress, or that
     655             :   // the map isn't part of the transition tree anymore.
     656             :   DECL_INT_ACCESSORS(construction_counter)
     657             : 
     658             :   DECL_BOOLEAN_ACCESSORS(is_deprecated)
     659             :   inline bool CanBeDeprecated() const;
     660             :   // Returns a non-deprecated version of the input. If the input was not
     661             :   // deprecated, it is directly returned. Otherwise, the non-deprecated version
     662             :   // is found by re-transitioning from the root of the transition tree using the
     663             :   // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map
     664             :   // is found.
     665             :   static MaybeHandle<Map> TryUpdate(Isolate* isolate,
     666             :                                     Handle<Map> map) V8_WARN_UNUSED_RESULT;
     667             :   static Map TryUpdateSlow(Isolate* isolate, Map map) V8_WARN_UNUSED_RESULT;
     668             : 
     669             :   // Returns a non-deprecated version of the input. This method may deprecate
     670             :   // existing maps along the way if encodings conflict. Not for use while
     671             :   // gathering type feedback. Use TryUpdate in those cases instead.
     672             :   static Handle<Map> Update(Isolate* isolate, Handle<Map> map);
     673             : 
     674             :   static inline Handle<Map> CopyInitialMap(Isolate* isolate, Handle<Map> map);
     675             :   static Handle<Map> CopyInitialMap(Isolate* isolate, Handle<Map> map,
     676             :                                     int instance_size, int in_object_properties,
     677             :                                     int unused_property_fields);
     678             :   static Handle<Map> CopyInitialMapNormalized(
     679             :       Isolate* isolate, Handle<Map> map,
     680             :       PropertyNormalizationMode mode = CLEAR_INOBJECT_PROPERTIES);
     681             :   static Handle<Map> CopyDropDescriptors(Isolate* isolate, Handle<Map> map);
     682             :   static Handle<Map> CopyInsertDescriptor(Isolate* isolate, Handle<Map> map,
     683             :                                           Descriptor* descriptor,
     684             :                                           TransitionFlag flag);
     685             : 
     686             :   static MaybeObjectHandle WrapFieldType(Isolate* isolate,
     687             :                                          Handle<FieldType> type);
     688             :   static FieldType UnwrapFieldType(MaybeObject wrapped_type);
     689             : 
     690             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Map> CopyWithField(
     691             :       Isolate* isolate, Handle<Map> map, Handle<Name> name,
     692             :       Handle<FieldType> type, PropertyAttributes attributes,
     693             :       PropertyConstness constness, Representation representation,
     694             :       TransitionFlag flag);
     695             : 
     696             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Map> CopyWithConstant(
     697             :       Isolate* isolate, Handle<Map> map, Handle<Name> name,
     698             :       Handle<Object> constant, PropertyAttributes attributes,
     699             :       TransitionFlag flag);
     700             : 
     701             :   // Returns a new map with all transitions dropped from the given map and
     702             :   // the ElementsKind set.
     703             :   static Handle<Map> TransitionElementsTo(Isolate* isolate, Handle<Map> map,
     704             :                                           ElementsKind to_kind);
     705             : 
     706             :   static Handle<Map> AsElementsKind(Isolate* isolate, Handle<Map> map,
     707             :                                     ElementsKind kind);
     708             : 
     709             :   static Handle<Map> CopyAsElementsKind(Isolate* isolate, Handle<Map> map,
     710             :                                         ElementsKind kind, TransitionFlag flag);
     711             : 
     712             :   static Handle<Map> AsLanguageMode(Isolate* isolate, Handle<Map> initial_map,
     713             :                                     Handle<SharedFunctionInfo> shared_info);
     714             : 
     715             :   static Handle<Map> CopyForPreventExtensions(Isolate* isolate, Handle<Map> map,
     716             :                                               PropertyAttributes attrs_to_add,
     717             :                                               Handle<Symbol> transition_marker,
     718             :                                               const char* reason);
     719             : 
     720             :   static Handle<Map> FixProxy(Handle<Map> map, InstanceType type, int size);
     721             : 
     722             :   // Maximal number of fast properties. Used to restrict the number of map
     723             :   // transitions to avoid an explosion in the number of maps for objects used as
     724             :   // dictionaries.
     725             :   inline bool TooManyFastProperties(StoreOrigin store_origin) const;
     726             :   static Handle<Map> TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
     727             :                                               Handle<Name> name,
     728             :                                               Handle<Object> value,
     729             :                                               PropertyAttributes attributes,
     730             :                                               PropertyConstness constness,
     731             :                                               StoreOrigin store_origin);
     732             :   static Handle<Map> TransitionToAccessorProperty(
     733             :       Isolate* isolate, Handle<Map> map, Handle<Name> name, int descriptor,
     734             :       Handle<Object> getter, Handle<Object> setter,
     735             :       PropertyAttributes attributes);
     736             :   static Handle<Map> ReconfigureExistingProperty(Isolate* isolate,
     737             :                                                  Handle<Map> map,
     738             :                                                  int descriptor,
     739             :                                                  PropertyKind kind,
     740             :                                                  PropertyAttributes attributes);
     741             : 
     742             :   inline void AppendDescriptor(Isolate* isolate, Descriptor* desc);
     743             : 
     744             :   // Returns a copy of the map, prepared for inserting into the transition
     745             :   // tree (if the |map| owns descriptors then the new one will share
     746             :   // descriptors with |map|).
     747             :   static Handle<Map> CopyForElementsTransition(Isolate* isolate,
     748             :                                                Handle<Map> map);
     749             : 
     750             :   // Returns a copy of the map, with all transitions dropped from the
     751             :   // instance descriptors.
     752             :   static Handle<Map> Copy(Isolate* isolate, Handle<Map> map,
     753             :                           const char* reason);
     754             :   static Handle<Map> Create(Isolate* isolate, int inobject_properties);
     755             : 
     756             :   // Returns the next free property index (only valid for FAST MODE).
     757             :   int NextFreePropertyIndex() const;
     758             : 
     759             :   // Returns the number of enumerable properties.
     760             :   int NumberOfEnumerableProperties() const;
     761             : 
     762             :   DECL_CAST(Map)
     763             : 
     764             :   static inline int SlackForArraySize(int old_size, int size_limit);
     765             : 
     766             :   static void EnsureDescriptorSlack(Isolate* isolate, Handle<Map> map,
     767             :                                     int slack);
     768             : 
     769             :   // Returns the map to be used for instances when the given {prototype} is
     770             :   // passed to an Object.create call. Might transition the given {prototype}.
     771             :   static Handle<Map> GetObjectCreateMap(Isolate* isolate,
     772             :                                         Handle<HeapObject> prototype);
     773             : 
     774             :   // Similar to {GetObjectCreateMap} but does not transition {prototype} and
     775             :   // fails gracefully by returning an empty handle instead.
     776             :   static MaybeHandle<Map> TryGetObjectCreateMap(Isolate* isolate,
     777             :                                                 Handle<HeapObject> prototype);
     778             : 
     779             :   // Computes a hash value for this map, to be used in HashTables and such.
     780             :   int Hash();
     781             : 
     782             :   // Returns the transitioned map for this map with the most generic
     783             :   // elements_kind that's found in |candidates|, or |nullptr| if no match is
     784             :   // found at all.
     785             :   Map FindElementsKindTransitionedMap(Isolate* isolate,
     786             :                                       MapHandles const& candidates);
     787             : 
     788             :   inline bool CanTransition() const;
     789             : 
     790             : #define DECL_TESTER(Type, ...) inline bool Is##Type##Map() const;
     791             :   INSTANCE_TYPE_CHECKERS(DECL_TESTER)
     792             : #undef DECL_TESTER
     793             :   inline bool IsBooleanMap() const;
     794             :   inline bool IsNullOrUndefinedMap() const;
     795             :   inline bool IsPrimitiveMap() const;
     796             :   inline bool IsSpecialReceiverMap() const;
     797             :   inline bool IsCustomElementsReceiverMap() const;
     798             : 
     799             :   bool IsMapInArrayPrototypeChain(Isolate* isolate) const;
     800             : 
     801             :   // Dispatched behavior.
     802             :   void MapPrint(std::ostream& os);
     803             :   DECL_VERIFIER(Map)
     804             : 
     805             : #ifdef VERIFY_HEAP
     806             :   void DictionaryMapVerify(Isolate* isolate);
     807             : #endif
     808             : 
     809             :   DECL_PRIMITIVE_ACCESSORS(visitor_id, VisitorId)
     810             : 
     811    61953448 :   static ObjectFields ObjectFieldsFrom(VisitorId visitor_id) {
     812             :     return (visitor_id < kDataOnlyVisitorIdCount)
     813             :                ? ObjectFields::kDataOnly
     814    62455256 :                : ObjectFields::kMaybePointers;
     815             :   }
     816             : 
     817             :   static Handle<Map> TransitionToPrototype(Isolate* isolate, Handle<Map> map,
     818             :                                            Handle<Object> prototype);
     819             : 
     820             :   static Handle<Map> TransitionToImmutableProto(Isolate* isolate,
     821             :                                                 Handle<Map> map);
     822             : 
     823             :   static const int kMaxPreAllocatedPropertyFields = 255;
     824             : 
     825             :   // Layout description.
     826             : #define MAP_FIELDS(V)                                                     \
     827             :   /* Raw data fields. */                                                  \
     828             :   V(kInstanceSizeInWordsOffset, kUInt8Size)                               \
     829             :   V(kInObjectPropertiesStartOrConstructorFunctionIndexOffset, kUInt8Size) \
     830             :   V(kUsedOrUnusedInstanceSizeInWordsOffset, kUInt8Size)                   \
     831             :   V(kVisitorIdOffset, kUInt8Size)                                         \
     832             :   V(kInstanceTypeOffset, kUInt16Size)                                     \
     833             :   V(kBitFieldOffset, kUInt8Size)                                          \
     834             :   V(kBitField2Offset, kUInt8Size)                                         \
     835             :   V(kBitField3Offset, kUInt32Size)                                        \
     836             :   V(k64BitArchPaddingOffset,                                              \
     837             :     kSystemPointerSize == kUInt32Size ? 0 : kUInt32Size)                  \
     838             :   /* Pointer fields. */                                                   \
     839             :   V(kPointerFieldsBeginOffset, 0)                                         \
     840             :   V(kPrototypeOffset, kTaggedSize)                                        \
     841             :   V(kConstructorOrBackPointerOffset, kTaggedSize)                         \
     842             :   V(kTransitionsOrPrototypeInfoOffset, kTaggedSize)                       \
     843             :   V(kDescriptorsOffset, kTaggedSize)                                      \
     844             :   V(kLayoutDescriptorOffset, FLAG_unbox_double_fields ? kTaggedSize : 0)  \
     845             :   V(kDependentCodeOffset, kTaggedSize)                                    \
     846             :   V(kPrototypeValidityCellOffset, kTaggedSize)                            \
     847             :   V(kPointerFieldsEndOffset, 0)                                           \
     848             :   /* Total size. */                                                       \
     849             :   V(kSize, 0)
     850             : 
     851             :   DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, MAP_FIELDS)
     852             : #undef MAP_FIELDS
     853             : 
     854             :   STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
     855             : 
     856             :   class BodyDescriptor;
     857             : 
     858             :   // Compares this map to another to see if they describe equivalent objects.
     859             :   // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if
     860             :   // it had exactly zero inobject properties.
     861             :   // The "shared" flags of both this map and |other| are ignored.
     862             :   bool EquivalentToForNormalization(const Map other,
     863             :                                     PropertyNormalizationMode mode) const;
     864             : 
     865             :   // Returns true if given field is unboxed double.
     866             :   inline bool IsUnboxedDoubleField(FieldIndex index) const;
     867             : 
     868             :   void PrintMapDetails(std::ostream& os);
     869             : 
     870             :   static inline Handle<Map> AddMissingTransitionsForTesting(
     871             :       Isolate* isolate, Handle<Map> split_map,
     872             :       Handle<DescriptorArray> descriptors,
     873             :       Handle<LayoutDescriptor> full_layout_descriptor);
     874             : 
     875             :   // Fires when the layout of an object with a leaf map changes.
     876             :   // This includes adding transitions to the leaf map or changing
     877             :   // the descriptor array.
     878             :   inline void NotifyLeafMapLayoutChange(Isolate* isolate);
     879             : 
     880             :   static VisitorId GetVisitorId(Map map);
     881             : 
     882             :   // Returns true if objects with given instance type are allowed to have
     883             :   // fast transitionable elements kinds. This predicate is used to ensure
     884             :   // that objects that can have transitionable fast elements kind will not
     885             :   // get in-place generalizable fields because the elements kind transition
     886             :   // performed by stubs or optimized code can't properly generalize such
     887             :   // fields.
     888             :   static inline bool CanHaveFastTransitionableElementsKind(
     889             :       InstanceType instance_type);
     890             :   inline bool CanHaveFastTransitionableElementsKind() const;
     891             : 
     892             :  private:
     893             :   // This byte encodes either the instance size without the in-object slack or
     894             :   // the slack size in properties backing store.
     895             :   // Let H be JSObject::kHeaderSize / kTaggedSize.
     896             :   // If value >= H then:
     897             :   //     - all field properties are stored in the object.
     898             :   //     - there is no property array.
     899             :   //     - value * kTaggedSize is the actual object size without the slack.
     900             :   // Otherwise:
     901             :   //     - there is no slack in the object.
     902             :   //     - the property array has value slack slots.
     903             :   // Note that this encoding requires that H = JSObject::kFieldsAdded.
     904             :   DECL_INT_ACCESSORS(used_or_unused_instance_size_in_words)
     905             : 
     906             :   // Returns the map that this (root) map transitions to if its elements_kind
     907             :   // is changed to |elements_kind|, or |nullptr| if no such map is cached yet.
     908             :   Map LookupElementsTransitionMap(Isolate* isolate, ElementsKind elements_kind);
     909             : 
     910             :   // Tries to replay property transitions starting from this (root) map using
     911             :   // the descriptor array of the |map|. The |root_map| is expected to have
     912             :   // proper elements kind and therefore elements kinds transitions are not
     913             :   // taken by this function. Returns |nullptr| if matching transition map is
     914             :   // not found.
     915             :   Map TryReplayPropertyTransitions(Isolate* isolate, Map map);
     916             : 
     917             :   static void ConnectTransition(Isolate* isolate, Handle<Map> parent,
     918             :                                 Handle<Map> child, Handle<Name> name,
     919             :                                 SimpleTransitionFlag flag);
     920             : 
     921             :   bool EquivalentToForTransition(const Map other) const;
     922             :   bool EquivalentToForElementsKindTransition(const Map other) const;
     923             :   static Handle<Map> RawCopy(Isolate* isolate, Handle<Map> map,
     924             :                              int instance_size, int inobject_properties);
     925             :   static Handle<Map> ShareDescriptor(Isolate* isolate, Handle<Map> map,
     926             :                                      Handle<DescriptorArray> descriptors,
     927             :                                      Descriptor* descriptor);
     928             :   static Handle<Map> AddMissingTransitions(
     929             :       Isolate* isolate, Handle<Map> map, Handle<DescriptorArray> descriptors,
     930             :       Handle<LayoutDescriptor> full_layout_descriptor);
     931             :   static void InstallDescriptors(
     932             :       Isolate* isolate, Handle<Map> parent_map, Handle<Map> child_map,
     933             :       int new_descriptor, Handle<DescriptorArray> descriptors,
     934             :       Handle<LayoutDescriptor> full_layout_descriptor);
     935             :   static Handle<Map> CopyAddDescriptor(Isolate* isolate, Handle<Map> map,
     936             :                                        Descriptor* descriptor,
     937             :                                        TransitionFlag flag);
     938             :   static Handle<Map> CopyReplaceDescriptors(
     939             :       Isolate* isolate, Handle<Map> map, Handle<DescriptorArray> descriptors,
     940             :       Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag,
     941             :       MaybeHandle<Name> maybe_name, const char* reason,
     942             :       SimpleTransitionFlag simple_flag);
     943             : 
     944             :   static Handle<Map> CopyReplaceDescriptor(Isolate* isolate, Handle<Map> map,
     945             :                                            Handle<DescriptorArray> descriptors,
     946             :                                            Descriptor* descriptor, int index,
     947             :                                            TransitionFlag flag);
     948             :   static Handle<Map> CopyNormalized(Isolate* isolate, Handle<Map> map,
     949             :                                     PropertyNormalizationMode mode);
     950             : 
     951             :   // TODO(ishell): Move to MapUpdater.
     952             :   static Handle<Map> CopyGeneralizeAllFields(Isolate* isolate, Handle<Map> map,
     953             :                                              ElementsKind elements_kind,
     954             :                                              int modify_index,
     955             :                                              PropertyKind kind,
     956             :                                              PropertyAttributes attributes,
     957             :                                              const char* reason);
     958             : 
     959             :   void DeprecateTransitionTree(Isolate* isolate);
     960             : 
     961             :   void ReplaceDescriptors(Isolate* isolate, DescriptorArray new_descriptors,
     962             :                           LayoutDescriptor new_layout_descriptor);
     963             : 
     964             :   // Update field type of the given descriptor to new representation and new
     965             :   // type. The type must be prepared for storing in descriptor array:
     966             :   // it must be either a simple type or a map wrapped in a weak cell.
     967             :   void UpdateFieldType(Isolate* isolate, int descriptor_number,
     968             :                        Handle<Name> name, PropertyConstness new_constness,
     969             :                        Representation new_representation,
     970             :                        const MaybeObjectHandle& new_wrapped_type);
     971             : 
     972             :   // TODO(ishell): Move to MapUpdater.
     973             :   void PrintReconfiguration(Isolate* isolate, FILE* file, int modify_index,
     974             :                             PropertyKind kind, PropertyAttributes attributes);
     975             :   // TODO(ishell): Move to MapUpdater.
     976             :   void PrintGeneralization(
     977             :       Isolate* isolate, FILE* file, const char* reason, int modify_index,
     978             :       int split, int descriptors, bool constant_to_field,
     979             :       Representation old_representation, Representation new_representation,
     980             :       MaybeHandle<FieldType> old_field_type, MaybeHandle<Object> old_value,
     981             :       MaybeHandle<FieldType> new_field_type, MaybeHandle<Object> new_value);
     982             : 
     983             :   // Use the high-level instance_descriptors/SetInstanceDescriptors instead.
     984             :   inline void set_synchronized_instance_descriptors(
     985             :       DescriptorArray array, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
     986             : 
     987             :   static const int kFastPropertiesSoftLimit = 12;
     988             :   static const int kMaxFastProperties = 128;
     989             : 
     990             :   friend class MapUpdater;
     991             : 
     992 12353786470 :   OBJECT_CONSTRUCTORS(Map, HeapObject);
     993             : };
     994             : 
     995             : // The cache for maps used by normalized (dictionary mode) objects.
     996             : // Such maps do not have property descriptors, so a typical program
     997             : // needs very limited number of distinct normalized maps.
     998             : class NormalizedMapCache : public WeakFixedArray {
     999             :  public:
    1000             :   NEVER_READ_ONLY_SPACE
    1001             :   static Handle<NormalizedMapCache> New(Isolate* isolate);
    1002             : 
    1003             :   V8_WARN_UNUSED_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map,
    1004             :                                              PropertyNormalizationMode mode);
    1005             :   void Set(Handle<Map> fast_map, Handle<Map> normalized_map);
    1006             : 
    1007             :   DECL_CAST(NormalizedMapCache)
    1008             :   DECL_VERIFIER(NormalizedMapCache)
    1009             : 
    1010             :  private:
    1011             :   friend bool HeapObject::IsNormalizedMapCache() const;
    1012             : 
    1013             :   static const int kEntries = 64;
    1014             : 
    1015             :   static inline int GetIndex(Handle<Map> map);
    1016             : 
    1017             :   // The following declarations hide base class methods.
    1018             :   Object get(int index);
    1019             :   void set(int index, Object value);
    1020             : 
    1021             :   OBJECT_CONSTRUCTORS(NormalizedMapCache, WeakFixedArray);
    1022             : };
    1023             : 
    1024             : }  // namespace internal
    1025             : }  // namespace v8
    1026             : 
    1027             : #include "src/objects/object-macros-undef.h"
    1028             : 
    1029             : #endif  // V8_OBJECTS_MAP_H_

Generated by: LCOV version 1.10