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

Side by Side Diff: test/mjsunit/asm/math-abs.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/load-elimination.js ('k') | test/mjsunit/asm/math-ceil.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(stdlib) { 5 function Module(stdlib) {
6 "use asm"; 6 "use asm";
7 7
8 var abs = stdlib.Math.abs; 8 var abs = stdlib.Math.abs;
9 9
10 // f: double -> double 10 // f: double -> double
11 function f(a) { 11 function f(a) {
12 a = +a; 12 a = +a;
13 return +abs(a); 13 return +abs(a);
14 } 14 }
15 15
16 // g: unsigned -> double 16 // g: unsigned -> double
17 function g(a) { 17 function g(a) {
18 a = a>>>0; 18 a = a | 0;
19 return +abs(a); 19 return +abs(+(a >>> 0));
20 } 20 }
21 21
22 // h: signed -> double 22 // h: signed -> double
23 function h(a) { 23 function h(a) {
24 a = a|0; 24 a = a|0;
25 return +abs(a); 25 return +abs(+(a | 0));
26 } 26 }
27 27
28 return { f: f, g: g, h: h }; 28 return { f: f, g: g, h: h };
29 } 29 }
30 30
31 var m = Module({ Math: Math }); 31 var m = Module({ Math: Math });
32 var f = m.f; 32 var f = m.f;
33 var g = m.g; 33 var g = m.g;
34 var h = m.h; 34 var h = m.h;
35 35
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 assertEquals(1, h(1.1)); 75 assertEquals(1, h(1.1));
76 assertEquals(1, h(1.5)); 76 assertEquals(1, h(1.5));
77 assertEquals(1, h(-1)); 77 assertEquals(1, h(-1));
78 assertEquals(1, h(-1.1)); 78 assertEquals(1, h(-1.1));
79 assertEquals(1, h(-1.5)); 79 assertEquals(1, h(-1.5));
80 80
81 assertEquals(Number.MIN_VALUE, f(Number.MIN_VALUE)); 81 assertEquals(Number.MIN_VALUE, f(Number.MIN_VALUE));
82 assertEquals(Number.MIN_VALUE, f(-Number.MIN_VALUE)); 82 assertEquals(Number.MIN_VALUE, f(-Number.MIN_VALUE));
83 assertEquals(Number.MAX_VALUE, f(Number.MAX_VALUE)); 83 assertEquals(Number.MAX_VALUE, f(Number.MAX_VALUE));
84 assertEquals(Number.MAX_VALUE, f(-Number.MAX_VALUE)); 84 assertEquals(Number.MAX_VALUE, f(-Number.MAX_VALUE));
OLDNEW
« no previous file with comments | « test/mjsunit/asm/load-elimination.js ('k') | test/mjsunit/asm/math-ceil.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698