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

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

Issue 1749233002: Convert float64 to float32 when coerced with a heapf32 assignment. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 return +HEAPF32[0]; 1426 return +HEAPF32[0];
1427 } 1427 }
1428 return {func: func}; 1428 return {func: func};
1429 } 1429 }
1430 1430
1431 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); 1431 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
1432 assertEquals(3, m.func()); 1432 assertEquals(3, m.func());
1433 }); // TODO(bradnelson): Enable when Math.fround implementation lands. 1433 }); // TODO(bradnelson): Enable when Math.fround implementation lands.
1434 1434
1435 1435
1436 (function TestDoubleToFloatAssignment() {
1437 function Module(stdlib, foreign, heap) {
1438 "use asm";
1439 var HEAPF32 = new stdlib.Float32Array(heap);
1440 var fround = stdlib.Math.fround;
1441 function func() {
1442 var a = 1.23;
1443 HEAPF32[0] = a;
1444 return +HEAPF32[0];
1445 }
1446 return {func: func};
1447 }
1448
1449 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
1450 assertEquals(1.23, m.func());
1451 });
1452
1453
1436 (function TestIntegerMultiplyBothWays() { 1454 (function TestIntegerMultiplyBothWays() {
1437 function Module(stdlib, foreign, heap) { 1455 function Module(stdlib, foreign, heap) {
1438 "use asm"; 1456 "use asm";
1439 function func() { 1457 function func() {
1440 var a = 1; 1458 var a = 1;
1441 return ((a * 3) + (4 * a)) | 0; 1459 return ((a * 3) + (4 * a)) | 0;
1442 } 1460 }
1443 return {func: func}; 1461 return {func: func};
1444 } 1462 }
1445 1463
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 var a = 0; 1555 var a = 0;
1538 f = 5616315000.000001; 1556 f = 5616315000.000001;
1539 a = ~~f >>>0; 1557 a = ~~f >>>0;
1540 return a | 0; 1558 return a | 0;
1541 } 1559 }
1542 return { main : aaa }; 1560 return { main : aaa };
1543 } 1561 }
1544 var wasm = _WASMEXP_.instantiateModuleFromAsm(asmModule.toString()); 1562 var wasm = _WASMEXP_.instantiateModuleFromAsm(asmModule.toString());
1545 assertEquals(1321347704, wasm.main()); 1563 assertEquals(1321347704, wasm.main());
1546 })(); 1564 })();
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