Commit 2ca39001 authored by gdeepti's avatar gdeepti Committed by Commit bot

[wasm] Instance exports object should be iterable

BUG=v8:5863

R=titzer@chromium.org, dschuff@chromium.org

Review-Url: https://codereview.chromium.org/2640403004
Cr-Commit-Position: refs/heads/master@{#42578}
parent 50e0fe29
......@@ -1884,6 +1884,7 @@ class WasmInstanceBuilder {
PropertyDescriptor desc;
desc.set_writable(false);
desc.set_enumerable(true);
// Count up export indexes.
int export_index = 0;
......
......@@ -247,3 +247,21 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
builder.exportMemoryAs('memory');
assertThrows(() => builder.instantiate(), WebAssembly.CompileError);
})();
(function TestIterableExports() {
print("TestIterableExports...");
let builder = new WasmModuleBuilder;
builder.addExport("a", builder.addFunction("", kSig_v_v).addBody([]));
builder.addExport("b", builder.addFunction("", kSig_v_v).addBody([]));
builder.addExport("c", builder.addFunction("", kSig_v_v).addBody([]));
builder.addExport("d", builder.addFunction("", kSig_v_v).addBody([]));
builder.addExport("e", builder.addGlobal(kWasmI32, false));
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module);
let exports_count = 0;
for (var e in instance.exports) ++exports_count;
assertEquals(5, exports_count);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment