Closed Bug 1316447 Opened 8 years ago Closed 8 years ago

Baldr: add recent JS API additions

Categories

(Core :: JavaScript Engine: JIT, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(3 files, 1 obsolete file)

Namely WebAssembly.Module.(imports|exports) and WebAssembly.instantiate.
Blocks: wasm
Attachment #8809192 - Flags: review?(bbouvier)
Little bit of code motion to enable code sharing in next patch.
Attachment #8809276 - Flags: review?(bbouvier)
Attached patch instantiate (obsolete) — Splinter Review
WebAssembly.instantiate is also pretty easy; mostly just refactoring existing code so that it can be reused.
Attachment #8809277 - Flags: review?(bbouvier)
Comment on attachment 8809192 [details] [diff] [review] Module.imports and exports Review of attachment 8809192 [details] [diff] [review]: ----------------------------------------------------------------- Nice! ::: js/src/wasm/WasmJS.cpp @@ +526,5 @@ > + } > + > + *module = &unwrapped->as<WasmModuleObject>().module(); > + return true; > + nit: blank line @@ +532,5 @@ > + > +struct KindNames > +{ > + RootedPropertyName kind; > + RootedPropertyName function; I think this is unused (since you can use cx->names().function)?
Attachment #8809192 - Flags: review?(bbouvier) → review+
Comment on attachment 8809276 [details] [diff] [review] hoist-sync-execute Review of attachment 8809276 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/builtin/Promise.h @@ +166,5 @@ > // calling finishPromise(). > virtual void execute() = 0; > + > + // May be called in the absence of helper threads to synchronously execute > + // and finish a PromiseTask. Is it called if and only if there are no helper threads (in which case we could assert)? (I guess I'll figure out in the next patch)
Attachment #8809276 - Flags: review?(bbouvier) → review+
Comment on attachment 8809277 [details] [diff] [review] instantiate Review of attachment 8809277 [details] [diff] [review]: ----------------------------------------------------------------- Found one non-nit, I think: instantiate should return Instance *and* Module, per the design repo wording. This and the wrapped question have me want a second look. The Promise code is very clean and easy to understand! ::: js/src/wasm/WasmJS.cpp @@ +1794,5 @@ > + RootedWasmInstanceObject instanceObj(cx); > + if (!Instantiate(cx, *module, importObj, &instanceObj)) > + return RejectWithPendingException(cx, promise); > + > + RootedValue resolutionValue(cx, ObjectValue(*instanceObj)); This is not correct, per https://github.com/WebAssembly/design/blob/master/JS.md: On success, the Promise is fulfilled with a plain JavaScript object pair {module, instance} containing the resulting WebAssembly.Module and WebAssembly.Instance @@ +1822,5 @@ > + RootedObject importObj(cx); > + if (!GetInstantiateArgs(cx, callArgs, &firstArg, &importObj)) > + return RejectWithPendingException(cx, promise, callArgs); > + > + if (firstArg->is<WasmModuleObject>()) { It's a bit strange that the type checking of the first arg is made in two different functions. Could a wrapped Module be passed to this Instantiate? If so, I think it might be considered a bad arg in this impl.
Attachment #8809277 - Flags: review?(bbouvier) → review+
Comment on attachment 8809277 [details] [diff] [review] instantiate Review of attachment 8809277 [details] [diff] [review]: ----------------------------------------------------------------- (oops, so used to r+ your patches...)
Attachment #8809277 - Flags: review+
I assume this is P1, based on the fact that we want WebAssembly in FF52.
Priority: -- → P1
Attached patch instantiateSplinter Review
Phew, great catch!
Attachment #8809277 - Attachment is obsolete: true
Attachment #8809432 - Flags: review?(bbouvier)
Comment on attachment 8809432 [details] [diff] [review] instantiate Review of attachment 8809432 [details] [diff] [review]: ----------------------------------------------------------------- Great, thanks!
Attachment #8809432 - Flags: review?(bbouvier) → review+
Pushed by lwagner@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/f290780813ad Baldr: add Module.{imports,exports} (r=bbouvier) https://hg.mozilla.org/integration/mozilla-inbound/rev/4b46d55b13bd Baldr: hoist CanUseExtraThreads promise logic (r=bbouvier) https://hg.mozilla.org/integration/mozilla-inbound/rev/bfd4da2301e5 Baldr: add WebAssembly.instantiate (r=bbouvier)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: