Prefer JSObject subclasses in CacheIR code to avoid emitting unreachable code
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox88 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(21 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
TestMatchingReceiver has if-statements to handle ProxyObject and TypedObject types, even though this function is only called with NativeObject. This can easily be fixed if we properly pass NativeObject* instead of JSObject* through all callers. As part of this bug, I'll also remove unnecessary rooting, for example in IRGenerator::emitIdGuard, which contains a rooted and a non-rooted parameter, which is slightly confusing.
| Assignee | ||
Comment 1•5 years ago
|
||
| Assignee | ||
Comment 2•5 years ago
|
||
Use NativeObject* for the no-gc variant of NativeLookupPropertyInline and
then update all callers to use NativeObject*, too.
Depends on D107838
| Assignee | ||
Comment 3•5 years ago
|
||
Use NativeObject* for EmitCallGetterResultGuards, this allows us to directly
call TestMatchingNativeReceiver.
Depends on D107839
| Assignee | ||
Comment 4•5 years ago
|
||
Similar to part 3, this allows to directly call TestMatchingNativeReceiver().
Depends on D107841
| Assignee | ||
Comment 5•5 years ago
|
||
Similar to part 3, this allows to directly call TestMatchingNativeReceiver().
Depends on D107842
| Assignee | ||
Comment 6•5 years ago
|
||
Similar to part 3, this allows to directly call TestMatchingNativeReceiver().
TestMatchingReceiver() is no longer used, so we can remove it now, too.
Depends on D107843
| Assignee | ||
Comment 7•5 years ago
|
||
GuardTypeDescr is no longer used after part 6.
Also removes the corresponding MacroAssembler methods.
Depends on D107844
| Assignee | ||
Comment 8•5 years ago
|
||
Part 7 showed that there are incorrect includes to "wasm/TypedObject.h".
(MacroAssembler used TypedObject without including it.)
Depends on D107845
| Assignee | ||
Comment 9•5 years ago
|
||
Use NativeObject* in GeneratePrototypeHoleGuards, GuardReceiverProto, and
ShapeGuardProtoChain, so it's more obvious why calling JSObject::staticPrototype()
is correct.
Depends on D107846
| Assignee | ||
Comment 10•5 years ago
|
||
Pass through NativeObject* to TestMatchingHolder() instead of asserting
the argument JSObject is a native object.
Depends on D107847
| Assignee | ||
Comment 11•5 years ago
|
||
IsCacheableGetPropReadSlot() and IsCacheableGetPropCall() are only applicable
for native objects, therefore use NativeObject* for both functions.
Depends on D107848
| Assignee | ||
Comment 12•5 years ago
|
||
Similar to part 11, use NativeObject* for these two functions.
Depends on D107849
| Assignee | ||
Comment 13•5 years ago
|
||
IsCacheableProtoChain() is only called with NativeObject*. Also turn all
IsCacheableProtoChain() checks into assertions to match the current code.
The comment about lookupProperty potentially modifying the prototype chain
dates back to bug 729099. At that point of time, the code was calling
JSObject::lookupProperty() (today's js::LookupProperty()), which could
indeed modify the prototype chain. But today CacheIR is always calling
js::LookupPropertyPure() (or similar functions), which can't alter any
prototypes.
Depends on D107850
| Assignee | ||
Comment 14•5 years ago
|
||
Using NativeObject* doesn't give any extra value except for documenting which
types of objects we currently expect here.
Depends on D107851
| Assignee | ||
Comment 15•5 years ago
|
||
No functions called in CanAttachNativeGetProp() can GC, so we can safely use
raw pointers.
Depends on D107852
| Assignee | ||
Comment 16•5 years ago
|
||
The DOMInstanceClassHasProtoAtDepth call in CanAttachDOMCall() can't be
analysed by the hazard analysis because it happens through a pointer to a
function. This means any GC values must either be rooted or alternatively
JS::AutoSuppressGCAnalysis could be used to disable the hazard analysis.
Consistently use handles for both functions so callers can't use raw pointers
without causing a compiler error.
Depends on D107854
| Assignee | ||
Comment 17•5 years ago
|
||
Replace more rooted variables with raw pointers. Also avoids in some places
to have rooted and raw pointers next to each other.
Depends on D107855
| Assignee | ||
Comment 18•5 years ago
|
||
Depends on D107856
| Assignee | ||
Comment 19•5 years ago
|
||
Depends on D107857
| Assignee | ||
Comment 20•5 years ago
|
||
Depends on D107860
| Assignee | ||
Comment 21•5 years ago
|
||
Depends on D107861
Updated•5 years ago
|
Updated•5 years ago
|
Comment 22•5 years ago
|
||
Comment 23•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6091f772179c
https://hg.mozilla.org/mozilla-central/rev/1a1d48764556
https://hg.mozilla.org/mozilla-central/rev/655671c2ec69
https://hg.mozilla.org/mozilla-central/rev/3c84769b0a00
https://hg.mozilla.org/mozilla-central/rev/0daa0d35c49c
https://hg.mozilla.org/mozilla-central/rev/1ea7ec3d8f5c
https://hg.mozilla.org/mozilla-central/rev/766614ff771c
https://hg.mozilla.org/mozilla-central/rev/3cdb584bd4a0
https://hg.mozilla.org/mozilla-central/rev/94be6f952008
https://hg.mozilla.org/mozilla-central/rev/711b00030864
https://hg.mozilla.org/mozilla-central/rev/ccf84078cea2
https://hg.mozilla.org/mozilla-central/rev/04321bf57b5b
https://hg.mozilla.org/mozilla-central/rev/3a2ced62cd9f
https://hg.mozilla.org/mozilla-central/rev/ed113f45c482
https://hg.mozilla.org/mozilla-central/rev/861100e3f84b
https://hg.mozilla.org/mozilla-central/rev/6ed359874293
https://hg.mozilla.org/mozilla-central/rev/a1e3663e5bc0
https://hg.mozilla.org/mozilla-central/rev/8d7bba4146f5
https://hg.mozilla.org/mozilla-central/rev/b551678dc0de
https://hg.mozilla.org/mozilla-central/rev/98642a9e548e
https://hg.mozilla.org/mozilla-central/rev/8249396ef069
Description
•