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/indirect-calls.js

Issue 1577803002: [wasm] Rename the WASM object to _WASMEXP_. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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-error.js ('k') | test/mjsunit/wasm/instantiate-module-basic.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 8
9 var module = (function () { 9 var module = (function () {
10 var kFuncWithBody = 9; 10 var kFuncWithBody = 9;
11 var kFuncImported = 7; 11 var kFuncImported = 7;
12 var kBodySize1 = 5; 12 var kBodySize1 = 5;
13 var kBodySize2 = 8; 13 var kBodySize2 = 8;
14 var kFuncTableSize = 8; 14 var kFuncTableSize = 8;
15 var kSubOffset = 13 + kFuncWithBody + kBodySize1 + kFuncImported + kFuncWithBo dy + kBodySize2 + kFuncTableSize + 1; 15 var kSubOffset = 13 + kFuncWithBody + kBodySize1 + kFuncImported + kFuncWithBo dy + kBodySize2 + kFuncTableSize + 1;
16 var kAddOffset = kSubOffset + 4; 16 var kAddOffset = kSubOffset + 4;
17 var kMainOffset = kAddOffset + 4; 17 var kMainOffset = kAddOffset + 4;
18 18
19 var ffi = new Object(); 19 var ffi = new Object();
20 ffi.add = (function(a, b) { return a + b | 0; }); 20 ffi.add = (function(a, b) { return a + b | 0; });
21 21
22 return WASM.instantiateModule(bytes( 22 return _WASMEXP_.instantiateModule(bytes(
23 // -- signatures 23 // -- signatures
24 kDeclSignatures, 2, 24 kDeclSignatures, 2,
25 2, kAstI32, kAstI32, kAstI32, // int, int -> int 25 2, kAstI32, kAstI32, kAstI32, // int, int -> int
26 3, kAstI32, kAstI32, kAstI32, kAstI32, // int, int, int -> int 26 3, kAstI32, kAstI32, kAstI32, kAstI32, // int, int, int -> int
27 // -- function #0 (sub) 27 // -- function #0 (sub)
28 kDeclFunctions, 3, 28 kDeclFunctions, 3,
29 kDeclFunctionName, 29 kDeclFunctionName,
30 0, 0, // signature offset 30 0, 0, // signature offset
31 kSubOffset, 0, 0, 0, // name offset 31 kSubOffset, 0, 0, 0, // name offset
32 kBodySize1, 0, // body size 32 kBodySize1, 0, // body size
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 assertFalse(module === null); 64 assertFalse(module === null);
65 assertFalse(module === 0); 65 assertFalse(module === 0);
66 assertEquals("object", typeof module); 66 assertEquals("object", typeof module);
67 assertEquals("function", typeof module.main); 67 assertEquals("function", typeof module.main);
68 68
69 assertEquals(5, module.main(0, 12, 7)); 69 assertEquals(5, module.main(0, 12, 7));
70 assertEquals(19, module.main(1, 12, 7)); 70 assertEquals(19, module.main(1, 12, 7));
71 71
72 assertTraps(kTrapFuncSigMismatch, "module.main(2, 12, 33)"); 72 assertTraps(kTrapFuncSigMismatch, "module.main(2, 12, 33)");
73 assertTraps(kTrapFuncInvalid, "module.main(3, 12, 33)"); 73 assertTraps(kTrapFuncInvalid, "module.main(3, 12, 33)");
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/ffi-error.js ('k') | test/mjsunit/wasm/instantiate-module-basic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698