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

Side by Side Diff: test/mjsunit/wasm/import-table.js

Issue 2111843002: [wasm] Fix receiver conversion for WASM->JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/receiver.js » ('j') | 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 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 function testCallImport(func, check) { 10 function testCallImport(func, check) {
(...skipping 27 matching lines...) Expand all
38 was_called = true; 38 was_called = true;
39 params[0] = this; 39 params[0] = this;
40 params[1] = a; 40 params[1] = a;
41 params[2] = b; 41 params[2] = b;
42 return (a - b) | 0; 42 return (a - b) | 0;
43 } 43 }
44 44
45 function check_FOREIGN_SUB(r, a, b) { 45 function check_FOREIGN_SUB(r, a, b) {
46 assertEquals(a - b | 0, r); 46 assertEquals(a - b | 0, r);
47 assertTrue(was_called); 47 assertTrue(was_called);
48 // assertEquals(global, params[0]); // sloppy mode 48 assertEquals(global, params[0]); // sloppy mode
49 assertEquals(a, params[1]); 49 assertEquals(a, params[1]);
50 assertEquals(b, params[2]); 50 assertEquals(b, params[2]);
51 was_called = false; 51 was_called = false;
52 } 52 }
53 53
54 testCallImport(FOREIGN_SUB, check_FOREIGN_SUB); 54 testCallImport(FOREIGN_SUB, check_FOREIGN_SUB);
55 55
56 56
57 function FOREIGN_ABCD(a, b, c, d) { 57 function FOREIGN_ABCD(a, b, c, d) {
58 print("FOREIGN_ABCD(" + a + ", " + b + ", " + c + ", " + d + ")"); 58 print("FOREIGN_ABCD(" + a + ", " + b + ", " + c + ", " + d + ")");
59 was_called = true; 59 was_called = true;
60 params[0] = this; 60 params[0] = this;
61 params[1] = a; 61 params[1] = a;
62 params[2] = b; 62 params[2] = b;
63 params[3] = c; 63 params[3] = c;
64 params[4] = d; 64 params[4] = d;
65 return (a * b * 6) | 0; 65 return (a * b * 6) | 0;
66 } 66 }
67 67
68 function check_FOREIGN_ABCD(r, a, b) { 68 function check_FOREIGN_ABCD(r, a, b) {
69 assertEquals((a * b * 6) | 0, r); 69 assertEquals((a * b * 6) | 0, r);
70 assertTrue(was_called); 70 assertTrue(was_called);
71 // assertEquals(global, params[0]); // sloppy mode. 71 assertEquals(global, params[0]); // sloppy mode.
72 assertEquals(a, params[1]); 72 assertEquals(a, params[1]);
73 assertEquals(b, params[2]); 73 assertEquals(b, params[2]);
74 assertEquals(undefined, params[3]); 74 assertEquals(undefined, params[3]);
75 assertEquals(undefined, params[4]); 75 assertEquals(undefined, params[4]);
76 was_called = false; 76 was_called = false;
77 } 77 }
78 78
79 testCallImport(FOREIGN_ABCD, check_FOREIGN_ABCD); 79 testCallImport(FOREIGN_ABCD, check_FOREIGN_ABCD);
80 80
81 function FOREIGN_ARGUMENTS0() { 81 function FOREIGN_ARGUMENTS0() {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 kExprCallImport, kArity0, 1, // -- 274 kExprCallImport, kArity0, 1, // --
275 kExprI32Add, // -- 275 kExprI32Add, // --
276 ]) // -- 276 ]) // --
277 .exportFunc(); 277 .exportFunc();
278 278
279 var main = builder.instantiate({foo: foo, bar: bar}).exports.main; 279 var main = builder.instantiate({foo: foo, bar: bar}).exports.main;
280 assertEquals(expected, main()); 280 assertEquals(expected, main());
281 } 281 }
282 282
283 testCallImport2(function() { return 33; }, function () { return 44; }, 77); 283 testCallImport2(function() { return 33; }, function () { return 44; }, 77);
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/receiver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698