Title: [148036] trunk/Source/_javascript_Core
Revision
148036
Author
[email protected]
Date
2013-04-09 12:16:18 -0700 (Tue, 09 Apr 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (148035 => 148036)


--- trunk/Source/_javascript_Core/ChangeLog	2013-04-09 19:10:36 UTC (rev 148035)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-04-09 19:16:18 UTC (rev 148036)
@@ -1,3 +1,18 @@
+2013-04-08  Mark Hahnenberg  <[email protected]>
+
+        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):
+
 2013-04-09  Ryosuke Niwa  <[email protected]>
 
         Remove yarr.gyp

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (148035 => 148036)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2013-04-09 19:10:36 UTC (rev 148035)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2013-04-09 19:16:18 UTC (rev 148036)
@@ -1532,10 +1532,12 @@
 void JSObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
     getClassPropertyNames(exec, object->classInfo(), propertyNames, mode, object->staticFunctionsReified());
-    size_t preStructurePropertyNamesCount = propertyNames.size();
+
+    bool canCachePropertiesFromStructure = !propertyNames.size();
     object->structure()->getPropertyNamesFromStructure(exec->globalData(), propertyNames, mode);
-    size_t numCacheableSlots = preStructurePropertyNamesCount ? 0 : propertyNames.size();
-    propertyNames.setNumCacheableSlots(numCacheableSlots);
+
+    if (canCachePropertiesFromStructure)
+        propertyNames.setNumCacheableSlots(propertyNames.size());
 }
 
 double JSObject::toNumber(ExecState* exec) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to