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

Side by Side Diff: test/mjsunit/wasm/test-wasm-module-builder.js

Issue 1780483002: [wasm] Support a two-level namespace for imports. (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/cctest/wasm/test-run-wasm-js.cc ('k') | test/mjsunit/wasm/wasm-module-builder.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 var debug = false; 10 var debug = false;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 for (var i = 0; i < whole.byteLength; i++) { 131 for (var i = 0; i < whole.byteLength; i++) {
132 whole[i] = 0xff; 132 whole[i] = 0xff;
133 } 133 }
134 var array2 = new Uint8Array(buffer2, kPad, buffer.byteLength); 134 var array2 = new Uint8Array(buffer2, kPad, buffer.byteLength);
135 for (var i = 0; i < array2.byteLength; i++) { 135 for (var i = 0; i < array2.byteLength; i++) {
136 array2[i] = array[i]; 136 array2[i] = array[i];
137 } 137 }
138 var instance = Wasm.instantiateModule(array2); 138 var instance = Wasm.instantiateModule(array2);
139 assertEquals(17, instance.exports.blarg()); 139 assertEquals(17, instance.exports.blarg());
140 })(); 140 })();
141
142 (function ImportTestTwoLevel() {
143 var module = new WasmModuleBuilder();
144 var index = module.addImportWithModule("mod", "print", [kAstStmt, kAstI32]);
145 module.addFunction("foo", [kAstStmt])
146 .addBody([kExprCallImport, index, kExprI8Const, 19])
147 .exportAs("main");
148
149 var buffer = module.toBuffer(debug);
150 var instance = Wasm.instantiateModule(buffer, {mod: {print: print}});
151 print("should print 19! ");
152 instance.exports.main();
153 })();
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-js.cc ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698