Chromium Code Reviews| 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 85b2638eb1224164e2b9785dd012931ecc5c05e0..6c98a2ebf032374b8e36aa1f54b6ed6fb0d8facb 100644 |
| --- a/test/mjsunit/wasm/wasm-module-builder.js |
| +++ b/test/mjsunit/wasm/wasm-module-builder.js |
| @@ -204,6 +204,11 @@ class WasmModuleBuilder { |
| return this; |
| } |
| + addImportedTable(module, name, initial, maximum) { |
| + let o = {module: module, name: name, kind: kExternalTable, initial: initial, maximum: maximum}; |
|
bradnelson
2016/10/28 16:59:01
>80
titzer
2016/10/28 17:29:09
Done.
|
| + this.imports.push(o); |
| + } |
| + |
| addExport(name, index) { |
| this.exports.push({name: name, kind: kExternalFunction, index: index}); |
| return this; |
| @@ -289,6 +294,12 @@ class WasmModuleBuilder { |
| section.emit_u8(has_max ? 1 : 0); // flags |
| section.emit_u32v(imp.initial); // initial |
| if (has_max) section.emit_u32v(imp.maximum); // maximum |
| + } else if (imp.kind == kExternalTable) { |
| + section.emit_u8(kWasmAnyFunctionTypeForm); |
| + var has_max = (typeof imp.maximum) != "undefined"; |
| + section.emit_u8(has_max ? 1 : 0); // flags |
| + section.emit_u32v(imp.initial); // initial |
| + if (has_max) section.emit_u32v(imp.maximum); // maximum |
| } else { |
| throw new Error("unknown/unsupported import kind " + imp.kind); |
| } |