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

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

Issue 1675903002: fix int type coercion in asm to wasm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@indirectFunctions
Patch Set: Created 4 years, 10 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 | « src/wasm/asm-wasm-builder.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();
11 return 11; 11 return 11;
12 } 12 }
13 function empty() { 13 function empty() {
14 } 14 }
15 return {caller: caller}; 15 return {caller: caller};
16 } 16 }
17 17
18 assertEquals(11, _WASMEXP_.instantiateModuleFromAsm( 18 assertEquals(11, _WASMEXP_.instantiateModuleFromAsm(
19 EmptyTest.toString()).caller()); 19 EmptyTest.toString()).caller());
20 20
21 21
22 function IntTest() { 22 function IntTest() {
23 "use asm"; 23 "use asm";
24 function sum(a, b) { 24 function sum(a, b) {
25 a = a|0; 25 a = a|0;
26 b = b|0; 26 b = b|0;
27 var c = (b + 1)|0 27 var c = (b + 1)|0
28 var d = 3.0; 28 var d = 3.0;
29 var e = d | 0; // double conversion 29 var e = ~~d; // double conversion
30 return (a + c + 1)|0; 30 return (a + c + 1)|0;
31 } 31 }
32 32
33 function caller() { 33 function caller() {
34 return sum(77,22) | 0; 34 return sum(77,22) | 0;
35 } 35 }
36 36
37 return {caller: caller}; 37 return {caller: caller};
38 } 38 }
39 39
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 var foreign = new ffi(); 1073 var foreign = new ffi();
1074 1074
1075 var module = _WASMEXP_.instantiateModuleFromAsm(AsmModule.toString(), 1075 var module = _WASMEXP_.instantiateModuleFromAsm(AsmModule.toString(),
1076 foreign, null); 1076 foreign, null);
1077 1077
1078 module.__init__(); 1078 module.__init__();
1079 assertEquals(89, module.caller(83, 83.25)); 1079 assertEquals(89, module.caller(83, 83.25));
1080 } 1080 }
1081 1081
1082 TestForeignFunctionMultipleUse(); 1082 TestForeignFunctionMultipleUse();
OLDNEW
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698