Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: test/mjsunit/compiler/minus-zero.js

Issue 63423004: Introduce %_IsMinusZero. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: extended test case Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/minus-zero.js
diff --git a/test/mjsunit/compiler/minus-zero.js b/test/mjsunit/compiler/minus-zero.js
index 6efceb54e36834c217732a7974f0c5d2a2cca132..c161257d77a838b1d81b3454ae5d30b0a33b6425 100644
--- a/test/mjsunit/compiler/minus-zero.js
+++ b/test/mjsunit/compiler/minus-zero.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --allow-natives-syntax --no-fold-constants
function add(x, y) {
return x + y;
@@ -35,3 +35,59 @@ assertEquals(0, add(0, 0));
assertEquals(0, add(0, 0));
%OptimizeFunctionOnNextCall(add);
assertEquals(-0, add(-0, -0));
+
+
+function test(x, y) {
+ assertTrue(%_IsMinusZero(-0));
+ assertTrue(%_IsMinusZero(1/(-Infinity)));
+ assertTrue(%_IsMinusZero(x));
+
+ assertFalse(%_IsMinusZero(0));
+ assertFalse(%_IsMinusZero(1/Infinity));
+ assertFalse(%_IsMinusZero(0.1));
+ assertFalse(%_IsMinusZero(-0.2));
+ assertFalse(%_IsMinusZero({}));
+ assertFalse(%_IsMinusZero(""));
+ assertFalse(%_IsMinusZero("-0"));
+ assertFalse(%_IsMinusZero(function() {}));
+ assertFalse(%_IsMinusZero(y));
+}
+
+test(-0, 1.2);
+test(-0, 1.2);
+%OptimizeFunctionOnNextCall(test);
+test(-0, 1.2);
+assertOptimized(test);
+
+
+function testsin() {
+ assertTrue(%_IsMinusZero(Math.sin(-0)));
+}
+
+testsin();
+testsin();
+%OptimizeFunctionOnNextCall(testsin);
+testsin();
+
+
+function testfloor() {
+ assertTrue(%_IsMinusZero(Math.floor(-0)));
+ assertFalse(%_IsMinusZero(Math.floor(2)));
+}
+
+testfloor();
+testfloor();
+%OptimizeFunctionOnNextCall(testfloor);
+testfloor();
+
+
+var double_one = Math.cos(0);
+
+function add(a, b) {
+ return a + b;
+}
+
+assertEquals(1, 1/add(double_one, 0));
+assertEquals(1, 1/add(0, double_one));
+%OptimizeFunctionOnNextCall(add);
+assertEquals(1/(-0 + -0), 1/add(-0, -0));
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698