2008-03-18 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Mar 2008 09:42:58 +0000 (09:42 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Mar 2008 09:42:58 +0000 (09:42 +0000)
        Reviewed by Oliver.

        - a few micro-optimizations for 1.2% SunSpider speedup

        * kjs/function.cpp:
        (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
        it is more likely.
        * kjs/object.cpp:
        (KJS::JSObject::put): When walking prototype chain, instead of
        checking isObject (a virtual call), compare to jsNull (compare to
        a constant) since null is the only non-object that can be in a
        prototype chain.

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

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/object.cpp

index 95f9d5a131866beb8572a204476a06934fb30473..0ebb8c0ffb26b11825280ee2062a258190014686 100644 (file)
@@ -1,3 +1,18 @@
+2008-03-18  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver.
+        
+        - a few micro-optimizations for 1.2% SunSpider speedup
+
+        * kjs/function.cpp:
+        (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
+        it is more likely.
+        * kjs/object.cpp:
+        (KJS::JSObject::put): When walking prototype chain, instead of
+        checking isObject (a virtual call), compare to jsNull (compare to
+        a constant) since null is the only non-object that can be in a
+        prototype chain.
+
 2008-03-17  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Geoff.
index d9a388e9d464ebbcb223a2bbd1743d0a5e0c80c6..38c79d52e0aab06835aec842e8f11ab209f1fad4 100644 (file)
@@ -74,12 +74,12 @@ JSValue* FunctionImp::callAsFunction(ExecState* exec, JSObject* thisObj, const L
 {
     FunctionExecState newExec(exec->dynamicGlobalObject(), thisObj, body.get(), exec, this, args);
     JSValue* result = body->execute(&newExec);
+    if (newExec.completionType() == ReturnValue)
+        return result;
     if (newExec.completionType() == Throw) {
         exec->setException(result);
         return result;
     }
-    if (newExec.completionType() == ReturnValue)
-        return result;
     return jsUndefined();
 }
 
index 9f1c2cf0db900f4e5a7ddc49fb40ab10d5af0949..79f42281b7c845d7a5d0c29a24dc3fe366aa7318 100644 (file)
@@ -229,7 +229,7 @@ void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *val
       break;
     }
       
-    if (!obj->_proto->isObject())
+    if (obj->_proto == jsNull())
       break;
       
     obj = static_cast<JSObject *>(obj->_proto);