Closed
Bug 1511837
Opened 6 years ago
Closed 6 years ago
Simplify function lookup in JSOP_SUPERFUN and JSOP_SUPERBASE
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
We currently need a scope/environment walk to get the |this|-environment's callee. I think it would be nicer to add a separate JSOP_THISENVCALLEE op with an uint8 numHops operand so we don't need to figure this out at runtime.
Comment 1•6 years ago
|
||
Looking at GetSuperEnvFunction, I'm not reminded of any complications. I support this idea.
Assignee | ||
Comment 2•6 years ago
|
||
We now emit JSOP_CALLEE or JSOP_ENVCALLEE (a new op) to load the callee.
JSOP_SUPERFUN and JSOP_SUPERBASE no longer have to walk the scope/environment
chain.
Assignee | ||
Comment 3•6 years ago
|
||
This worked out nicely.
It also improves our Ion coverage a bit I think: we supported JSOP_SUPERBASE only when super was used directly in a derived class method. Now we also handle the case when it's in an arrow function.
Assignee | ||
Comment 4•6 years ago
|
||
So one problem is that EmitterScope::enterEval does not call checkEnvironmentChainLength and we can fail the numHops <= UINT8_MAX assertion. Possible ways to fix this are:
(1) Call checkEnvironmentChainLength in enterEval and enterGlobal, for consistency with the other enter* methods.
(2) Check numHops in BytecodeEmitter::emitThisEnvironmentCallee.
I think I want to try (1) first. There might be some (crazy) website relying on huge eval depth but I think it's the right fix.
Assignee | ||
Comment 5•6 years ago
|
||
Or maybe (2) is the simpler/safer fix for now. arai, what do you think?
Flags: needinfo?(arai.unmht)
Assignee | ||
Comment 6•6 years ago
|
||
I'll just go with (2) for now and file a follow-up bug to explore (1) :)
Flags: needinfo?(arai.unmht)
Comment 7•6 years ago
|
||
I agree that (2) is the right option here.
I don't think there can be many hops between super call/access and constructor, in ordinary code,
so throwing an error for it should be reasonable.
and also, solving the (1) case separately should be better.
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5555defbbd01
Simplify JSOP_SUPERFUN and JSOP_SUPERBASE by factoring out the callee lookup. r=arai
Comment 9•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•