Ignore:
Timestamp:
Aug 20, 2009, 3:36:36 PM (16 years ago)
Author:
[email protected]
Message:

REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest
https://bugs.webkit.org/show_bug.cgi?id=28332

Reviewed by Gavin Barraclough.

The method check optimisation made transitions aware of the value being
assigned when a transition was assigning a function. This had the side
effect of making every assignment of a function expression result in a
new transition, and thus a new Structure. The net result of this is that
the common JS idiom of

function MyObject() {

this.myFunction = function(...){...};

}
new MyObject();

Will produce a unique structure on every iteration, meaning that all
caching is defeated and there is a significant amount of structure churn.

The fix is to return the transition to its original form where it is
keyed off a property name + attributes tuple, but have each transition
support an optional transition on a specific value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSObject.h

    r47288 r47601  
    468468    }
    469469
     470    // If we have a specific function, we may have got to this point if there is
     471    // already a transition with the correct property name and attributes, but
     472    // specialized to a different function.  In this case we just want to give up
     473    // and despecialize the transition.
     474    // In this case we clear the value of specificFunction which will result
     475    // in us adding a non-specific transition, and any subsequent lookup in
     476    // Structure::addPropertyTransitionToExistingStructure will just use that.
     477    if (specificFunction && m_structure->hasTransition(propertyName, attributes))
     478        specificFunction = 0;
     479
    470480    RefPtr<Structure> structure = Structure::addPropertyTransition(m_structure, propertyName, attributes, specificFunction, offset);
     481
    471482    if (currentCapacity != structure->propertyStorageCapacity())
    472483        allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
Note: See TracChangeset for help on using the changeset viewer.