Title: [103023] trunk/Source/_javascript_Core
Revision
103023
Author
[email protected]
Date
2011-12-15 21:32:58 -0800 (Thu, 15 Dec 2011)

Log Message

Value profiling should distinguished between NaN and non-NaN doubles
https://bugs.webkit.org/show_bug.cgi?id=74682

Reviewed by Gavin Barraclough.
        
Added PredictDoubleReal and PredictDoubleNaN. PredictDouble is now the union
of the two.

* bytecode/PredictedType.cpp:
(JSC::predictionToString):
(JSC::predictionFromValue):
* bytecode/PredictedType.h:
(JSC::isDoubleRealPrediction):
(JSC::isDoublePrediction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (103022 => 103023)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-16 05:22:48 UTC (rev 103022)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-16 05:32:58 UTC (rev 103023)
@@ -1,3 +1,20 @@
+2011-12-15  Filip Pizlo  <[email protected]>
+
+        Value profiling should distinguished between NaN and non-NaN doubles
+        https://bugs.webkit.org/show_bug.cgi?id=74682
+
+        Reviewed by Gavin Barraclough.
+        
+        Added PredictDoubleReal and PredictDoubleNaN. PredictDouble is now the union
+        of the two.
+
+        * bytecode/PredictedType.cpp:
+        (JSC::predictionToString):
+        (JSC::predictionFromValue):
+        * bytecode/PredictedType.h:
+        (JSC::isDoubleRealPrediction):
+        (JSC::isDoublePrediction):
+
 2011-12-15  Anders Carlsson  <[email protected]>
 
         Regression (r102866): Navigating away from or closing a page with a plugin crashes

Modified: trunk/Source/_javascript_Core/bytecode/PredictedType.cpp (103022 => 103023)


--- trunk/Source/_javascript_Core/bytecode/PredictedType.cpp	2011-12-16 05:22:48 UTC (rev 103022)
+++ trunk/Source/_javascript_Core/bytecode/PredictedType.cpp	2011-12-16 05:32:58 UTC (rev 103023)
@@ -128,11 +128,16 @@
     else
         isTop = false;
     
-    if (value & PredictDouble)
-        ptr.strcat("Double");
+    if (value & PredictDoubleReal)
+        ptr.strcat("Doublereal");
     else
         isTop = false;
     
+    if (value & PredictDoubleNaN)
+        ptr.strcat("Doublenan");
+    else
+        isTop = false;
+    
     if (value & PredictBoolean)
         ptr.strcat("Bool");
     else
@@ -212,8 +217,12 @@
 {
     if (value.isInt32())
         return PredictInt32;
-    if (value.isDouble())
-        return PredictDouble;
+    if (value.isDouble()) {
+        double number = value.asNumber();
+        if (number == number)
+            return PredictDoubleReal;
+        return PredictDoubleNaN;
+    }
     if (value.isCell())
         return predictionFromCell(value.asCell());
     if (value.isBoolean())

Modified: trunk/Source/_javascript_Core/bytecode/PredictedType.h (103022 => 103023)


--- trunk/Source/_javascript_Core/bytecode/PredictedType.h	2011-12-16 05:22:48 UTC (rev 103022)
+++ trunk/Source/_javascript_Core/bytecode/PredictedType.h	2011-12-16 05:32:58 UTC (rev 103023)
@@ -55,9 +55,11 @@
 static const PredictedType PredictCellOther     = 0x00004000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString.
 static const PredictedType PredictCell          = 0x00007fff; // It's definitely a JSCell.
 static const PredictedType PredictInt32         = 0x00008000; // It's definitely an Int32.
-static const PredictedType PredictDouble        = 0x00010000; // It's definitely a Double.
-static const PredictedType PredictNumber        = 0x00018000; // It's either an Int32 or a Double.
-static const PredictedType PredictBoolean       = 0x00020000; // It's definitely a Boolean.
+static const PredictedType PredictDoubleReal    = 0x00010000; // It's definitely a non-NaN double.
+static const PredictedType PredictDoubleNaN     = 0x00020000; // It's definitely a NaN.
+static const PredictedType PredictDouble        = 0x00030000; // It's either a non-NaN or a NaN double.
+static const PredictedType PredictNumber        = 0x00038000; // It's either an Int32 or a Double.
+static const PredictedType PredictBoolean       = 0x00040000; // It's definitely a Boolean.
 static const PredictedType PredictOther         = 0x40000000; // It's definitely none of the above.
 static const PredictedType PredictTop           = 0x7fffffff; // It can be any of the above.
 static const PredictedType FixedIndexedStorageMask = PredictByteArray | PredictInt8Array | PredictInt16Array | PredictInt32Array | PredictUint8Array | PredictUint16Array | PredictUint32Array | PredictFloat32Array | PredictFloat64Array;
@@ -159,9 +161,14 @@
     return value == PredictInt32;
 }
 
+inline bool isDoubleRealPrediction(PredictedType value)
+{
+    return value == PredictDoubleReal;
+}
+
 inline bool isDoublePrediction(PredictedType value)
 {
-    return value == PredictDouble;
+    return (value & PredictDouble) == value;
 }
 
 inline bool isNumberPrediction(PredictedType value)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to