| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |