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

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

Issue 2503313002: [wasm] Fix imports with numbers as name (Closed)
Patch Set: Created 4 years, 1 month 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/wasm-module.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 --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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 290
291 testCallBinopVoid(kAstI32); 291 testCallBinopVoid(kAstI32);
292 // TODO testCallBinopVoid(kAstI64); 292 // TODO testCallBinopVoid(kAstI64);
293 testCallBinopVoid(kAstF32); 293 testCallBinopVoid(kAstF32);
294 testCallBinopVoid(kAstF64); 294 testCallBinopVoid(kAstF64);
295 295
296 296
297 297
298 function testCallPrint() { 298 (function testCallPrint() {
ahaas 2016/11/16 10:51:18 All other tests have the style function name() {}
299 var builder = new WasmModuleBuilder(); 299 var builder = new WasmModuleBuilder();
300 300
301 builder.addImport("print", makeSig_v_x(kAstI32)); 301 builder.addImport("print", makeSig_v_x(kAstI32));
302 builder.addImport("print", makeSig_v_x(kAstF64)); 302 builder.addImport("print", makeSig_v_x(kAstF64));
303 builder.addFunction("main", makeSig_v_x(kAstF64)) 303 builder.addFunction("main", makeSig_v_x(kAstF64))
304 .addBody([ 304 .addBody([
305 kExprI8Const, 97, // -- 305 kExprI8Const, 97, // --
306 kExprCallFunction, 0, // -- 306 kExprCallFunction, 0, // --
307 kExprGetLocal, 0, // -- 307 kExprGetLocal, 0, // --
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
317 testCallPrint(); 317 (function testImportNumbers() {
ahaas 2016/11/16 10:51:18 nits: It's a test, you can give it long descriptiv
318 var builder = new WasmModuleBuilder();
319
320 builder.addImport('0', kSig_v_i);
321
322 builder.instantiate({0: print});
323 })();
324
325 (function testImportNumbers2() {
326 var builder = new WasmModuleBuilder();
327
328 builder.addImportWithModule('foo', '0', kSig_v_i);
329 builder.addImportWithModule('0', 'foo', kSig_v_i);
330 builder.addImportWithModule('0', '0', kSig_v_i);
331 builder.addImportWithModule('18', '-3', kSig_v_i);
332 builder.addImportWithModule('-3', '18', kSig_v_i);
333
334 builder.instantiate({
335 foo: {0: print},
336 0: {0: print, foo: print},
337 18: {'-3': print},
338 '-3': {18: print}
339 });
340 })();
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698