Closed Bug 1668532 Opened 4 years ago Closed 4 years ago

Warp: support fast Ion => Wasm calls

Categories

(Core :: JavaScript Engine: JIT, task, P2)

task

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

We currently don't support this optimization and it's especially an issue for calls involving i64: the micro-benchmark below is 4-5x slower with Warp. I have a WIP patch to port this to Warp.

var i1 = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`(module (func) (func (param i64) (result i64) (i64.add (local.get 0) (i64.const 1))) (func) (export "f" (func 1)))`)));
function test() {
    var f = i1.exports.f;
    var t = dateNow();
    var res = 0n;
    for (var i = 0; i < 100_000_000; i++) {
        res = f(res);
    }
    print(dateNow() - t);
    print(res);
}
test();

Yeah, not having this would be a (bad?) regression.

Mostly based on IonBuilder::inlineWasmCall. Because there's a post-conversion
instruction for i64 => BigInt, we unfortunately have to relax some assertions
around resume points.

This caught some isEffectful instructions that were marked isMovable. That doesn't
really make sense, but this also doesn't fix any actual issues because optimizations
check both.

Depends on D92579

Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/94aa4cd72aed part 1 - Port MIonToWasmCall optimization to Warp. r=bbouvier,iain https://hg.mozilla.org/integration/autoland/rev/000f531b8ba8 part 2 - Assert resumeAfter is only used with non-movable instructions. r=iain
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: