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

Side by Side Diff: test/mjsunit/wasm/export-table.js

Issue 1740373002: [wasm] Add a magic word and a version number to the binary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 8
9 (function testExportedMain() { 9 (function testExportedMain() {
10 var kBodySize = 3; 10 var kBodySize = 3;
11 var kReturnValue = 99; 11 var kReturnValue = 99;
12 var kNameMainOffset = 4 + 7 + kBodySize + 8 + 1; 12 var kNameMainOffset = kHeaderSize + 4 + 7 + kBodySize + 8 + 1;
13 13
14 var data = bytes( 14 var data = bytesWithHeader(
15 // signatures 15 // signatures
16 kDeclSignatures, 1, 16 kDeclSignatures, 1,
17 0, kAstI32, // void -> i32 17 0, kAstI32, // void -> i32
18 // -- main function 18 // -- main function
19 kDeclFunctions, 19 kDeclFunctions,
20 1, 20 1,
21 0, // decl flags 21 0, // decl flags
22 0, 0, // signature index 22 0, 0, // signature index
23 kBodySize, 0, 23 kBodySize, 0,
24 // main body 24 // main body
(...skipping 15 matching lines...) Expand all
40 40
41 assertEquals("object", typeof module.exports); 41 assertEquals("object", typeof module.exports);
42 assertEquals("function", typeof module.exports.main); 42 assertEquals("function", typeof module.exports.main);
43 43
44 assertEquals(kReturnValue, module.exports.main()); 44 assertEquals(kReturnValue, module.exports.main());
45 })(); 45 })();
46 46
47 (function testExportedTwice() { 47 (function testExportedTwice() {
48 var kBodySize = 3; 48 var kBodySize = 3;
49 var kReturnValue = 99; 49 var kReturnValue = 99;
50 var kNameMainOffset = 4 + 7 + kBodySize + 14 + 1; 50 var kNameMainOffset = kHeaderSize + 4 + 7 + kBodySize + 14 + 1;
51 var kNameFooOffset = kNameMainOffset + 5; 51 var kNameFooOffset = kNameMainOffset + 5;
52 52
53 var data = bytes( 53 var data = bytesWithHeader(
54 // signatures 54 // signatures
55 kDeclSignatures, 1, 55 kDeclSignatures, 1,
56 0, kAstI32, // void -> i32 56 0, kAstI32, // void -> i32
57 // -- main function 57 // -- main function
58 kDeclFunctions, 58 kDeclFunctions,
59 1, 59 1,
60 0, // decl flags 60 0, // decl flags
61 0, 0, // signature index 61 0, 0, // signature index
62 kBodySize, 0, 62 kBodySize, 0,
63 // main body 63 // main body
(...skipping 16 matching lines...) Expand all
80 var ffi = new Object(); 80 var ffi = new Object();
81 var module = _WASMEXP_.instantiateModule(data, ffi); 81 var module = _WASMEXP_.instantiateModule(data, ffi);
82 82
83 assertEquals("object", typeof module.exports); 83 assertEquals("object", typeof module.exports);
84 assertEquals("function", typeof module.exports.blah); 84 assertEquals("function", typeof module.exports.blah);
85 assertEquals("function", typeof module.exports.foo); 85 assertEquals("function", typeof module.exports.foo);
86 86
87 assertEquals(kReturnValue, module.exports.blah()); 87 assertEquals(kReturnValue, module.exports.blah());
88 assertEquals(kReturnValue, module.exports.foo()); 88 assertEquals(kReturnValue, module.exports.foo());
89 })(); 89 })();
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