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 && | |
jochen (gone - plz use gerrit)
2016/08/29 09:15:48
no longer needed, as we always allocate the ScopeI
| |
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 | |
244 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); | 236 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); |
245 VisitStatements(node->statements()); | 237 VisitStatements(node->statements()); |
246 } | 238 } |
247 | 239 |
248 | 240 |
249 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { | 241 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { |
250 IncrementNodeCount(); | 242 IncrementNodeCount(); |
251 VisitVariableProxy(node->proxy()); | 243 VisitVariableProxy(node->proxy()); |
252 VisitFunctionLiteral(node->fun()); | 244 VisitFunctionLiteral(node->fun()); |
253 } | 245 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); | 564 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); |
573 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); | 565 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
574 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 566 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
575 DisableCrankshaft(kContextAllocatedArguments); | 567 DisableCrankshaft(kContextAllocatedArguments); |
576 } | 568 } |
577 | 569 |
578 if (scope->rest_parameter() != nullptr) { | 570 if (scope->rest_parameter() != nullptr) { |
579 DisableCrankshaft(kRestParameter); | 571 DisableCrankshaft(kRestParameter); |
580 } | 572 } |
581 | 573 |
582 if (FLAG_ignition && scope->NeedsContext() && scope->is_script_scope()) { | |
583 // Create ScopeInfo while on the main thread to avoid allocation during | |
584 // potentially concurrent bytecode generation. | |
585 node->scope()->GetScopeInfo(isolate_); | |
586 } | |
587 | |
588 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { | 574 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { |
589 // TODO(neis): We may want to allow Turbofan optimization here if | 575 // TODO(neis): We may want to allow Turbofan optimization here if |
590 // --turbo-from-bytecode is set and we know that Ignition is used. | 576 // --turbo-from-bytecode is set and we know that Ignition is used. |
591 // Unfortunately we can't express that here. | 577 // Unfortunately we can't express that here. |
592 DisableOptimization(kGenerator); | 578 DisableOptimization(kGenerator); |
593 } | 579 } |
594 | 580 |
595 VisitDeclarations(scope->declarations()); | 581 VisitDeclarations(scope->declarations()); |
596 VisitStatements(node->body()); | 582 VisitStatements(node->body()); |
597 | 583 |
598 node->set_ast_properties(&properties_); | 584 node->set_ast_properties(&properties_); |
599 node->set_dont_optimize_reason(dont_optimize_reason()); | 585 node->set_dont_optimize_reason(dont_optimize_reason()); |
600 node->set_yield_count(yield_count_); | 586 node->set_yield_count(yield_count_); |
601 return !HasStackOverflow(); | 587 return !HasStackOverflow(); |
602 } | 588 } |
603 | 589 |
604 | 590 |
605 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 591 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
606 FunctionLiteral* function) { | 592 FunctionLiteral* function) { |
607 AstNumberingVisitor visitor(isolate, zone); | 593 AstNumberingVisitor visitor(isolate, zone); |
608 return visitor.Renumber(function); | 594 return visitor.Renumber(function); |
609 } | 595 } |
610 } // namespace internal | 596 } // namespace internal |
611 } // namespace v8 | 597 } // namespace v8 |
OLD | NEW |