Closed Bug 962641 Opened 10 years ago Closed 5 years ago

OdinMonkey: add call IC from Ion/Baseline into Odin-compiled code

Categories

(Core :: JavaScript: WebAssembly, defect, P5)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: luke, Assigned: luke)

References

(Blocks 1 open bug)

Details

Right now all calls into asm.js go through the C++ trampoline CallAsmJS.  We should be able to add an Ion call IC that is much much faster.  The only tricky thing CallAsmJS does is push an AsmJSActivation.  To avoid having to duplicate that in assembly, we can:
 1. remove AsmJSActivation::cx_ and use the 'cx' from IonContext (which is already pushed if we are in Ion code)
 2. remove AsmJSActivation::module_ and maintain a linked list of AsmJSModules in the Runtime which is used instead by the cold paths that currently use the stack
 3. remove AsmJSActivation::errorRejoinSP_ and use the stack-walking introduced by bug 895015 instead.
 4. move resumePC_ from AsmJSActivation to AsmJSModule
With these changes, AsmJSActivation is completely removed from the Ion->asm.js call path.

Once the IC knows the identity of the callee and the types of the arguments, the call can simply use MAsmJSPassStackArg and MAsmJSCall to make the actual call.  Because these pass args in registers or unboxed on the stack, this will make an Ion->asm.js call much faster than a normal Ion->Ion call (unless the Ion->Ion call is inlined, of course).
After a bit more thought, I think it'd be simpler initially to just push an AsmJSModule from jit code.  It'd still be nice to remove cx_, errorRejoinSP_ and resumePC_ as described above.  However having an AsmJSActivation stack with module_ (and later, an exitSP_ and exitPC_) will really be useful for asm.js stack-walking as needed for Error.stack and SPS profiling.
Priority: -- → P5
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Component: JavaScript Engine: JIT → Javascript: WebAssembly

We won't fix this for asm.js, and for wasm we have a suitable fast path - we inline wasm calls into ion-compiled code when practical, see IonBuilder::inlineWasmCall.

Status: REOPENED → RESOLVED
Closed: 6 years ago5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.