[jsdbg2] Debugger::wrapVariantReferent has many unnecessary type parameters
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
(Whiteboard: [debugger-mvp])
Attachments
(6 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
In the review for a patch on bug 1564170 ("Give Debugger.Script instances their own NativeObject subclass, DebuggerScript"), jorendorff suggested the following cleanup:
I'm guessing the ReferentVariant parameter here is fully determined by Wrapper; please remove it as a template parameter and make it a member typedef instead, Wrapper::ReferentVariant.
(Actually I bet all 3 of the others are fully determined by Referent. This could be a lot nicer. Oh well!)
Assignee | ||
Comment 1•6 years ago
|
||
Give DebuggerWeakMap a Wrapper
type parameter to use as the WeakMap value type
instead of plain JSObject*. Then, supply a specific wrapper class type for each
DebuggerWeakMap instantiation.
No intended change in visible behavior.
Assignee | ||
Comment 2•6 years ago
|
||
Technically, DebuggerWeakMap could be used for any sort of cross-compartment
mapping. But we actually only use it for looking up Debugger reflection objects,
so it is more informative to call the key and value types 'referent' and
'wrapper'.
No intended change in visible behavior.
Depends on D38539
Assignee | ||
Comment 3•6 years ago
|
||
Give DebuggerScript and DebuggerSource a member type that spells out the variant
type appropriate for their referents. This allows wrapVariantReferent to simply
consult the wrapper for the referent variant type instead of demanding it as a
type parameter.
No intended change in visible behavior.
Depends on D38540
Assignee | ||
Comment 4•6 years ago
|
||
It's more convenient for a DebuggerWeakMap's Wrapper type parameter to be the
pointed-to type, not the pointer type, since we'll be consulting its member
types. Then, it's a bit more consistent to also use the pointed-to type for
Referent.
Depends on D38541
Assignee | ||
Comment 5•6 years ago
|
||
For generatorFrames, this doesn't matter, but for sources, subsequent patches
need a more precise Referent type than simply 'JSObject'.
Any type used as a weak map key needs a MovableCellHasher instantiation, so add
the necessary ones to Barrier.cpp. Since the list is getting long, sort it.
Depends on D38542
Assignee | ||
Comment 6•6 years ago
|
||
Finally, once we know the type of the map we're consulting, that tells us all
the other types we need to know: certainly the referent and wrapper types, but
also the referent variant type, via the wrapper.
DebuggerWeakMap does need new member types to tell us what its Referent and
Wrapper types are. Rename the type parameters to avoid shadowing.
Since the map type can be inferred from the call, we no longer need to pass any
type parameters at all when we call the innermost wrapVariantReferent overload.
Depends on D38543
Assignee | ||
Comment 7•6 years ago
|
||
This isn't actually that complicated; I just ran into too many verbose errors when I tried to do it all in one step, and doing it in tiny steps was easier. Hopefully it'll make the review easier as well.
Updated•6 years ago
|
Updated•6 years ago
|
![]() |
||
Comment 9•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/95f206dd2dae
https://hg.mozilla.org/mozilla-central/rev/c659f1359db5
https://hg.mozilla.org/mozilla-central/rev/61d30888957a
https://hg.mozilla.org/mozilla-central/rev/f8a3b8b9c876
https://hg.mozilla.org/mozilla-central/rev/661d131593dd
https://hg.mozilla.org/mozilla-central/rev/708ce1c9a53f
Description
•