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

Side by Side Diff: test/mjsunit/asm/if-reduction.js

Issue 2663243002: [asm] Fix lots of invalid asm.js tests (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « test/mjsunit/asm/if-folding.js ('k') | test/mjsunit/asm/if-tonumber.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function Module() { 5 function Module() {
6 "use asm"; 6 "use asm";
7 7
8 function if0() { 8 function if0() {
9 var x = 0 ? 11 : 12; 9 var x = 0;
10 return (x == 11) | 0; 10 x = 0 ? 11 : 12;
11 return ((x | 0) == 11) | 0;
11 } 12 }
12 13
13 function if1() { 14 function if1() {
14 var x = 1 ? 13 : 14; 15 var x = 0;
15 return (x == 13) | 0; 16 x = 1 ? 13 : 14;
17 return ((x | 0) == 13) | 0;
16 } 18 }
17 19
18 function if2() { 20 function if2() {
19 var x = 0 ? 15 : 16; 21 var x = 0;
20 return (x != 15) | 0; 22 x = 0 ? 15 : 16;
23 return ((x | 0) != 15) | 0;
21 } 24 }
22 25
23 function if3() { 26 function if3() {
24 var x = 1 ? 17 : 18; 27 var x = 0;
25 return (x != 17) | 0; 28 x = 1 ? 17 : 18;
29 return ((x | 0) != 17) | 0;
26 } 30 }
27 31
28 function if4() { 32 function if4() {
29 var x = 0 ? 19 : 20; 33 var x = 0;
30 var y = (x == 19) ? 21 : 22; 34 var y = 0;
31 return y; 35 x = 0 ? 19 : 20;
36 y = ((x | 0) == 19) ? 21 : 22;
37 return y | 0;
32 } 38 }
33 39
34 function if5() { 40 function if5() {
35 var x = 1 ? 23 : 24; 41 var x = 0;
36 var y = (x == 23) ? 25 : 26; 42 var y = 0;
37 return y; 43 x = 1 ? 23 : 24;
44 y = ((x | 0) == 23) ? 25 : 26;
45 return y | 0;
38 } 46 }
39 47
40 function if6() { 48 function if6() {
41 var x = 0 ? 27 : 28; 49 var x = 0;
42 var y = (x == 27) ? 29 : 30; 50 var y = 0;
43 var z = (y == 29) ? 31 : 32; 51 var z = 0;
44 return z; 52 x = 0 ? 27 : 28;
53 y = ((x | 0) == 27) ? 29 : 30;
54 z = ((y | 0) == 29) ? 31 : 32;
55 return z | 0;
45 } 56 }
46 57
47 function if7() { 58 function if7() {
48 var x = 1 ? 33 : 34; 59 var x = 0;
49 var y = (x == 33) ? 35 : 36; 60 var y = 0;
50 var z = (y == 35) ? 37 : 38; 61 var z = 0;
51 var w = (z == 37) ? 39 : 40; 62 var w = 0;
52 return w; 63 x = 1 ? 33 : 34;
64 y = ((x | 0) == 33) ? 35 : 36;
65 z = ((y | 0) == 35) ? 37 : 38;
66 w = ((z | 0) == 37) ? 39 : 40;
67 return w | 0;
53 } 68 }
54 69
55 function if8() { 70 function if8() {
71 var w = 0;
72 var x = 0;
73 var y = 0;
74 var z = 0;
56 if (0) { 75 if (0) {
57 var x = 0 ? 43 : 44; 76 x = 0 ? 43 : 44;
58 var y = (x == 43) ? 45 : 46; 77 y = ((x | 0) == 43) ? 45 : 46;
59 var z = (y == 45) ? 47 : 48; 78 z = ((y | 0) == 45) ? 47 : 48;
60 var w = (z == 47) ? 49 : 50; 79 w = ((z | 0) == 47) ? 49 : 50;
61 } else { 80 } else {
62 var x = 1 ? 53 : 54; 81 x = 1 ? 53 : 54;
63 var y = (x == 53) ? 55 : 56; 82 y = ((x | 0) == 53) ? 55 : 56;
64 var z = (y == 55) ? 57 : 58; 83 z = ((y | 0) == 55) ? 57 : 58;
65 var w = (z == 57) ? 59 : 60; 84 w = ((z | 0) == 57) ? 59 : 60;
66 } 85 }
67 return w; 86 return w | 0;
68 } 87 }
69 88
70 return {if0: if0, if1: if1, if2: if2, if3: if3, if4: if4, if5: if5, if6: if6, if7: if7, if8: if8 }; 89 return {if0: if0, if1: if1, if2: if2, if3: if3, if4: if4, if5: if5, if6: if6, if7: if7, if8: if8 };
71 } 90 }
72 91
73 var m = Module(); 92 var m = Module();
74 assertEquals(0, m.if0()); 93 assertEquals(0, m.if0());
75 assertEquals(1, m.if1()); 94 assertEquals(1, m.if1());
76 assertEquals(1, m.if2()); 95 assertEquals(1, m.if2());
77 assertEquals(0, m.if3()); 96 assertEquals(0, m.if3());
78 assertEquals(22, m.if4()); 97 assertEquals(22, m.if4());
79 assertEquals(25, m.if5()); 98 assertEquals(25, m.if5());
80 assertEquals(32, m.if6()); 99 assertEquals(32, m.if6());
81 assertEquals(39, m.if7()); 100 assertEquals(39, m.if7());
82 assertEquals(59, m.if8()); 101 assertEquals(59, m.if8());
83 102
84 103
85 function Spec(a,b) { 104 function Spec0(stdlib, foreign, heap) {
86 "use asm"; 105 "use asm";
87 106
88 var xx = a | 0; 107 var xx = foreign.a | 0;
89 var yy = b | 0; 108 var yy = foreign.b | 0;
90 109
91 function f() { 110 function f() {
111 var x = 0;
112 var y = 0;
113 var z = 0;
114 var w = 0;
92 if (xx) { 115 if (xx) {
93 var x = yy ? 43 : 44; 116 x = yy ? 43 : 44;
94 var y = (x == 43) ? 45 : 46; 117 y = ((x | 0) == 43) ? 45 : 46;
95 var z = (y == 45) ? 47 : 48; 118 z = ((y | 0) == 45) ? 47 : 48;
96 var w = (z == 47) ? 49 : 50; 119 w = ((z | 0) == 47) ? 49 : 50;
97 } else { 120 } else {
98 var x = yy ? 53 : 54; 121 x = yy ? 53 : 54;
99 var y = (x == 53) ? 55 : 56; 122 y = ((x | 0) == 53) ? 55 : 56;
100 var z = (y == 55) ? 57 : 58; 123 z = ((y | 0) == 55) ? 57 : 58;
101 var w = (z == 57) ? 59 : 60; 124 w = ((z | 0) == 57) ? 59 : 60;
102 } 125 }
103 return w; 126 return w | 0;
104 } 127 }
105 return {f: f}; 128 return {f: f};
106 } 129 }
130 var Spec = (a, b, c) => Spec0(this, {a: a, b: b, c: c});
107 131
108 assertEquals(60, Spec(0,0).f()); 132 assertEquals(60, Spec(0,0).f());
109 assertEquals(59, Spec(0,1).f()); 133 assertEquals(59, Spec(0,1).f());
110 assertEquals(50, Spec(1,0).f()); 134 assertEquals(50, Spec(1,0).f());
111 assertEquals(49, Spec(1,1).f()); 135 assertEquals(49, Spec(1,1).f());
OLDNEW
« no previous file with comments | « test/mjsunit/asm/if-folding.js ('k') | test/mjsunit/asm/if-tonumber.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698