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

Unified Diff: src/parsing/parser.cc

Issue 2898163002: Make non-Module generators only context allocate parameters. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « src/debug/debug-scopes.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 90c578fb8dc9deb2b8cff77ca16142d6255d3f4a..95b827e6d5ac1adb177ca29e5ebc7d303df75bc7 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();
Expression* initial_yield =
BuildInitialYield(kNoSourcePosition, kGeneratorFunction);
body->Add(
@@ -2531,11 +2532,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"
« no previous file with comments | « src/debug/debug-scopes.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698