Closed
Bug 1227677
Opened 9 years ago
Closed 9 years ago
Disentangle comprehension for-in/of handling from for-in/of loop handling
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: Waldo, Assigned: Waldo)
References
Details
Attachments
(6 files)
4.56 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
21.15 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
13.67 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
13.92 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
8.72 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
3.59 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
Quarantine the contagion!
Assignee | ||
Comment 1•9 years ago
|
||
This might/might not belong in this bug, but I happened to develop the rest of these atop this, and it's a minimal patch.
<none>
Attachment #8691517 -
Flags: review?(shu)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8691575 -
Flags: review?(shu)
Assignee | ||
Comment 3•9 years ago
|
||
Lots of copypasta, alas. Aside from removing the code definitely not relevant to comprehensions (the spreading cases, mostly), and adding stack-related comments, I didn't make actual changes.
Attachment #8691607 -
Flags: review?(shu)
Assignee | ||
Comment 4•9 years ago
|
||
It matches the variable's used meaning more (used to determine when to push/pop a block scope). And |letDecl| implies relevance to |let| declarations, but |for (let x of []);| doesn't actually trigger |*letDecl|.
Attachment #8691611 -
Flags: review?(shu)
Assignee | ||
Comment 5•9 years ago
|
||
Parser::forStatement never produces PNK_FOR{IN,OF} with first kid not either null or a declaration -- only comprehensions can have PNK_LEXICALSCOPE. Cleaning up the comprehension code as the complement to this is left to a separate patch.
Attachment #8691612 -
Flags: review?(shu)
Assignee | ||
Comment 6•9 years ago
|
||
The code/comments as they exist now, for for-in/of regardless of comprehensions or not, are a bit wrong. Rewrite some, and simplify the code too.
Attachment #8691617 -
Flags: review?(shu)
Comment 7•9 years ago
|
||
Comment on attachment 8691517 [details] [diff] [review]
Some minor renaming in for-in stuffs
Review of attachment 8691517 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/frontend/Parser.cpp
@@ -5371,5 @@
> bool constDecl = tt == TOK_CONST;
> isForDecl = true;
> - blockObj = StaticBlockObject::create(context);
> - if (!blockObj)
> - return null();
lol I think jorendorff also removed this recently.
Attachment #8691517 -
Flags: review?(shu) → review+
Comment 8•9 years ago
|
||
Comment on attachment 8691575 [details] [diff] [review]
Extract PNK_COMPREHENSIONFOR from PNK_FOR so that comprehension gunk doesn't taint for-loop emitting logic
Review of attachment 8691575 [details] [diff] [review]:
-----------------------------------------------------------------
In itself the patch doesn't do anything. I'm assuming the juicy stuff is in the later patches.
::: js/src/frontend/Parser.cpp
@@ +7910,1 @@
> nullptr, nullptr);
Why is this not switched to handler.newComprehensionFor? I suppose it's because the for-head and the body aren't yet parsed at this point, and are assigned later. Indeed, legacyComprehensionTail is a terrifying function, so it's fine to leave this as is.
Attachment #8691575 -
Flags: review?(shu) → review+
Comment 9•9 years ago
|
||
Comment on attachment 8691607 [details] [diff] [review]
Emit code for PNK_COMPREHENSIONFOR using separate code from that used for for-loops
Review of attachment 8691607 [details] [diff] [review]:
-----------------------------------------------------------------
This is literally copied emitForIn, emitForOf, and emitForInOrOfVariables, but renamed, right? I did not read them super closely.
::: js/src/frontend/BytecodeEmitter.cpp
@@ +5905,5 @@
> + //
> + // In `for (let x in/of EXPR)`, ES6 specifies that EXPR is evaluated in a
> + // scope containing an uninitialized `x`. If EXPR accesses `x`, we should
> + // get a ReferenceError due to the TDZ violation. This is not yet
> + // implemented. See bug 1069480.
Does this comment apply to the comprehension case? Doesn't seem to.
Attachment #8691607 -
Flags: review?(shu) → review+
Updated•9 years ago
|
Attachment #8691611 -
Flags: review?(shu) → review+
Updated•9 years ago
|
Attachment #8691612 -
Flags: review?(shu) → review+
Updated•9 years ago
|
Attachment #8691617 -
Flags: review?(shu) → review+
Comment 10•9 years ago
|
||
Assignee | ||
Comment 11•9 years ago
|
||
Horrifically bad try-results that I don't really believe at all (I think it's just a steady stream of unrelated intermittent-orange) have me pushing this in some increments. That's just the first one, rest to come whenever I manage to convince myself there's not real bustage in them. Somehow. Seeing as I don't think there is now but fear the tree-gods.
Keywords: leave-open
Comment 12•9 years ago
|
||
bugherder |
Comment 13•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/748c27d6775f
https://hg.mozilla.org/integration/mozilla-inbound/rev/e17be37dbd32
https://hg.mozilla.org/integration/mozilla-inbound/rev/781b2dc8f216
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d30a3fecc3a
https://hg.mozilla.org/integration/mozilla-inbound/rev/68a9e4279f60
Comment 14•9 years ago
|
||
bugherder |
Assignee | ||
Updated•9 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•