Bug 166486 - WebAssembly -> JS: don't do a double entry
Summary: WebAssembly -> JS: don't do a double entry
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 165282
Blocks: 161709
  Show dependency treegraph
 
Reported: 2016-12-26 16:51 PST by JF Bastien
Modified: 2017-01-02 17:31 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2016-12-26 16:51:05 PST
We have createJSToWasmWrapper as well as WebAssemblyFunction::call. We should merge the two, probably to B3 code or MacroAssembler code.
Comment 1 JF Bastien 2016-12-26 16:52:01 PST
Let's also figure out what vmEntryToWasm should be.
Comment 2 JF Bastien 2017-01-02 17:31:45 PST
We should also consider optimizing as discussed here:

> > > > Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp:90
> > > > +        // Always start with a dummy Memory, so that wasm -> wasm thunks avoid checking for a nullptr Memory when trying to set pinned registers.
> > > > +        Wasm::Memory memory;
> > > > +        instance->setMemory(vm, JSWebAssemblyMemory::create(vm, exec->lexicalGlobalObject()->WebAssemblyMemoryStructure(), WTFMove(memory)));
> > > 
> > > This makes me wonder if we're better off just having the callee instead of
> > > caller generate a wasm->wasm call thunk. Maybe we should do that in a later
> > > patch, or at least have a bug open to consider it.
> > 
> > Yeah I guess we could have an off-to-the-side entrypeint from "other wasm",
> > in addition to the regular "entry from this wasm instance", for all of the
> > exported functions. We'd need to also change the callee codegen, but then we
> > wouldn't need to tail (or rather, we'd inline that tail).
> > 
> > That could be more efficient.
> Yeah, let's open a bug and deal with it later.