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

Side by Side Diff: test/mjsunit/wasm/export-table.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/divrem-trap.js ('k') | test/mjsunit/wasm/ffi.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 testExportedMain() { 10 (function testExportedMain() {
11 var kReturnValue = 88; 11 var kReturnValue = 88;
12 var builder = new WasmModuleBuilder(); 12 var builder = new WasmModuleBuilder();
13 13
14 builder.addFunction("main", [kAstI32]) 14 builder.addFunction("main", [kAstI32])
15 .addBody([ 15 .addBody([
16 kExprReturn,
17 kExprI8Const, 16 kExprI8Const,
18 kReturnValue]) 17 kReturnValue,
18 kExprReturn, kArity1
19 ])
19 .exportFunc(); 20 .exportFunc();
20 21
21 var module = builder.instantiate(); 22 var module = builder.instantiate();
22 23
23 assertEquals("object", typeof module.exports); 24 assertEquals("object", typeof module.exports);
24 assertEquals("function", typeof module.exports.main); 25 assertEquals("function", typeof module.exports.main);
25 26
26 assertEquals(kReturnValue, module.exports.main()); 27 assertEquals(kReturnValue, module.exports.main());
27 })(); 28 })();
28 29
29 (function testExportedTwice() { 30 (function testExportedTwice() {
30 var kReturnValue = 99; 31 var kReturnValue = 99;
31 32
32 var builder = new WasmModuleBuilder(); 33 var builder = new WasmModuleBuilder();
33 34
34 builder.addFunction("main", [kAstI32]) 35 builder.addFunction("main", [kAstI32])
35 .addBody([ 36 .addBody([
36 kExprReturn,
37 kExprI8Const, 37 kExprI8Const,
38 kReturnValue]) 38 kReturnValue,
39 kExprReturn, kArity1
40 ])
39 .exportAs("blah") 41 .exportAs("blah")
40 .exportAs("foo"); 42 .exportAs("foo");
41 43
42 var module = builder.instantiate(); 44 var module = builder.instantiate();
43 45
44 assertEquals("object", typeof module.exports); 46 assertEquals("object", typeof module.exports);
45 assertEquals("function", typeof module.exports.blah); 47 assertEquals("function", typeof module.exports.blah);
46 assertEquals("function", typeof module.exports.foo); 48 assertEquals("function", typeof module.exports.foo);
47 49
48 assertEquals(kReturnValue, module.exports.foo()); 50 assertEquals(kReturnValue, module.exports.foo());
49 assertEquals(kReturnValue, module.exports.blah()); 51 assertEquals(kReturnValue, module.exports.blah());
50 })(); 52 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/divrem-trap.js ('k') | test/mjsunit/wasm/ffi.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698