Closed Bug 1263778 Opened 9 years ago Closed 9 years ago

Discard the current "lazy" [[Prototype]] nomenclature, use "dynamic" instead

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

References

Details

Attachments

(1 file)

The current setup for prototypes that are not stored as direct values is to call them "lazy". This is a holdover from the days of wrappers, where we'd only determine the prototype on request, "lazily". But this isn't really right, because the wrappee's prototype could change without the wrapper knowing about it. So every prototype access has to dynamically check the wrappee. And then there are proxies those prototypes are fully-dynamic, computed only when accessed. Like scripted proxies. So really, we should just call them "dynamic", and the alternative "static". Here's a patch that propagates this naming decision throughout SpiderMonkey. It also makes the static/dynamic duality clearer at call sites that directly access a static prototype. (I had to do this to verify all direct-prototype-accessing users were okay with adding [[{G,S}etPrototypeOf]] traps to scripted proxies for bug 888969.)
Attached patch PatchSplinter Review
I manually verified all the places I touched, were correctly guarded as to static-assumptions. Feel free to reverify if you want, or to request more comments justifying staticness if I didn't add them. Some of the places making assumptions are really, really gnarly. :-(
Attachment #8740200 - Flags: review?(efaustbmo)
Comment on attachment 8740200 [details] [diff] [review] Patch Review of attachment 8740200 [details] [diff] [review]: ----------------------------------------------------------------- APPROVED. ::: js/src/jsiter.cpp @@ +705,5 @@ > ni->guard_array[ind++].init(ReceiverGuard(pobj)); > + > + // The one caller of this method that passes |numGuards > 0|, does > + // so only if the entire chain consists of cacheable objects (that > + // necessarily have static prototypes). This is the kind of comment that starts off crisp and crunchy and delicious, and ends up being able to fold itself in half without so much as a crack. Is there some way that this will not inevitably be super stale? ::: js/src/jsobj.h @@ +378,5 @@ > bool hasTenuredProto() const; > > bool uninlinedIsProxy() const; > > +#if 10 Looks like this is here by accident. Was a #if 0, that got turned back on, and then forgotten about. Please remove the #if.
Attachment #8740200 - Flags: review?(efaustbmo) → review+
(In reply to Eric Faust [:efaust] from comment #2) > > + // The one caller of this method that passes |numGuards > 0|, does > > + // so only if the entire chain consists of cacheable objects (that > > + // necessarily have static prototypes). > > This is the kind of comment that starts off crisp and crunchy and delicious, > and ends up being able to fold itself in half without so much as a crack. Is > there some way that this will not inevitably be super stale? Good question! Short of rewriting this all to do the looping in one method, I don't think there is. And such a rewrite is probably out of scope for this bug, although it'd be great if it happened at some point. Maybe someone touching this code more often/frequently can do it.
Hi Jeff, sorry had to back this out for assertion failures like https://treeherder.mozilla.org/logviewer.html#?job_id=26779232&repo=mozilla-inbound
Flags: needinfo?(jwalden+bmo)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Flags: needinfo?(jwalden+bmo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: