Closed
Bug 1118559
Opened 10 years ago
Closed 10 years ago
Asking if a slot is aliased is confusing
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: shu, Assigned: shu)
References
Details
Attachments
(2 files)
14.24 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
1.27 KB,
patch
|
Sylvestre
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
JSScript::varIsAliased is confusingly named. From the name alone, it seems like you can ask if a var slot is aliased. But this doesn't even make sense: vars with slots are not aliased by definition; if they didn't have a slot, then they would live in the CallObject and would not have a slot.
The argument that varIsAliased really expects is the binding index into the script's binding array, not the frame index.
I found this while investigating why "inner" in the snippet below wasn't getting inlined:
function bench() {
var x = 0;
function inner() { x++; }
for (var i = 0; i < 1000000; i++)
inner();
print(x);
}
x has bindingIndex = 0, frameIndex = n/a because it's aliased
inner has bindingIndex = 1, frameIndex = 0
Ion then asks JSScript if slot 0 is aliased, and JSScript erroneously returns true.
Assignee | ||
Comment 1•10 years ago
|
||
Rename varIsAliased to bindingIsAliased and require the caller to pass in a
BindingIter instead of a bare uint32, to make it clear that this is not a slot
number.
Attachment #8544926 -
Flags: review?(jdemooij)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → shu
Comment 2•10 years ago
|
||
Comment on attachment 8544926 [details] [diff] [review]
Make checking if a slot is aliased less confusing.
Review of attachment 8544926 [details] [diff] [review]:
-----------------------------------------------------------------
Much nicer! Thanks.
Attachment #8544926 -
Flags: review?(jdemooij) → review+
Comment 3•10 years ago
|
||
Btw, please backport the CompileInfo.h change to Aurora. It's a one-liner and (based on the testcase in comment 0) this might affect a lot of code.
Blocks: 1090491
status-firefox36:
--- → affected
status-firefox37:
--- → affected
tracking-firefox36:
--- → ?
tracking-firefox37:
--- → ?
Comment 4•10 years ago
|
||
Good improvement! To wit, before Jan's recent work, all variables used to have slots, even the aliased ones, so one could query whether a slot was aliased (which meant the slot was dead space). This weirdness derives from the original design of storing all variables in the StackFrame and having the CallObject alias the StackFrame.
Assignee | ||
Comment 5•10 years ago
|
||
Approval Request Comment
[Feature/regressing bug #]: 1090491
[User impact if declined]: possibly slower JS
[Describe test coverage new/current, TBPL]: pushed to central
[Risks and why]: low, no new feature, just bug fix
[String/UUID change made/needed]: none
Attachment #8546970 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
This was a ~10% win or so on Octane-pdfjs on AWFY. Nice :)
Comment 8•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Updated•10 years ago
|
Attachment #8546970 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Clearing tracking requests.
tracking-firefox36:
? → ---
tracking-firefox37:
? → ---
Updated•10 years ago
|
Flags: qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•