OLD | NEW |
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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 var a = fround(1.0); | 1342 var a = fround(1.0); |
1343 var b = fround(2.0); | 1343 var b = fround(2.0); |
1344 HEAPF32[0] = a + b; | 1344 HEAPF32[0] = a + b; |
1345 return +HEAPF32[0]; | 1345 return +HEAPF32[0]; |
1346 } | 1346 } |
1347 return {func: func}; | 1347 return {func: func}; |
1348 } | 1348 } |
1349 | 1349 |
1350 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); | 1350 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
1351 assertEquals(3, m.func()); | 1351 assertEquals(3, m.func()); |
1352 }) // TODO(bradnelson): Enable when Math.fround implementation lands. | 1352 }); // TODO(bradnelson): Enable when Math.fround implementation lands. |
| 1353 |
| 1354 |
| 1355 (function TestIntegerMultiplyBothWays() { |
| 1356 function Module(stdlib, foreign, heap) { |
| 1357 "use asm"; |
| 1358 function func() { |
| 1359 var a = 1; |
| 1360 return ((a * 3) + (4 * a)) | 0; |
| 1361 } |
| 1362 return {func: func}; |
| 1363 } |
| 1364 |
| 1365 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1366 assertEquals(7, m.func()); |
| 1367 })(); |
| 1368 |
| 1369 |
| 1370 (function TestBadMultiplyIntish() { |
| 1371 function Module(stdlib, foreign, heap) { |
| 1372 "use asm"; |
| 1373 function func() { |
| 1374 var a = 1; |
| 1375 return ((a + a) * 4) | 0; |
| 1376 } |
| 1377 return {func: func}; |
| 1378 } |
| 1379 assertThrows(function() { |
| 1380 _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1381 }); |
| 1382 })(); |
OLD | NEW |