Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ast/ast-numbering.h" | 5 #include "src/ast/ast-numbering.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 IncrementNodeCount(); | 226 IncrementNodeCount(); |
| 227 node->set_base_id(ReserveIdRange(CountOperation::num_ids())); | 227 node->set_base_id(ReserveIdRange(CountOperation::num_ids())); |
| 228 Visit(node->expression()); | 228 Visit(node->expression()); |
| 229 ReserveFeedbackSlots(node); | 229 ReserveFeedbackSlots(node); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 void AstNumberingVisitor::VisitBlock(Block* node) { | 233 void AstNumberingVisitor::VisitBlock(Block* node) { |
| 234 IncrementNodeCount(); | 234 IncrementNodeCount(); |
| 235 node->set_base_id(ReserveIdRange(Block::num_ids())); | 235 node->set_base_id(ReserveIdRange(Block::num_ids())); |
| 236 | |
| 237 if (FLAG_ignition && node->scope() != nullptr && | |
|
Michael Starzinger
2016/08/09 07:38:26
Just for posterity: We could consider adding Block
| |
| 238 node->scope()->NeedsContext()) { | |
| 239 // Create ScopeInfo while on the main thread to avoid allocation during | |
| 240 // potentially concurrent bytecode generation. | |
| 241 node->scope()->GetScopeInfo(isolate_); | |
| 242 } | |
| 243 | |
| 236 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); | 244 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); |
| 237 VisitStatements(node->statements()); | 245 VisitStatements(node->statements()); |
| 238 } | 246 } |
| 239 | 247 |
| 240 | 248 |
| 241 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { | 249 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { |
| 242 IncrementNodeCount(); | 250 IncrementNodeCount(); |
| 243 VisitVariableProxy(node->proxy()); | 251 VisitVariableProxy(node->proxy()); |
| 244 VisitFunctionLiteral(node->fun()); | 252 VisitFunctionLiteral(node->fun()); |
| 245 } | 253 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); | 573 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
| 566 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 574 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
| 567 DisableCrankshaft(kContextAllocatedArguments); | 575 DisableCrankshaft(kContextAllocatedArguments); |
| 568 } | 576 } |
| 569 | 577 |
| 570 int rest_index; | 578 int rest_index; |
| 571 if (scope->rest_parameter(&rest_index)) { | 579 if (scope->rest_parameter(&rest_index)) { |
| 572 DisableCrankshaft(kRestParameter); | 580 DisableCrankshaft(kRestParameter); |
| 573 } | 581 } |
| 574 | 582 |
| 583 if (FLAG_ignition && scope->NeedsContext() && scope->is_script_scope()) { | |
| 584 // Create ScopeInfo while on the main thread to avoid allocation during | |
| 585 // potentially concurrent bytecode generation. | |
| 586 node->scope()->GetScopeInfo(isolate_); | |
| 587 } | |
| 588 | |
| 575 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { | 589 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { |
| 576 // TODO(neis): We may want to allow Turbofan optimization here if | 590 // TODO(neis): We may want to allow Turbofan optimization here if |
| 577 // --turbo-from-bytecode is set and we know that Ignition is used. | 591 // --turbo-from-bytecode is set and we know that Ignition is used. |
| 578 // Unfortunately we can't express that here. | 592 // Unfortunately we can't express that here. |
| 579 DisableOptimization(kGenerator); | 593 DisableOptimization(kGenerator); |
| 580 } | 594 } |
| 581 | 595 |
| 582 VisitDeclarations(scope->declarations()); | 596 VisitDeclarations(scope->declarations()); |
| 583 VisitStatements(node->body()); | 597 VisitStatements(node->body()); |
| 584 | 598 |
| 585 node->set_ast_properties(&properties_); | 599 node->set_ast_properties(&properties_); |
| 586 node->set_dont_optimize_reason(dont_optimize_reason()); | 600 node->set_dont_optimize_reason(dont_optimize_reason()); |
| 587 node->set_yield_count(yield_count_); | 601 node->set_yield_count(yield_count_); |
| 588 return !HasStackOverflow(); | 602 return !HasStackOverflow(); |
| 589 } | 603 } |
| 590 | 604 |
| 591 | 605 |
| 592 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 606 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
| 593 FunctionLiteral* function) { | 607 FunctionLiteral* function) { |
| 594 AstNumberingVisitor visitor(isolate, zone); | 608 AstNumberingVisitor visitor(isolate, zone); |
| 595 return visitor.Renumber(function); | 609 return visitor.Renumber(function); |
| 596 } | 610 } |
| 597 } // namespace internal | 611 } // namespace internal |
| 598 } // namespace v8 | 612 } // namespace v8 |
| OLD | NEW |