Closed Bug 1546383 Opened 5 months ago Closed 4 months ago

Add CacheIR support for calling getters on primitive values

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

Neither Ion nor CacheIR support calling getters on primitive values, which makes the access to Symbol.prototype.description really slow in comparison to JSC and V8. As a first step we should add CacheIR support here.

µ-benchmark:

if (typeof dateNow === "undefined") {
  if (typeof preciseTime === "function") {
    dateNow = () => preciseTime() * 1000;
  } else if (typeof performance === "object" && typeof performance.now ===
"function") {
    dateNow = performance.now;
  } else {
    dateNow = Date.now;
  }
}

function f() {
    var xs = [
        Symbol(""),
        Symbol(""),
    ];
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += xs[i & 1].description.length;
    }
    return [dateNow() - t, q]
}
Engine Time
SM ~300ms
SM (with patch) 25ms
JSC 12ms
V8 8ms
Priority: -- → P1

Pushed by dluca@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1f47ae47ceac
Add CacheIR support for calling getters on primitive values. r=mgaudet

Keywords: checkin-needed
Flags: needinfo?(andrebargull)

Running the builds linked at comment #4 locally, I see the following assertion:

C:\Users\andre\Downloads\target.jsshell>js.exe --ion-eager ..\cacheir-getter-primitive.js
Assertion failure: !availableRegs_.empty(), at z:/build/build/src/js/src/jit/CacheIRCompiler.cpp:422

So there are too few registers available on 32-bit builds. New try build: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d72f1838dd432fbfbdd65c9ddd672552942d06f2

Flags: needinfo?(andrebargull)

Try from comment #5 was successful.

Keywords: checkin-needed

Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/15178f63cc19
Add CacheIR support for calling getters on primitive values. r=mgaudet

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.