Structure* Structure::removePropertyTransition(VM& vm, Structure* structure, PropertyName propertyName, PropertyOffset& offset) { // NOTE: There are some good reasons why this goes directly to uncacheable dictionary rather than // caching the removal. We can fix all of these things, but we must remember to do so, if we ever try // to optimize this case. // // - Cached transitions usually steal the property table, and assume that this is possible because they // can just rebuild the table by looking at past transitions. That code assumes that the table only // grew and never shrank. To support removals, we'd have to change the property table materialization // code to handle deletions. Also, we have logic to get the list of properties on a structure that // lacks a property table by just looking back through the set of transitions since the last // structure that had a pinned table. That logic would also have to be changed to handle cached // removals. // // - InferredTypeTable assumes that removal has never happened. This is important since if we could // remove a property and then re-add it later, then the "absence means top" optimization wouldn't // work anymore, unless removal also either poisoned type inference (by doing something equivalent to // hasBeenDictionary) or by strongly marking the entry as Top by ensuring that it is not absent, but // instead, has a null entry. ASSERT(!structure->isUncacheableDictionary()); Structure* transition = toUncacheableDictionaryTransition(vm, structure); offset = transition->remove(propertyName); transition->checkOffsetConsistency(); return transition; }
Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, PropertyOffset& offset) { ASSERT(!structure->isUncacheableDictionary()); Structure* transition = toUncacheableDictionaryTransition(globalData, structure); offset = transition->remove(propertyName); return transition; }
Structure* Structure::removePropertyTransition(VM& vm, Structure* structure, PropertyName propertyName, PropertyOffset& offset) { ASSERT(!structure->isUncacheableDictionary()); Structure* transition = toUncacheableDictionaryTransition(vm, structure); offset = transition->remove(propertyName); transition->checkOffsetConsistency(); return transition; }