Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Unified Diff: src/parsing/parser.cc

Issue 2898163002: Make non-Module generators only context allocate parameters. (Closed)
Patch Set: Fix comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index d2f9c74e58b3246e2228d17b1c6c4ee47a59541f..8693d534970d95a831ff6069dfb8e998abf0023a 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -706,6 +706,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
var->AllocateTo(VariableLocation::PARAMETER, 0);
PrepareGeneratorVariables();
+ scope->ForceContextAllocation();
neis 2017/05/24 10:39:37 Do we still need this? If not, do we still want it
adamk 2017/05/24 13:04:00 Do you mean "is this call now redundant?" or "do w
neis 2017/05/24 13:59:46 I meant do we still need/want to force context all
adamk 2017/05/24 14:31:22 This would depend on how advanced the preparsing-o
Expression* initial_yield =
BuildInitialYield(kNoSourcePosition, kGeneratorFunction);
body->Add(
@@ -2532,11 +2533,9 @@ void Parser::DeclareArrowFunctionFormalParameters(
}
void Parser::PrepareGeneratorVariables() {
- // For generators, allocating variables in contexts is currently a win because
- // it minimizes the work needed to suspend and resume an activation. The
- // code produced for generators relies on this forced context allocation (it
- // does not restore the frame's parameters upon resume).
- function_state_->scope()->ForceContextAllocation();
+ // The code produced for generators relies on forced context allocation of
+ // parameters (it does not restore the frame's parameters upon resume).
+ function_state_->scope()->ForceContextAllocationForParameters();
// Calling a generator returns a generator object. That object is stored
// in a temporary variable, a definition that is used by "yield"

Powered by Google App Engine
This is Rietveld 408576698