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

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

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/ffi.js ('k') | test/mjsunit/wasm/gc-frame.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 testCallFFI(ffi) { 10 function testCallFFI(ffi) {
11 var builder = new WasmModuleBuilder(); 11 var builder = new WasmModuleBuilder();
12 12
13 var sig_index = [kAstI32, kAstF64, kAstF64]; 13 var sig_index = [kAstI32, kAstF64, kAstF64];
14 builder.addImport("fun", sig_index); 14 builder.addImport("fun", sig_index);
15 builder.addFunction("main", sig_index) 15 builder.addFunction("main", sig_index)
16 .addBody([ 16 .addBody([
17 kExprCallImport, 0, // -- 17 kExprGetLocal, 0, // --
18 kExprGetLocal, 0, // -- 18 kExprGetLocal, 1, // --
19 kExprGetLocal, 1]) // -- 19 kExprCallFunction, kArity2, 0, // --
20 ]) // --
20 .exportFunc(); 21 .exportFunc();
21 22
22 var module = builder.instantiate(ffi); 23 var module = builder.instantiate(ffi);
23 } 24 }
24 25
25 // everything is good. 26 // everything is good.
26 (function() { 27 (function() {
27 var ffi = new Object(); 28 var ffi = new Object();
28 ffi.fun = function(a, b) { print(a, b); } 29 ffi.fun = function(a, b) { print(a, b); }
29 testCallFFI(ffi); 30 testCallFFI(ffi);
(...skipping 21 matching lines...) Expand all
51 testCallFFI(ffi); 52 testCallFFI(ffi);
52 }); 53 });
53 54
54 55
55 // "fun" should be a JS function. 56 // "fun" should be a JS function.
56 assertThrows(function() { 57 assertThrows(function() {
57 var ffi = new Object(); 58 var ffi = new Object();
58 ffi.fun = 0; 59 ffi.fun = 0;
59 testCallFFI(ffi); 60 testCallFFI(ffi);
60 }); 61 });
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/ffi.js ('k') | test/mjsunit/wasm/gc-frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698