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

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

Issue 2390113003: [wasm] Refactor import handling for 0xC. (Closed)
Patch Set: Fix gc stress failure Created 4 years, 2 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/mjsunit/wasm/export-table.js ('k') | test/mjsunit/wasm/function-prototype.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 --allow-natives-syntax 5 // Flags: --expose-wasm --allow-natives-syntax
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 main_for_constructor_test = builder.instantiate({func: C}).exports.main; 87 main_for_constructor_test = builder.instantiate({func: C}).exports.main;
88 88
89 assertThrows("main_for_constructor_test(12, 43)", TypeError); 89 assertThrows("main_for_constructor_test(12, 43)", TypeError);
90 }) (); 90 }) ();
91 91
92 print("Native function"); 92 print("Native function");
93 (function test_ffi_call_to_native() { 93 (function test_ffi_call_to_native() {
94 94
95 var builder = new WasmModuleBuilder(); 95 var builder = new WasmModuleBuilder();
96 96
97 var sig_index = builder.addType(kSig_d); 97 var sig_index = builder.addType(kSig_d_v);
98 builder.addImport("func", sig_index); 98 builder.addImport("func", sig_index);
99 builder.addFunction("main", sig_index) 99 builder.addFunction("main", sig_index)
100 .addBody([ 100 .addBody([
101 kExprCallFunction, 0 // -- 101 kExprCallFunction, 0 // --
102 ]) // -- 102 ]) // --
103 .exportFunc(); 103 .exportFunc();
104 104
105 var main = builder.instantiate({func: Object.prototype.toString}).exports.main ; 105 var main = builder.instantiate({func: Object.prototype.toString}).exports.main ;
106 // The result of the call to Object.prototype.toString should be 106 // The result of the call to Object.prototype.toString should be
107 // [object Undefined]. However, we cannot test for this result because wasm 107 // [object Undefined]. However, we cannot test for this result because wasm
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 kExprCallFunction, 1 // -- 308 kExprCallFunction, 1 // --
309 ]) // -- 309 ]) // --
310 .exportFunc() 310 .exportFunc()
311 311
312 var main = builder.instantiate({print: print}).exports.main; 312 var main = builder.instantiate({print: print}).exports.main;
313 for (var i = -9; i < 900; i += 6.125) main(i); 313 for (var i = -9; i < 900; i += 6.125) main(i);
314 } 314 }
315 315
316 testCallPrint(); 316 testCallPrint();
317 testCallPrint(); 317 testCallPrint();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/export-table.js ('k') | test/mjsunit/wasm/function-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698