The following test in test_Instance.js fails but shouldn't: (function ExportedNumber() { for (let i = 0; i <= 129; ++i) { const name = i.toString(); const builder = (new Builder()) .Type().End() .Function().End() .Export() .Function(name) .End() .Code() .Function(name, { params: [], ret: "i32" }) .I32Const(i) .Return() .End() .End(); const bin = builder.WebAssembly().get(); const module = new WebAssembly.Module(bin); const instance = new WebAssembly.Instance(module); const result = instance.exports[name](); assert.isA(result, "number"); assert.eq(result, i); } })(); If you prefix `name` with another string, everything works. I think the issue has to do with using AbstractModuleRecord, somewhere after: symbolTablePutTouchWatchpointSet(moduleEnvironment, state, exp.field, exportedValue, shouldThrowReadOnlyError, ignoreReadOnlyErrors, putResult); exp.field is being put in properly, but then the ModuleRecord mapping is sad at string such as "0". I'm adding this test, commented out, and leaving a FIXME. The spec tests have a similar failure.
Is that the thing? https://bugs.webkit.org/show_bug.cgi?id=168870
(In reply to comment #1) > Is that the thing? https://bugs.webkit.org/show_bug.cgi?id=168870 Yeah WebAssembly doesn't limit the names. Right now they're just length + bytes. For JS we further limit to valid UTF-8, details still in flux. I expect numbers and weird Unicode will remain valid though. Maybe the AbstractModuleThing needs a virtual function for this?
I think r213453 already fixes this issue. I'll enable the test in wasm js-api/test_Instance.js.
Created attachment 308079 [details] Patch
Comment on attachment 308079 [details] Patch r=me
Comment on attachment 308079 [details] Patch Clearing flags on attachment: 308079 Committed r215733: <http://trac.webkit.org/changeset/215733>
All reviewed patches have been landed. Closing bug.