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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 456
457 void AstGraphBuilder::VisitBlock(Block* stmt) { 457 void AstGraphBuilder::VisitBlock(Block* stmt) {
458 BlockBuilder block(this); 458 BlockBuilder block(this);
459 BreakableScope scope(this, stmt, &block, 0); 459 BreakableScope scope(this, stmt, &block, 0);
460 if (stmt->labels() != NULL) block.BeginBlock(); 460 if (stmt->labels() != NULL) block.BeginBlock();
461 if (stmt->scope() == NULL) { 461 if (stmt->scope() == NULL) {
462 // Visit statements in the same scope, no declarations. 462 // Visit statements in the same scope, no declarations.
463 VisitStatements(stmt->statements()); 463 VisitStatements(stmt->statements());
464 } else { 464 } else {
465 const Operator* op = javascript()->CreateBlockContext(); 465 Node* context = nullptr;
466 Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo()); 466 if (stmt->scope()->ContextLocalCount() > 0) {
467 Node* context = NewNode(op, scope_info, GetFunctionClosure()); 467 const Operator* op = javascript()->CreateBlockContext();
468 Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
469 context = NewNode(op, scope_info, GetFunctionClosure());
470 }
468 ContextScope scope(this, stmt->scope(), context); 471 ContextScope scope(this, stmt->scope(), context);
469 472
470 // Visit declarations and statements in a block scope. 473 // Visit declarations and statements in a block scope.
471 VisitDeclarations(stmt->scope()->declarations()); 474 VisitDeclarations(stmt->scope()->declarations());
472 VisitStatements(stmt->statements()); 475 VisitStatements(stmt->statements());
473 } 476 }
474 if (stmt->labels() != NULL) block.EndBlock(); 477 if (stmt->labels() != NULL) block.EndBlock();
475 } 478 }
476 479
477 480
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 2225
2223 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( 2226 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
2224 IterationStatement* stmt) { 2227 IterationStatement* stmt) {
2225 if (loop_assignment_analysis_ == NULL) return NULL; 2228 if (loop_assignment_analysis_ == NULL) return NULL;
2226 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); 2229 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
2227 } 2230 }
2228 2231
2229 } // namespace compiler 2232 } // namespace compiler
2230 } // namespace internal 2233 } // namespace internal
2231 } // namespace v8 2234 } // namespace v8
OLDNEW
« 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