Changeset 148036 in webkit


Ignore:
Timestamp:
Apr 9, 2013 12:16:18 PM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

JSObject::getOwnNonIndexPropertyNames calculates numCacheableSlots incorrectly
https://bugs.webkit.org/show_bug.cgi?id=114235

Reviewed by Geoffrey Garen.

Due to the way that numCacheableSlots is currently calculated, checking an object's prototype for enumerable
properties causes us not to cache any properties at all. We should only cache properties on the object itself
since we currently don't take advantage of any sort of name caching for properties in the prototype chain.
This fix undoes a ~2% SunSpider regression caused by http://trac.webkit.org/changeset/147570.

  • runtime/JSObject.cpp:

(JSC::JSObject::getOwnNonIndexPropertyNames):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r147990 r148036  
     12013-04-08  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        JSObject::getOwnNonIndexPropertyNames calculates numCacheableSlots incorrectly
     4        https://bugs.webkit.org/show_bug.cgi?id=114235
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Due to the way that numCacheableSlots is currently calculated, checking an object's prototype for enumerable
     9        properties causes us not to cache any properties at all. We should only cache properties on the object itself
     10        since we currently don't take advantage of any sort of name caching for properties in the prototype chain.
     11        This fix undoes a ~2% SunSpider regression caused by http://trac.webkit.org/changeset/147570.
     12
     13        * runtime/JSObject.cpp:
     14        (JSC::JSObject::getOwnNonIndexPropertyNames):
     15
    1162013-04-09  Ryosuke Niwa  <rniwa@webkit.org>
    217
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r147892 r148036  
    15331533{
    15341534    getClassPropertyNames(exec, object->classInfo(), propertyNames, mode, object->staticFunctionsReified());
    1535     size_t preStructurePropertyNamesCount = propertyNames.size();
     1535
     1536    bool canCachePropertiesFromStructure = !propertyNames.size();
    15361537    object->structure()->getPropertyNamesFromStructure(exec->globalData(), propertyNames, mode);
    1537     size_t numCacheableSlots = preStructurePropertyNamesCount ? 0 : propertyNames.size();
    1538     propertyNames.setNumCacheableSlots(numCacheableSlots);
     1538
     1539    if (canCachePropertiesFromStructure)
     1540        propertyNames.setNumCacheableSlots(propertyNames.size());
    15391541}
    15401542
Note: See TracChangeset for help on using the changeset viewer.