2008-09-09 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2008 07:58:53 +0000 (07:58 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2008 07:58:53 +0000 (07:58 +0000)
        Reviewed by Sam Weinig.

        - allow polymorphic inline cache to handle Math object functions and possibly other similar things

        1.012x speedup on SunSpider.

        * kjs/MathObject.cpp:
        (JSC::MathObject::getOwnPropertySlot):
        * kjs/lookup.cpp:
        (JSC::setUpStaticFunctionSlot):
        * kjs/lookup.h:
        (JSC::getStaticPropertySlot):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36286 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/MathObject.cpp
JavaScriptCore/kjs/lookup.cpp
JavaScriptCore/kjs/lookup.h

index 46d2bd448655c3aaacfa1f078c97ce4e6ae40430..b19e51fc70a0b496aea2b3cc0a8b27b96aa2f157 100644 (file)
@@ -1,3 +1,18 @@
+2008-09-09  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+        
+        - allow polymorphic inline cache to handle Math object functions and possibly other similar things
+        
+        1.012x speedup on SunSpider.
+
+        * kjs/MathObject.cpp:
+        (JSC::MathObject::getOwnPropertySlot):
+        * kjs/lookup.cpp:
+        (JSC::setUpStaticFunctionSlot):
+        * kjs/lookup.h:
+        (JSC::getStaticPropertySlot):
+
 2008-09-08  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Maciej Stachowiak and Oliver Hunt.
index 0cc27bbe18f3ce92c263960dc0c6a7f410123c77..d726b5f568e16de15bdf19baefc019e193e81e16 100644 (file)
@@ -106,7 +106,7 @@ bool MathObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
         return JSObject::getOwnPropertySlot(exec, propertyName, slot);
 
     ASSERT(entry->attributes & Function);
-    slot.setStaticEntry(this, entry, staticFunctionGetter);
+    setUpStaticFunctionSlot(exec, entry, this, propertyName, slot);
     return true;
 }
 
index 60a4ed2c225dab748b5e936f62d52b893e62fdad..b8a3f4f338c8614deb24a1d4585ab6c241d5d1eb 100644 (file)
@@ -72,10 +72,14 @@ JSValue* staticFunctionGetter(ExecState* exec, const Identifier& propertyName, c
 void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot)
 {
     ASSERT(entry->attributes & Function);
-    PrototypeFunction* function = new (exec) PrototypeFunction(exec, entry->length, propertyName, entry->functionValue);
-    thisObj->putDirect(propertyName, function, entry->attributes);
-    
     JSValue** location = thisObj->getDirectLocation(propertyName);
+    if (!location) {
+        PrototypeFunction* function = new (exec) PrototypeFunction(exec, entry->length, propertyName, entry->functionValue);
+        thisObj->putDirect(propertyName, function, entry->attributes);
+        location = thisObj->getDirectLocation(propertyName);
+    }
+    
     slot.setValueSlot(thisObj, location, thisObj->offsetForLocation(location));
 }
 
index fe0a004814df235e49f3c50cb35fc8242ab2c18a..8b7900c16f80f4093af654fecdd2fb75dad2c497 100644 (file)
@@ -145,7 +145,7 @@ namespace JSC {
             return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
 
         if (entry->attributes & Function)
-            slot.setStaticEntry(thisObj, entry, staticFunctionGetter);
+            setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
         else
             slot.setStaticEntry(thisObj, entry, staticValueGetter<ThisImp>);