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

Side by Side Diff: test/mjsunit/wasm/ffi.js

Issue 2208703002: [wasm] Allow import function to be any kind of callables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Create a native context at the beginning of all tests in test-run-wasm-js.cc Created 4 years, 4 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
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 testCallFFI(func, check) { 10 function testCallFFI(func, check) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 assertEquals(a - b | 0, r); 47 assertEquals(a - b | 0, r);
48 assertTrue(was_called); 48 assertTrue(was_called);
49 // assertEquals(global, params[0]); // sloppy mode 49 // assertEquals(global, params[0]); // sloppy mode
50 assertEquals(a, params[1]); 50 assertEquals(a, params[1]);
51 assertEquals(b, params[2]); 51 assertEquals(b, params[2]);
52 was_called = false; 52 was_called = false;
53 } 53 }
54 54
55 testCallFFI(FOREIGN_SUB, check_FOREIGN_SUB); 55 testCallFFI(FOREIGN_SUB, check_FOREIGN_SUB);
56 56
57 var proxy_sub = new Proxy(FOREIGN_SUB, {
58 });
59 testCallFFI(proxy_sub, check_FOREIGN_SUB);
Benedikt Meurer 2016/08/03 17:14:43 I'd like to see appropriate tests for all the spec
57 60
58 function FOREIGN_ABCD(a, b, c, d) { 61 function FOREIGN_ABCD(a, b, c, d) {
59 print("FOREIGN_ABCD(" + a + ", " + b + ", " + c + ", " + d + ")"); 62 print("FOREIGN_ABCD(" + a + ", " + b + ", " + c + ", " + d + ")");
60 was_called = true; 63 was_called = true;
61 params[0] = this; 64 params[0] = this;
62 params[1] = a; 65 params[1] = a;
63 params[2] = b; 66 params[2] = b;
64 params[3] = c; 67 params[3] = c;
65 params[4] = d; 68 params[4] = d;
66 return (a * b * 6) | 0; 69 return (a * b * 6) | 0;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 kExprCallImport, kArity1, 1 // -- 254 kExprCallImport, kArity1, 1 // --
252 ]) // -- 255 ]) // --
253 .exportFunc() 256 .exportFunc()
254 257
255 var main = builder.instantiate({print: print}).exports.main; 258 var main = builder.instantiate({print: print}).exports.main;
256 for (var i = -9; i < 900; i += 6.125) main(i); 259 for (var i = -9; i < 900; i += 6.125) main(i);
257 } 260 }
258 261
259 testCallPrint(); 262 testCallPrint();
260 testCallPrint(); 263 testCallPrint();
OLDNEW
« src/compiler/wasm-compiler.cc ('K') | « test/cctest/wasm/test-run-wasm-js.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698