Closed
Bug 1113677
Opened 10 years ago
Closed 10 years ago
Fold instanceof based on type information
Categories
(Core :: JavaScript Engine: JIT, defect)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(2 files)
4.45 KB,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
754 bytes,
patch
|
h4writer
:
review+
|
Details | Diff | Splinter Review |
This is the TI-based folding mentioned in bug 1113643 comment 0. It also detects the case where LHS is either an object or primitive but if it's an object it's known to be instanceof RHS. In this case we can't fold it completely but we can replace it with a much faster IsObject check. This is apparently a pretty common case on Octane earley-boyer, patch wins at least a few hundred points there.
Attachment #8539293 -
Flags: review?(bhackett1024)
Assignee | ||
Comment 1•10 years ago
|
||
Brian, does HasOnProtoChain have to do anything special to guard against mutating __proto__? I don't think so because we have similar loops elsewhere in IonBuilder, but maybe I'm missing something.
Flags: needinfo?(bhackett1024)
Comment 2•10 years ago
|
||
Comment on attachment 8539293 [details] [diff] [review] Patch Review of attachment 8539293 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/IonBuilder.cpp @@ +11162,5 @@ > return true; > } > > +static bool > +HasOnProtoChain(types::TypeObjectKey *object, JSObject *protoObject, bool *hasOnProto) This function does need to do something to make sure the prototype chain doesn't mutate. This generally happens implicitly; when an object's prototype is mutated its properties are all marked as unknown, and other places in IonBuilder should be freezing on some part of the objects which it traverses, such as through isOwnProperty(). In this case you only care about the prototype chain, but calling object->hasFlags(constraints, OBJECT_FLAG_UNKNOWN_PROPERTIES) in the loop below should work. @@ +11188,5 @@ > + > + object = types::TypeObjectKey::get(proto); > + } > + > + MOZ_CRASH("Unrechable"); typo
Attachment #8539293 -
Flags: review?(bhackett1024) → review+
Updated•10 years ago
|
Flags: needinfo?(bhackett1024)
Assignee | ||
Comment 3•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ea53aab8d7ce Added a test for the mutating __proto__ thing that fails without the constraint (should have started with that I guess..).
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #0) > This is apparently a pretty common case on Octane earley-boyer, patch wins > at least a few hundred points there. About 8% on AWFY. I checked and we're able to fold or optimize-to-IsObject all instanceof's on earley-boyer so it's pretty effective.
Comment 5•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ea53aab8d7ce
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Comment 6•10 years ago
|
||
Appears to have caused a 8% regression on Octane-navierstrokes on AWFY on machine 28 , http://arewefastyet.com/#machine=28&view=breakdown&suite=octane .
Assignee | ||
Comment 7•10 years ago
|
||
(In reply to mayankleoboy1 from comment #6) > Appears to have caused a 8% regression on Octane-navierstrokes on AWFY on > machine 28 , http://arewefastyet.com/#machine=28&view=breakdown&suite=octane > . Yeah, pretty weird. Navier-stokes doesn't even use instanceof...
Assignee | ||
Comment 8•10 years ago
|
||
Minor follow-up patch to add congruentTo to MIsObject. Didn't want to file a separate bug just for this.
Attachment #8540127 -
Flags: review?(hv1989)
Comment 9•10 years ago
|
||
Comment on attachment 8540127 [details] [diff] [review] Follow-up: add MIsObject::congruentTo Review of attachment 8540127 [details] [diff] [review]: ----------------------------------------------------------------- Good find
Attachment #8540127 -
Flags: review?(hv1989) → review+
Assignee | ||
Comment 10•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/c1747e8d827b
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 11•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c1747e8d827b
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
Resolution: --- → FIXED
Comment 12•10 years ago
|
||
Doesnt appear to have fixed the regression
Updated•10 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•