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

Side by Side Diff: test/mjsunit/wasm/asm-wasm.js

Issue 1794303002: Fixing +fround(x) in asm typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 9 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/cctest/test-asm-validator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 function EmptyTest() { 7 function EmptyTest() {
8 "use asm"; 8 "use asm";
9 function caller() { 9 function caller() {
10 empty(); 10 empty();
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 } 1367 }
1368 1368
1369 return {caller:caller}; 1369 return {caller:caller};
1370 } 1370 }
1371 1371
1372 var m = Wasm.instantiateModuleFromAsm(Module.toString()); 1372 var m = Wasm.instantiateModuleFromAsm(Module.toString());
1373 assertEquals(1, m.caller()); 1373 assertEquals(1, m.caller());
1374 })(); 1374 })();
1375 1375
1376 1376
1377 (function TestAbsInt() {
1378 function Module(stdlib) {
1379 "use asm";
1380 var abs = stdlib.Math.abs;
1381 function func(x) {
1382 x = x | 0;
1383 return abs(x|0)|0;
1384 }
1385 return {func:func};
1386 }
1387 var m = Wasm.instantiateModuleFromAsm(Module.toString());
1388 var values = [0, 1, -1, 0x40000000, 0x7FFFFFFF, -0x80000000];
1389 for (var i = 0; i < values.length; i++) {
1390 var val = values[i];
1391 assertEquals(Math.abs(val) | 0, m.func(val));
1392 }
1393 })();
1394
1395
1396 (function TestAbsFloat() {
1397 function Module(stdlib) {
1398 "use asm";
1399 var fround = stdlib.Math.fround;
1400 var abs = stdlib.Math.abs;
1401 function func(x) {
1402 x = fround(x);
1403 x = abs(x);
1404 return fround(x);
1405 }
1406 return {func:func};
1407 }
1408 var m = Wasm.instantiateModuleFromAsm(Module.toString());
1409 var values = [
1410 0, -0, 1, -1, 0.9, -0.9, 1.414, 0x7F, -0x80, -0x8000, -0x80000000,
1411 0x7FFF, 0x7FFFFFFF, Infinity, -Infinity, NaN
1412 ];
1413 for (var i = 0; i < values.length; i++) {
1414 var val = values[i];
1415 assertEquals(Math.fround(Math.abs(val)), m.func(val));
1416 }
1417 })();
1418
1419
1420 (function TestAbsDouble() {
1421 function Module(stdlib) {
1422 "use asm";
1423 var fround = stdlib.Math.fround;
1424 var abs = stdlib.Math.abs;
1425 function func(x) {
1426 x = +x;
1427 x = abs(x);
1428 return +x;
1429 }
1430 return {func:func};
1431 }
1432 var m = Wasm.instantiateModuleFromAsm(Module.toString());
1433 var values = [
1434 0, -0, 1, -1, 0.9, -0.9, 1.414, 0x7F, -0x80, -0x8000, -0x80000000,
1435 0x7FFF, 0x7FFFFFFF, Infinity, -Infinity, NaN
1436 ];
1437 for (var i = 0; i < values.length; i++) {
1438 var val = values[i];
1439 assertEquals(Math.abs(val), m.func(val));
1440 }
1441 })();
1442
1443
1444 (function TestFloatAsDouble() {
1445 function Module(stdlib) {
1446 "use asm";
1447 var fround = stdlib.Math.fround;
1448 var abs = stdlib.Math.abs;
1449 function func() {
1450 var x = fround(1.0);
1451 return +fround(x);
1452 }
1453 return {func:func};
1454 }
1455 var m = Wasm.instantiateModuleFromAsm(Module.toString());
1456 assertEquals(1, m.func());
1457 })();
1458
1459
1377 (function TestOr() { 1460 (function TestOr() {
1378 function Module() { 1461 function Module() {
1379 "use asm"; 1462 "use asm";
1380 function func() { 1463 function func() {
1381 var x = 1; 1464 var x = 1;
1382 var y = 2; 1465 var y = 2;
1383 return (x | y) | 0; 1466 return (x | y) | 0;
1384 } 1467 }
1385 return {func: func}; 1468 return {func: func};
1386 } 1469 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 var a = 0; 1664 var a = 0;
1582 f = 5616315000.000001; 1665 f = 5616315000.000001;
1583 a = ~~f >>>0; 1666 a = ~~f >>>0;
1584 return a | 0; 1667 return a | 0;
1585 } 1668 }
1586 return { main : aaa }; 1669 return { main : aaa };
1587 } 1670 }
1588 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString()); 1671 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
1589 assertEquals(1321347704, wasm.main()); 1672 assertEquals(1321347704, wasm.main());
1590 })(); 1673 })();
OLDNEW
« no previous file with comments | « test/cctest/test-asm-validator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698