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

Unified Diff: test/mjsunit/wasm/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/wasm/test-wasm-module-builder.js ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/wasm-module-builder.js
diff --git a/test/mjsunit/wasm/wasm-module-builder.js b/test/mjsunit/wasm/wasm-module-builder.js
index 59166fc9e45679b122a342cdf0d810c3903dc98d..f529e53e2a6556fa3b7e89856c2813b10dd7269a 100644
--- a/test/mjsunit/wasm/wasm-module-builder.js
+++ b/test/mjsunit/wasm/wasm-module-builder.js
@@ -78,10 +78,16 @@ WasmModuleBuilder.prototype.addFunction = function(name, sig) {
return func;
}
+WasmModuleBuilder.prototype.addImportWithModule = function(module, name, sig) {
+ var sig_index = (typeof sig) == "number" ? sig : this.addSignature(sig);
+ this.imports.push({module: module, name: name, sig_index: sig_index});
+ return this.imports.length - 1;
+}
+
WasmModuleBuilder.prototype.addImport = function(name, sig) {
- var sig_index = (typeof sig) == "number" ? sig : this.addSignature(sig);
- this.imports.push({name: name, sig_index: sig_index});
- return this.imports.length - 1;
+ var sig_index = (typeof sig) == "number" ? sig : this.addSignature(sig);
+ this.imports.push({module: name, name: undefined, sig_index: sig_index});
+ return this.imports.length - 1;
}
WasmModuleBuilder.prototype.addDataSegment = function(addr, data, init) {
@@ -172,8 +178,12 @@ WasmModuleBuilder.prototype.toArray = function(debug) {
emit_varint(bytes, this.imports.length);
for (imp of this.imports) {
emit_u16(bytes, imp.sig_index);
- emit_string(bytes, "");
- emit_string(bytes, imp.name);
+ emit_string(bytes, imp.module);
+ if (imp.name == undefined) {
+ emit_u32(bytes, 0);
+ } else {
+ emit_string(bytes, imp.name);
+ }
}
}
« no previous file with comments | « test/mjsunit/wasm/test-wasm-module-builder.js ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698