Closed
Bug 1782677
Opened 3 years ago
Closed 3 years ago
Optimize away `MakeIteratorWrapper` and/or function created inside it
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
105 Branch
| Tracking | Status | |
|---|---|---|
| firefox105 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
Bug 1781061 will fix the situation around callContentFunction, iterator, and JSOp::DebugCheckSelfHosted.
After that, MakeIteratorWrapper function or the function created inside it could be optimized away.
| Assignee | ||
Comment 1•3 years ago
|
||
The situation is the following:
- "Get" operation on
[Symbol.iterator]property is performed at step 4 - We use
for-ofsyntax to implement the step 5.e loop for-ofperforms[Symbol.iterator]property access, but we don't want to perform it again- We use a wrapper that skips the
[Symbol.iterator]access, and also call[Symbol.iterator]with correctthisvalue
That's the reason why we have the wrapper object and function.
We can skip them by either:
- (a) add self-hosted special syntax to skip
[Symbol.iterator]access infor-of, but receive it - (b) implement the loop with
whileloop, instead offor-of
// Step 4.
// Inlined: GetMethod, steps 1-2.
var usingIterator = items[GetBuiltinSymbol("iterator")];
...
// Step 5.c.
var iterator = MakeIteratorWrapper(items, usingIterator);
...
// Step 5.e
for (var nextValue of allowContentIter(iterator)) {
...
function MakeIteratorWrapper(items, method) {
...
return {
...
[GetBuiltinSymbol("iterator")]: function IteratorMethod() {
return callContentFunction(method, items);
},
};
| Assignee | ||
Comment 2•3 years ago
|
||
Updated•3 years ago
|
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/07d6704acf75
Optimize away extra object and function for already-retrieved iterator method in for-of in self-hosted JS. r=jandem
Comment 4•3 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
status-firefox105:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•