[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 12:21:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 27c099642420c5a98927a95b40a1e2415704bf18
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 19 21:03:38 2010 +0000

    2010-08-19  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Geoffrey Garen.
    
            JSC: Move the static_cast into to(U)Int32 fast case
            https://bugs.webkit.org/show_bug.cgi?id=44037
    
            Do the static_cast<(u)int32_t> inline to avoid the function call overhead
            for easily converted values (within (u)int32_t range.)
    
            * runtime/JSValue.cpp:
            (JSC::toInt32SlowCase):
            (JSC::toUInt32SlowCase):
            * runtime/JSValue.h:
            (JSC::JSValue::toInt32):
            (JSC::JSValue::toUInt32):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65698 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index a704d2f..378f450 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-19  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Geoffrey Garen.
+
+        JSC: Move the static_cast into to(U)Int32 fast case
+        https://bugs.webkit.org/show_bug.cgi?id=44037
+
+        Do the static_cast<(u)int32_t> inline to avoid the function call overhead
+        for easily converted values (within (u)int32_t range.)
+
+        * runtime/JSValue.cpp:
+        (JSC::toInt32SlowCase):
+        (JSC::toUInt32SlowCase):
+        * runtime/JSValue.h:
+        (JSC::JSValue::toInt32):
+        (JSC::JSValue::toUInt32):
+
 2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/JavaScriptCore/runtime/JSValue.cpp b/JavaScriptCore/runtime/JSValue.cpp
index e752d3f..6db6954 100644
--- a/JavaScriptCore/runtime/JSValue.cpp
+++ b/JavaScriptCore/runtime/JSValue.cpp
@@ -137,16 +137,13 @@ char* JSValue::description()
 
 int32_t toInt32SlowCase(double d, bool& ok)
 {
-    ok = true;
-
-    if (d >= -D32 / 2 && d < D32 / 2)
-        return static_cast<int32_t>(d);
-
     if (isnan(d) || isinf(d)) {
         ok = false;
         return 0;
     }
 
+    ok = true;
+
     double d32 = fmod(trunc(d), D32);
     if (d32 >= D32 / 2)
         d32 -= D32;
@@ -157,16 +154,13 @@ int32_t toInt32SlowCase(double d, bool& ok)
 
 uint32_t toUInt32SlowCase(double d, bool& ok)
 {
-    ok = true;
-
-    if (d >= 0.0 && d < D32)
-        return static_cast<uint32_t>(d);
-
     if (isnan(d) || isinf(d)) {
         ok = false;
         return 0;
     }
 
+    ok = true;
+
     double d32 = fmod(trunc(d), D32);
     if (d32 < 0)
         d32 += D32;
diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index 3c6bc09..af4b0f4 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -397,16 +397,28 @@ namespace JSC {
     {
         if (isInt32())
             return asInt32();
+
+        double val = toNumber(exec);
+
+        if (val >= -2147483648.0 && val < 2147483648.0)
+            return static_cast<int32_t>(val);
+
         bool ignored;
-        return toInt32SlowCase(toNumber(exec), ignored);
+        return toInt32SlowCase(val, ignored);
     }
 
     inline uint32_t JSValue::toUInt32(ExecState* exec) const
     {
         if (isUInt32())
             return asInt32();
+
+        double val = toNumber(exec);
+
+        if (val >= 0.0 && val < 4294967296.0)
+            return static_cast<uint32_t>(val);
+
         bool ignored;
-        return toUInt32SlowCase(toNumber(exec), ignored);
+        return toUInt32SlowCase(val, ignored);
     }
 
     inline int32_t JSValue::toInt32(ExecState* exec, bool& ok) const
@@ -415,7 +427,15 @@ namespace JSC {
             ok = true;
             return asInt32();
         }
-        return toInt32SlowCase(toNumber(exec), ok);
+
+        double val = toNumber(exec);
+
+        if (val >= -2147483648.0 && val < 2147483648.0) {
+            ok = true;
+            return static_cast<int32_t>(val);
+        }
+
+        return toInt32SlowCase(val, ok);
     }
 
     inline uint32_t JSValue::toUInt32(ExecState* exec, bool& ok) const
@@ -424,7 +444,15 @@ namespace JSC {
             ok = true;
             return asInt32();
         }
-        return toUInt32SlowCase(toNumber(exec), ok);
+
+        double val = toNumber(exec);
+
+        if (val >= 0.0 && val < 4294967296.0) {
+            ok = true;
+            return static_cast<uint32_t>(val);
+        }
+
+        return toUInt32SlowCase(val, ok);
     }
 
 #if USE(JSVALUE32_64)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list