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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 804463002: Stack-allocate block variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moar progress Created 6 years 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/compiler/ast-graph-builder.h ('k') | src/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index cde5e7182df0cba24ed1147a4b503d62a9b0a9e9..1ccd48ee6a5fb280b2e6884dffca51440dc7f637 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -462,9 +462,12 @@ void AstGraphBuilder::VisitBlock(Block* stmt) {
// Visit statements in the same scope, no declarations.
VisitStatements(stmt->statements());
} else {
- const Operator* op = javascript()->CreateBlockContext();
- Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
- Node* context = NewNode(op, scope_info, GetFunctionClosure());
+ Node* context = nullptr;
+ if (stmt->scope()->ContextLocalCount() > 0) {
+ const Operator* op = javascript()->CreateBlockContext();
+ Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
+ context = NewNode(op, scope_info, GetFunctionClosure());
+ }
ContextScope scope(this, stmt->scope(), context);
// Visit declarations and statements in a block scope.
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698