Title: [150659] trunk
Revision
150659
Author
fpi...@apple.com
Date
2013-05-24 15:00:21 -0700 (Fri, 24 May 2013)

Log Message

We broke !(0/0)
https://bugs.webkit.org/show_bug.cgi?id=116736

Reviewed by Gavin Barraclough.

Source/_javascript_Core: 

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createLogicalNot):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::pureToBoolean):

Source/WTF: 

* wtf/MathExtras.h:
(isNotZeroAndOrdered):
(isZeroOrUnordered):

LayoutTests: 

* fast/js/constant-fold-not-nan.html: Added.
* fast/js/constant-fold-not-nan-expected.txt: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/constant-fold-not-nan.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (150658 => 150659)


--- trunk/LayoutTests/ChangeLog	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/LayoutTests/ChangeLog	2013-05-24 22:00:21 UTC (rev 150659)
@@ -1,3 +1,15 @@
+2013-05-24  Filip Pizlo  <fpi...@apple.com>
+
+        We broke !(0/0)
+        https://bugs.webkit.org/show_bug.cgi?id=116736
+
+        Reviewed by Gavin Barraclough.
+
+        * fast/js/constant-fold-not-nan.html: Added.
+        * fast/js/constant-fold-not-nan-expected.txt: Added.
+        * fast/js/jsc-test-list:
+        * fast/js/script-tests/constant-fold-not-nan.js: Added.
+
 2013-05-24  Sergio Villar Senin  <svil...@igalia.com>
 
         REGRESSION (r150215): broke a test case in inspector/console/console-css-warnings.html

Added: trunk/LayoutTests/fast/js/constant-fold-not-nan-expected.txt (0 => 150659)


--- trunk/LayoutTests/fast/js/constant-fold-not-nan-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/constant-fold-not-nan-expected.txt	2013-05-24 22:00:21 UTC (rev 150659)
@@ -0,0 +1,10 @@
+Tests that our parse-time constant folding treats !(0/0) correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS !(0/0) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/constant-fold-not-nan.html (0 => 150659)


--- trunk/LayoutTests/fast/js/constant-fold-not-nan.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/constant-fold-not-nan.html	2013-05-24 22:00:21 UTC (rev 150659)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/fast/js/jsc-test-list (150658 => 150659)


--- trunk/LayoutTests/fast/js/jsc-test-list	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/LayoutTests/fast/js/jsc-test-list	2013-05-24 22:00:21 UTC (rev 150659)
@@ -54,6 +54,7 @@
 fast/js/constant-count
 fast/js/constant-encoding
 fast/js/constant-folding
+fast/js/constant-fold-not-nan
 fast/js/continue-break-multiple-labels
 fast/js/convert-nan-to-bool
 fast/js/cyclic-prototypes

Added: trunk/LayoutTests/fast/js/script-tests/constant-fold-not-nan.js (0 => 150659)


--- trunk/LayoutTests/fast/js/script-tests/constant-fold-not-nan.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/constant-fold-not-nan.js	2013-05-24 22:00:21 UTC (rev 150659)
@@ -0,0 +1,5 @@
+description(
+"Tests that our parse-time constant folding treats !(0/0) correctly."
+);
+
+shouldBe("!(0/0)", "true");

Modified: trunk/Source/_javascript_Core/ChangeLog (150658 => 150659)


--- trunk/Source/_javascript_Core/ChangeLog	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-05-24 22:00:21 UTC (rev 150659)
@@ -1,3 +1,15 @@
+2013-05-24  Filip Pizlo  <fpi...@apple.com>
+
+        We broke !(0/0)
+        https://bugs.webkit.org/show_bug.cgi?id=116736
+
+        Reviewed by Gavin Barraclough.
+
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::createLogicalNot):
+        * runtime/JSCJSValueInlines.h:
+        (JSC::JSValue::pureToBoolean):
+
 2013-05-24  Julien Brianceau  <jbrianc...@nds.com>
 
         [sh4] Optimize LLINT generated code and fix few bugs in baseline JIT.

Modified: trunk/Source/_javascript_Core/parser/ASTBuilder.h (150658 => 150659)


--- trunk/Source/_javascript_Core/parser/ASTBuilder.h	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/Source/_javascript_Core/parser/ASTBuilder.h	2013-05-24 22:00:21 UTC (rev 150659)
@@ -148,7 +148,7 @@
     ExpressionNode* createLogicalNot(const JSTokenLocation& location, ExpressionNode* expr)
     {
         if (expr->isNumber())
-            return createBoolean(location, !static_cast<NumberNode*>(expr)->value());
+            return createBoolean(location, isZeroOrUnordered(static_cast<NumberNode*>(expr)->value()));
 
         return new (m_vm) LogicalNotNode(location, expr);
     }

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (150658 => 150659)


--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h	2013-05-24 22:00:21 UTC (rev 150659)
@@ -798,7 +798,7 @@
     if (isInt32())
         return asInt32() ? TrueTriState : FalseTriState;
     if (isDouble())
-        return (asDouble() > 0.0 || asDouble() < 0.0) ? TrueTriState : FalseTriState; // false for NaN
+        return isNotZeroAndOrdered(asDouble()) ? TrueTriState : FalseTriState; // false for NaN
     if (isCell())
         return asCell()->pureToBoolean();
     return isTrue() ? TrueTriState : FalseTriState;

Modified: trunk/Source/WTF/ChangeLog (150658 => 150659)


--- trunk/Source/WTF/ChangeLog	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/Source/WTF/ChangeLog	2013-05-24 22:00:21 UTC (rev 150659)
@@ -1,3 +1,14 @@
+2013-05-24  Filip Pizlo  <fpi...@apple.com>
+
+        We broke !(0/0)
+        https://bugs.webkit.org/show_bug.cgi?id=116736
+
+        Reviewed by Gavin Barraclough.
+
+        * wtf/MathExtras.h:
+        (isNotZeroAndOrdered):
+        (isZeroOrUnordered):
+
 2013-05-24  Anders Carlsson  <ander...@apple.com>
 
         Remove PagePopup code

Modified: trunk/Source/WTF/wtf/MathExtras.h (150658 => 150659)


--- trunk/Source/WTF/wtf/MathExtras.h	2013-05-24 21:45:44 UTC (rev 150658)
+++ trunk/Source/WTF/wtf/MathExtras.h	2013-05-24 22:00:21 UTC (rev 150659)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -346,6 +346,16 @@
     return value + (value >> 1) + (value & 1);
 }
 
+template<typename T> inline bool isNotZeroAndOrdered(T value)
+{
+    return value > 0.0 || value < 0.0;
+}
+
+template<typename T> inline bool isZeroOrUnordered(T value)
+{
+    return !isNotZeroAndOrdered(value);
+}
+
 #ifndef UINT64_C
 #if COMPILER(MSVC)
 #define UINT64_C(c) c ## ui64
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to