diff options
Diffstat (limited to 'deps/v8/src/objects/map.h')
-rw-r--r-- | deps/v8/src/objects/map.h | 127 |
1 files changed, 62 insertions, 65 deletions
diff --git a/deps/v8/src/objects/map.h b/deps/v8/src/objects/map.h index 09afb83a8f1..397f8746104 100644 --- a/deps/v8/src/objects/map.h +++ b/deps/v8/src/objects/map.h @@ -16,52 +16,52 @@ namespace v8 { namespace internal { -#define VISITOR_ID_LIST(V) \ - V(AllocationSite) \ - V(BigInt) \ - V(ByteArray) \ - V(BytecodeArray) \ - V(Cell) \ - V(Code) \ - V(CodeDataContainer) \ - V(ConsString) \ - V(DataHandler) \ - V(DataObject) \ - V(EphemeronHashTable) \ - V(FeedbackCell) \ - V(FeedbackVector) \ - V(FixedArray) \ - V(FixedDoubleArray) \ - V(FixedFloat64Array) \ - V(FixedTypedArrayBase) \ - V(FreeSpace) \ - V(JSApiObject) \ - V(JSArrayBuffer) \ - V(JSFunction) \ - V(JSObject) \ - V(JSObjectFast) \ - V(JSWeakCollection) \ - V(Map) \ - V(NativeContext) \ - V(Oddball) \ - V(PreParsedScopeData) \ - V(PropertyArray) \ - V(PropertyCell) \ - V(PrototypeInfo) \ - V(SeqOneByteString) \ - V(SeqTwoByteString) \ - V(SharedFunctionInfo) \ - V(ShortcutCandidate) \ - V(SlicedString) \ - V(SmallOrderedHashMap) \ - V(SmallOrderedHashSet) \ - V(Struct) \ - V(Symbol) \ - V(ThinString) \ - V(TransitionArray) \ - V(UncompiledDataWithPreParsedScope) \ - V(WasmInstanceObject) \ - V(WeakCell) \ +#define VISITOR_ID_LIST(V) \ + V(AllocationSite) \ + V(BigInt) \ + V(ByteArray) \ + V(BytecodeArray) \ + V(Cell) \ + V(Code) \ + V(CodeDataContainer) \ + V(ConsString) \ + V(DataHandler) \ + V(DataObject) \ + V(EphemeronHashTable) \ + V(FeedbackCell) \ + V(FeedbackVector) \ + V(FixedArray) \ + V(FixedDoubleArray) \ + V(FixedFloat64Array) \ + V(FixedTypedArrayBase) \ + V(FreeSpace) \ + V(JSApiObject) \ + V(JSArrayBuffer) \ + V(JSFunction) \ + V(JSObject) \ + V(JSObjectFast) \ + V(JSWeakCollection) \ + V(Map) \ + V(NativeContext) \ + V(Oddball) \ + V(PreParsedScopeData) \ + V(PropertyArray) \ + V(PropertyCell) \ + V(PrototypeInfo) \ + V(SeqOneByteString) \ + V(SeqTwoByteString) \ + V(SharedFunctionInfo) \ + V(ShortcutCandidate) \ + V(SlicedString) \ + V(SmallOrderedHashMap) \ + V(SmallOrderedHashSet) \ + V(Struct) \ + V(Symbol) \ + V(ThinString) \ + V(TransitionArray) \ + V(UncompiledDataWithoutPreParsedScope) \ + V(UncompiledDataWithPreParsedScope) \ + V(WasmInstanceObject) \ V(WeakArray) // For data objects, JS objects and structs along with generic visitor which @@ -166,8 +166,6 @@ typedef std::vector<Handle<Map>> MapHandles; // +*************************************************************+ // | TaggedPointer | [dependent_code] | // +---------------+---------------------------------------------+ -// | TaggedPointer | [weak_cell_cache] | -// +---------------+---------------------------------------------+ class Map : public HeapObject { public: @@ -213,11 +211,14 @@ class Map : public HeapObject { // Tells how many unused property fields (in-object or out-of object) are // available in the instance (only used for JSObject in fast mode). inline int UnusedPropertyFields() const; + // Tells how many unused in-object property words are present. + inline int UnusedInObjectProperties() const; // Updates the counters tracking unused fields in the object. inline void SetInObjectUnusedPropertyFields(int unused_property_fields); // Updates the counters tracking unused fields in the property array. inline void SetOutOfObjectUnusedPropertyFields(int unused_property_fields); inline void CopyUnusedPropertyFields(Map* map); + inline void CopyUnusedPropertyFieldsAdjustedForInstanceSize(Map* map); inline void AccountAddedPropertyField(); inline void AccountAddedOutOfObjectPropertyField( int unused_in_property_array); @@ -328,6 +329,11 @@ class Map : public HeapObject { // Does the tracking step. inline void InobjectSlackTrackingStep(Isolate* isolate); + // Computes inobject slack for the transition tree starting at this initial + // map. + int ComputeMinObjectSlack(Isolate* isolate); + inline int InstanceSizeFromSlack(int slack) const; + // Completes inobject slack tracking for the transition tree starting at this // initial map. void CompleteInobjectSlackTracking(Isolate* isolate); @@ -441,11 +447,6 @@ class Map : public HeapObject { // Return the map of the root of object's prototype chain. Map* GetPrototypeChainRootMap(Isolate* isolate) const; - // Returns a WeakCell object containing given prototype. The cell is cached - // in PrototypeInfo which is created lazily. - static Handle<WeakCell> GetOrCreatePrototypeWeakCell( - Handle<JSReceiver> prototype, Isolate* isolate); - Map* FindRootMap(Isolate* isolate) const; Map* FindFieldOwner(Isolate* isolate, int descriptor) const; @@ -574,9 +575,6 @@ class Map : public HeapObject { // [dependent code]: list of optimized codes that weakly embed this map. DECL_ACCESSORS(dependent_code, DependentCode) - // [weak cell cache]: cache that stores a weak cell pointing to this map. - DECL_ACCESSORS(weak_cell_cache, Object) - // [prototype_validity_cell]: Cell containing the validity bit for prototype // chains or Smi(0) if uninitialized. // The meaning of this validity cell is different for prototype maps and @@ -656,7 +654,8 @@ class Map : public HeapObject { Descriptor* descriptor, TransitionFlag flag); - static MaybeObjectHandle WrapFieldType(Handle<FieldType> type); + static MaybeObjectHandle WrapFieldType(Isolate* isolate, + Handle<FieldType> type); static FieldType* UnwrapFieldType(MaybeObject* wrapped_type); V8_WARN_UNUSED_RESULT static MaybeHandle<Map> CopyWithField( @@ -762,6 +761,9 @@ class Map : public HeapObject { inline bool CanTransition() const; inline bool IsBooleanMap() const; + inline bool IsNullMap() const; + inline bool IsUndefinedMap() const; + inline bool IsNullOrUndefinedMap() const; inline bool IsPrimitiveMap() const; inline bool IsJSReceiverMap() const; inline bool IsJSObjectMap() const; @@ -780,8 +782,6 @@ class Map : public HeapObject { bool IsMapInArrayPrototypeChain(Isolate* isolate) const; - static Handle<WeakCell> WeakCellForMap(Isolate* isolate, Handle<Map> map); - // Dispatched behavior. DECL_PRINTER(Map) DECL_VERIFIER(Map) @@ -820,7 +820,6 @@ class Map : public HeapObject { V(kDescriptorsOffset, kPointerSize) \ V(kLayoutDescriptorOffset, FLAG_unbox_double_fields ? kPointerSize : 0) \ V(kDependentCodeOffset, kPointerSize) \ - V(kWeakCellCacheOffset, kPointerSize) \ V(kPrototypeValidityCellOffset, kPointerSize) \ V(kPointerFieldsEndOffset, 0) \ /* Total size. */ \ @@ -969,7 +968,8 @@ class Map : public HeapObject { // The cache for maps used by normalized (dictionary mode) objects. // Such maps do not have property descriptors, so a typical program // needs very limited number of distinct normalized maps. -class NormalizedMapCache : public FixedArray, public NeverReadOnlySpaceObject { +class NormalizedMapCache : public WeakFixedArray, + public NeverReadOnlySpaceObject { public: using NeverReadOnlySpaceObject::GetHeap; using NeverReadOnlySpaceObject::GetIsolate; @@ -978,10 +978,7 @@ class NormalizedMapCache : public FixedArray, public NeverReadOnlySpaceObject { V8_WARN_UNUSED_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map, PropertyNormalizationMode mode); - void Set(Handle<Map> fast_map, Handle<Map> normalized_map, - Handle<WeakCell> normalized_map_weak_cell); - - void Clear(); + void Set(Handle<Map> fast_map, Handle<Map> normalized_map); DECL_CAST(NormalizedMapCache) |