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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 var x = 3; | 1306 var x = 3; |
1307 var y = 2; | 1307 var y = 2; |
1308 return (x ^ y) | 0; | 1308 return (x ^ y) | 0; |
1309 } | 1309 } |
1310 return {func: func}; | 1310 return {func: func}; |
1311 } | 1311 } |
1312 | 1312 |
1313 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); | 1313 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
1314 assertEquals(1, m.func()); | 1314 assertEquals(1, m.func()); |
1315 })(); | 1315 })(); |
| 1316 |
| 1317 |
| 1318 (function TestIntishAssignment() { |
| 1319 function Module(stdlib, foreign, heap) { |
| 1320 "use asm"; |
| 1321 var HEAP32 = new stdlib.Int32Array(heap); |
| 1322 function func() { |
| 1323 var a = 1; |
| 1324 var b = 2; |
| 1325 HEAP32[0] = a + b; |
| 1326 return HEAP32[0] | 0; |
| 1327 } |
| 1328 return {func: func}; |
| 1329 } |
| 1330 |
| 1331 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1332 assertEquals(3, m.func()); |
| 1333 })(); |
| 1334 |
| 1335 |
| 1336 (function TestFloatishAssignment() { |
| 1337 function Module(stdlib, foreign, heap) { |
| 1338 "use asm"; |
| 1339 var HEAPF32 = new stdlib.Float32Array(heap); |
| 1340 var fround = stdlib.Math.fround; |
| 1341 function func() { |
| 1342 var a = fround(1.0); |
| 1343 var b = fround(2.0); |
| 1344 HEAPF32[0] = a + b; |
| 1345 return +HEAPF32[0]; |
| 1346 } |
| 1347 return {func: func}; |
| 1348 } |
| 1349 |
| 1350 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1351 assertEquals(3, m.func()); |
| 1352 }) // TODO(bradnelson): Enable when Math.fround implementation lands. |
OLD | NEW |