| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { | 279 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { |
| 280 IncrementNodeCount(); | 280 IncrementNodeCount(); |
| 281 DisableCaching(kModuleLiteral); | 281 DisableCaching(kModuleLiteral); |
| 282 VisitBlock(node->body()); | 282 VisitBlock(node->body()); |
| 283 } | 283 } |
| 284 | 284 |
| 285 | 285 |
| 286 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { | 286 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { |
| 287 IncrementNodeCount(); | 287 IncrementNodeCount(); |
| 288 ReserveFeedbackSlots(node); |
| 288 if (node->is_jsruntime()) { | 289 if (node->is_jsruntime()) { |
| 289 // Don't try to optimize JS runtime calls because we bailout on them. | 290 // Don't try to optimize JS runtime calls because we bailout on them. |
| 290 DisableCrankshaft(kCallToAJavaScriptRuntimeFunction); | 291 DisableCrankshaft(kCallToAJavaScriptRuntimeFunction); |
| 291 } | 292 } |
| 292 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); | 293 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); |
| 293 VisitArguments(node->arguments()); | 294 VisitArguments(node->arguments()); |
| 294 } | 295 } |
| 295 | 296 |
| 296 | 297 |
| 297 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { | 298 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 IncrementNodeCount(); | 529 IncrementNodeCount(); |
| 529 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); | 530 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); |
| 530 // We don't recurse into the declarations or body of the function literal: | 531 // We don't recurse into the declarations or body of the function literal: |
| 531 // you have to separately Renumber() each FunctionLiteral that you compile. | 532 // you have to separately Renumber() each FunctionLiteral that you compile. |
| 532 } | 533 } |
| 533 | 534 |
| 534 | 535 |
| 535 void AstNumberingVisitor::Renumber(FunctionLiteral* node) { | 536 void AstNumberingVisitor::Renumber(FunctionLiteral* node) { |
| 536 if (node->scope()->HasIllegalRedeclaration()) { | 537 if (node->scope()->HasIllegalRedeclaration()) { |
| 537 node->scope()->VisitIllegalRedeclaration(this); | 538 node->scope()->VisitIllegalRedeclaration(this); |
| 539 node->set_ast_properties(&properties_); |
| 538 return; | 540 return; |
| 539 } | 541 } |
| 540 | 542 |
| 541 Scope* scope = node->scope(); | 543 Scope* scope = node->scope(); |
| 542 VisitDeclarations(scope->declarations()); | 544 VisitDeclarations(scope->declarations()); |
| 543 if (scope->is_function_scope() && scope->function() != NULL) { | 545 if (scope->is_function_scope() && scope->function() != NULL) { |
| 544 // Visit the name of the named function expression. | 546 // Visit the name of the named function expression. |
| 545 Visit(scope->function()); | 547 Visit(scope->function()); |
| 546 } | 548 } |
| 547 VisitStatements(node->body()); | 549 VisitStatements(node->body()); |
| 548 | 550 |
| 549 node->set_ast_properties(&properties_); | 551 node->set_ast_properties(&properties_); |
| 550 node->set_dont_optimize_reason(dont_optimize_reason()); | 552 node->set_dont_optimize_reason(dont_optimize_reason()); |
| 551 } | 553 } |
| 552 | 554 |
| 553 | 555 |
| 554 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { | 556 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { |
| 555 AstNumberingVisitor visitor(zone); | 557 AstNumberingVisitor visitor(zone); |
| 556 visitor.Renumber(function); | 558 visitor.Renumber(function); |
| 557 return !visitor.HasStackOverflow(); | 559 return !visitor.HasStackOverflow(); |
| 558 } | 560 } |
| 559 } | 561 } |
| 560 } // namespace v8::internal | 562 } // namespace v8::internal |
| OLD | NEW |