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

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

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 8 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 | « no previous file | src/full-codegen.h » ('j') | src/parser.cc » ('J')
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 6828b5b0a86c7bb3e85ae2745c12401a1f5cc812..b0fde277df61353b8e6e6b702384c8ce3413d8e2 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1005,10 +1005,15 @@ void AstGraphBuilder::VisitBlock(Block* stmt) {
VisitStatements(stmt->statements());
} else {
// Visit declarations and statements in a block scope.
- Node* context = BuildLocalBlockContext(stmt->scope());
- ContextScope scope(this, stmt->scope(), context);
- VisitDeclarations(stmt->scope()->declarations());
- VisitStatements(stmt->statements());
+ if (stmt->scope()->ContextLocalCount() > 0) {
+ Node* context = BuildLocalBlockContext(stmt->scope());
+ ContextScope scope(this, stmt->scope(), context);
+ VisitDeclarations(stmt->scope()->declarations());
+ VisitStatements(stmt->statements());
+ } else {
+ VisitDeclarations(stmt->scope()->declarations());
+ VisitStatements(stmt->statements());
+ }
}
if (stmt->labels() != NULL) block.EndBlock();
}
@@ -1463,10 +1468,15 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
VisitClassLiteralContents(expr);
} else {
// Visit declarations and class literal in a block scope.
- Node* context = BuildLocalBlockContext(expr->scope());
- ContextScope scope(this, expr->scope(), context);
- VisitDeclarations(expr->scope()->declarations());
- VisitClassLiteralContents(expr);
+ if (expr->scope()->ContextLocalCount() > 0) {
+ Node* context = BuildLocalBlockContext(expr->scope());
+ ContextScope scope(this, expr->scope(), context);
+ VisitDeclarations(expr->scope()->declarations());
+ VisitClassLiteralContents(expr);
+ } else {
+ VisitDeclarations(expr->scope()->declarations());
+ VisitClassLiteralContents(expr);
+ }
}
}
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698