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

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

Issue 2101923003: [wasm] fix loops and if-else to take int type instead of signed (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] fix loops and if-else to take int type instead of signed Created 4 years, 5 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/regress/regress-617526.js ('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 assertWasm(expected, func, ffi) { 7 function assertWasm(expected, func, ffi) {
8 print("Testing " + func.name + "..."); 8 print("Testing " + func.name + "...");
9 assertEquals(expected, Wasm.instantiateModuleFromAsm( 9 assertEquals(expected, Wasm.instantiateModuleFromAsm(
10 func.toString(), ffi).caller()); 10 func.toString(), ffi).caller());
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 assertThrows(function() { 1535 assertThrows(function() {
1536 Wasm.instantiateModuleFromAsm('33;'); 1536 Wasm.instantiateModuleFromAsm('33;');
1537 }); 1537 });
1538 })(); 1538 })();
1539 1539
1540 (function TestBadVarDeclaration() { 1540 (function TestBadVarDeclaration() {
1541 assertThrows(function() { 1541 assertThrows(function() {
1542 Wasm.instantiateModuleFromAsm('var x = 3;'); 1542 Wasm.instantiateModuleFromAsm('var x = 3;');
1543 }); 1543 });
1544 })(); 1544 })();
1545
1546 (function TestIfWithUnsigned() {
1547 function asmModule() {
1548 "use asm";
1549 function main() {
1550 if (2147483658) { // 2^31 + 10
1551 return 231;
1552 }
1553 return 0;
1554 }
1555 return {main:main};
1556 }
1557 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
1558 assertEquals(231, wasm.main());
1559 })();
1560
1561 (function TestLoopsWithUnsigned() {
1562 function asmModule() {
1563 "use asm";
1564 function main() {
1565 var val = 1;
1566 var count = 0;
1567 for (val = 2147483648; 2147483648;) {
1568 val = 2147483649;
1569 break;
1570 }
1571 while (val>>>0) {
1572 val = (val + 1) | 0;
1573 count = (count + 1)|0;
1574 if ((count|0) == 9) {
1575 break;
1576 }
1577 }
1578 count = 0;
1579 do {
1580 val = (val + 2) | 0;
1581 count = (count + 1)|0;
1582 if ((count|0) == 5) {
1583 break;
1584 }
1585 } while (0xffffffff);
1586 if ((val>>>0) == 2147483668) {
1587 return 323;
1588 }
1589 return 0;
1590 }
1591 return {main:main};
1592 }
1593 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
1594 assertEquals(323, wasm.main());
1595 })();
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-617526.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698