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

Side by Side Diff: test/mjsunit/compiler/minus-zero.js

Issue 1680783002: [intrinsics] Kill the %_IsMinusZero intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 19 matching lines...) Expand all
30 function add(x, y) { 30 function add(x, y) {
31 return x + y; 31 return x + y;
32 } 32 }
33 33
34 assertEquals(0, add(0, 0)); 34 assertEquals(0, add(0, 0));
35 assertEquals(0, add(0, 0)); 35 assertEquals(0, add(0, 0));
36 %OptimizeFunctionOnNextCall(add); 36 %OptimizeFunctionOnNextCall(add);
37 assertEquals(-0, add(-0, -0)); 37 assertEquals(-0, add(-0, -0));
38 38
39 39
40 function test(x, y) {
41 assertTrue(%_IsMinusZero(-0));
42 assertTrue(%_IsMinusZero(1/(-Infinity)));
43 assertTrue(%_IsMinusZero(x));
44
45 assertFalse(%_IsMinusZero(0));
46 assertFalse(%_IsMinusZero(1/Infinity));
47 assertFalse(%_IsMinusZero(0.1));
48 assertFalse(%_IsMinusZero(-0.2));
49 assertFalse(%_IsMinusZero({}));
50 assertFalse(%_IsMinusZero(""));
51 assertFalse(%_IsMinusZero("-0"));
52 assertFalse(%_IsMinusZero(function() {}));
53 assertFalse(%_IsMinusZero(y));
54 }
55
56 test(-0, 1.2);
57 test(-0, 1.2);
58 %OptimizeFunctionOnNextCall(test);
59 test(-0, 1.2);
60 assertOptimized(test);
61
62
63 function testsin() { 40 function testsin() {
64 assertTrue(%_IsMinusZero(Math.sin(-0))); 41 assertEquals(-0, Math.sin(-0));
65 } 42 }
66 43
67 testsin(); 44 testsin();
68 testsin(); 45 testsin();
69 %OptimizeFunctionOnNextCall(testsin); 46 %OptimizeFunctionOnNextCall(testsin);
70 testsin(); 47 testsin();
71 48
72 49
73 function testfloor() { 50 function testfloor() {
74 assertTrue(%_IsMinusZero(Math.floor(-0))); 51 assertEquals(-0, Math.floor(-0));
75 assertFalse(%_IsMinusZero(Math.floor(2)));
76 } 52 }
77 53
78 testfloor(); 54 testfloor();
79 testfloor(); 55 testfloor();
80 %OptimizeFunctionOnNextCall(testfloor); 56 %OptimizeFunctionOnNextCall(testfloor);
81 testfloor(); 57 testfloor();
82 58
83 59
84 var double_one = Math.cos(0); 60 var double_one = Math.cos(0);
85 61
86 function add(a, b) { 62 function add(a, b) {
87 return a + b; 63 return a + b;
88 } 64 }
89 65
90 assertEquals(1, 1/add(double_one, 0)); 66 assertEquals(1, 1/add(double_one, 0));
91 assertEquals(1, 1/add(0, double_one)); 67 assertEquals(1, 1/add(0, double_one));
92 %OptimizeFunctionOnNextCall(add); 68 %OptimizeFunctionOnNextCall(add);
93 assertEquals(1/(-0 + -0), 1/add(-0, -0)); 69 assertEquals(1/(-0 + -0), 1/add(-0, -0));
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-intrinsics.cc ('k') | test/mjsunit/constant-fold-control-instructions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698