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