Move object/string pre-barrier null check to JIT code

RESOLVED FIXED in Firefox 56

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: jandem, Assigned: jandem)

Tracking

(Blocks 1 bug)

unspecified
mozilla56
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(1 attachment)

Posted patch PatchSplinter Review
Right now we null check in Mark{Object,String}FromIon but that's slower than doing it in JIT code before we make the call.

The null case is actually pretty common when initializing unboxed objects, see the micro-benchmark below. I get:

before: 157 ms
after:   48 ms

I noticed this on Speedometer where we sometimes have incremental GCs going on while running tests.

function f() {
    startgc(1);
    var t = new Date;
    var o;
    for (var i=0; i<10000000; i++)
	o = {x: Math};
    print(new Date - t);
    return o;
}
f();
Attachment #8878078 - Flags: review?(nicolas.b.pierron)
Comment on attachment 8878078 [details] [diff] [review]
Patch

Review of attachment 8878078 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch!

::: js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ +1038,5 @@
> +    vixl::UseScratchRegisterScope temps(this);
> +    const Register scratch = temps.AcquireX().asUnsized();
> +    MOZ_ASSERT(scratch != lhs.base);
> +    MOZ_ASSERT(scratch != lhs.index);
> +    loadPtr(lhs, scratch);

nit: Pick a different temporary register.

http://searchfox.org/mozilla-central/rev/c49a70b53f67dd5550eec8a08793805f2aca8d42/js/src/jit/arm64/MacroAssembler-arm64.h#761
Attachment #8878078 - Flags: review?(nicolas.b.pierron) → review+
(In reply to Nicolas B. Pierron [:nbp] from comment #1)
> nit: Pick a different temporary register.

I think on ARM64 UseScratchRegisterScope picks the next register that's available so it should be fine.
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/231bd9d90fb3
Move object/string pre-barrier null check to JIT code. r=nbp
https://hg.mozilla.org/mozilla-central/rev/231bd9d90fb3
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.