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/scopes.h" | 9 #include "src/scopes.h" |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) { | 161 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) { |
162 IncrementNodeCount(); | 162 IncrementNodeCount(); |
163 node->set_base_id(ReserveIdRange(ThisFunction::num_ids())); | 163 node->set_base_id(ReserveIdRange(ThisFunction::num_ids())); |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { | 167 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { |
168 IncrementNodeCount(); | 168 IncrementNodeCount(); |
169 DisableOptimization(kSuperReference); | 169 DisableOptimization(kSuperReference); |
170 ReserveFeedbackSlots(node); | |
171 node->set_base_id(ReserveIdRange(SuperReference::num_ids())); | |
172 Visit(node->this_var()); | 170 Visit(node->this_var()); |
| 171 Visit(node->home_object_var()); |
173 } | 172 } |
174 | 173 |
175 | 174 |
176 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { | 175 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { |
177 IncrementNodeCount(); | 176 IncrementNodeCount(); |
178 DisableOptimization(kImportDeclaration); | 177 DisableOptimization(kImportDeclaration); |
179 VisitVariableProxy(node->proxy()); | 178 VisitVariableProxy(node->proxy()); |
180 } | 179 } |
181 | 180 |
182 | 181 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 if (scope->HasIllegalRedeclaration()) { | 505 if (scope->HasIllegalRedeclaration()) { |
507 scope->VisitIllegalRedeclaration(this); | 506 scope->VisitIllegalRedeclaration(this); |
508 DisableOptimization(kFunctionWithIllegalRedeclaration); | 507 DisableOptimization(kFunctionWithIllegalRedeclaration); |
509 return Finish(node); | 508 return Finish(node); |
510 } | 509 } |
511 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); | 510 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
512 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 511 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
513 DisableOptimization(kContextAllocatedArguments); | 512 DisableOptimization(kContextAllocatedArguments); |
514 } | 513 } |
515 | 514 |
| 515 ReserveFeedbackSlots(node); |
| 516 |
516 VisitDeclarations(scope->declarations()); | 517 VisitDeclarations(scope->declarations()); |
517 if (scope->is_function_scope() && scope->function() != NULL) { | 518 if (scope->is_function_scope() && scope->function() != NULL) { |
518 // Visit the name of the named function expression. | 519 // Visit the name of the named function expression. |
519 Visit(scope->function()); | 520 Visit(scope->function()); |
520 } | 521 } |
521 VisitStatements(node->body()); | 522 VisitStatements(node->body()); |
522 | 523 |
523 return Finish(node); | 524 return Finish(node); |
524 } | 525 } |
525 | 526 |
526 | 527 |
527 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 528 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
528 FunctionLiteral* function) { | 529 FunctionLiteral* function) { |
529 AstNumberingVisitor visitor(isolate, zone); | 530 AstNumberingVisitor visitor(isolate, zone); |
530 return visitor.Renumber(function); | 531 return visitor.Renumber(function); |
531 } | 532 } |
532 } | 533 } |
533 } // namespace v8::internal | 534 } // namespace v8::internal |
OLD | NEW |