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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { | 213 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { |
214 IncrementNodeCount(); | 214 IncrementNodeCount(); |
215 Visit(node->expression()); | 215 Visit(node->expression()); |
216 } | 216 } |
217 | 217 |
218 | 218 |
219 void AstNumberingVisitor::VisitYield(Yield* node) { | 219 void AstNumberingVisitor::VisitYield(Yield* node) { |
220 node->set_yield_id(yield_count_); | 220 node->set_yield_id(yield_count_); |
221 yield_count_++; | 221 yield_count_++; |
222 IncrementNodeCount(); | 222 IncrementNodeCount(); |
223 DisableOptimization(kYield); | |
224 ReserveFeedbackSlots(node); | 223 ReserveFeedbackSlots(node); |
225 node->set_base_id(ReserveIdRange(Yield::num_ids())); | 224 node->set_base_id(ReserveIdRange(Yield::num_ids())); |
226 Visit(node->generator_object()); | 225 Visit(node->generator_object()); |
227 Visit(node->expression()); | 226 Visit(node->expression()); |
228 } | 227 } |
229 | 228 |
230 | 229 |
231 void AstNumberingVisitor::VisitThrow(Throw* node) { | 230 void AstNumberingVisitor::VisitThrow(Throw* node) { |
232 IncrementNodeCount(); | 231 IncrementNodeCount(); |
233 node->set_base_id(ReserveIdRange(Throw::num_ids())); | 232 node->set_base_id(ReserveIdRange(Throw::num_ids())); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 572 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
574 DisableCrankshaft(kContextAllocatedArguments); | 573 DisableCrankshaft(kContextAllocatedArguments); |
575 } | 574 } |
576 | 575 |
577 int rest_index; | 576 int rest_index; |
578 if (scope->rest_parameter(&rest_index)) { | 577 if (scope->rest_parameter(&rest_index)) { |
579 DisableCrankshaft(kRestParameter); | 578 DisableCrankshaft(kRestParameter); |
580 } | 579 } |
581 | 580 |
582 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { | 581 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { |
| 582 // TODO(neis): We may want to allow Turbofan optimization here if |
| 583 // --turbo-from-bytecode is set and we know that Ignition is used. |
| 584 // Unfortunately we can't express that here. |
583 DisableOptimization(kGenerator); | 585 DisableOptimization(kGenerator); |
584 } | 586 } |
585 | 587 |
586 VisitDeclarations(scope->declarations()); | 588 VisitDeclarations(scope->declarations()); |
587 VisitStatements(node->body()); | 589 VisitStatements(node->body()); |
588 | 590 |
589 node->set_ast_properties(&properties_); | 591 node->set_ast_properties(&properties_); |
590 node->set_dont_optimize_reason(dont_optimize_reason()); | 592 node->set_dont_optimize_reason(dont_optimize_reason()); |
591 node->set_yield_count(yield_count_); | 593 node->set_yield_count(yield_count_); |
592 return !HasStackOverflow(); | 594 return !HasStackOverflow(); |
593 } | 595 } |
594 | 596 |
595 | 597 |
596 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 598 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
597 FunctionLiteral* function) { | 599 FunctionLiteral* function) { |
598 AstNumberingVisitor visitor(isolate, zone); | 600 AstNumberingVisitor visitor(isolate, zone); |
599 return visitor.Renumber(function); | 601 return visitor.Renumber(function); |
600 } | 602 } |
601 } // namespace internal | 603 } // namespace internal |
602 } // namespace v8 | 604 } // namespace v8 |
OLD | NEW |