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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (scope->HasIllegalRedeclaration()) { | 552 if (scope->HasIllegalRedeclaration()) { |
553 scope->VisitIllegalRedeclaration(this); | 553 scope->VisitIllegalRedeclaration(this); |
554 DisableCrankshaft(kFunctionWithIllegalRedeclaration); | 554 DisableCrankshaft(kFunctionWithIllegalRedeclaration); |
555 return Finish(node); | 555 return Finish(node); |
556 } | 556 } |
557 if (scope->calls_eval()) DisableCrankshaft(kFunctionCallsEval); | 557 if (scope->calls_eval()) DisableCrankshaft(kFunctionCallsEval); |
558 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 558 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
559 DisableCrankshaft(kContextAllocatedArguments); | 559 DisableCrankshaft(kContextAllocatedArguments); |
560 } | 560 } |
561 | 561 |
| 562 // TODO(aperez): Add support in Crankshaft for arrow functions (issue #3814). |
| 563 if (scope->is_arrow_scope() && scope->uses_this()) { |
| 564 DisableCrankshaft(kCapturedThis); |
| 565 } |
| 566 if (scope->is_function_scope() && scope->inner_uses_this()) { |
| 567 DisableCrankshaft(kCapturedThis); |
| 568 } |
| 569 |
562 VisitDeclarations(scope->declarations()); | 570 VisitDeclarations(scope->declarations()); |
563 if (scope->is_function_scope() && scope->function() != NULL) { | 571 if (scope->is_function_scope() && scope->function() != NULL) { |
564 // Visit the name of the named function expression. | 572 // Visit the name of the named function expression. |
565 Visit(scope->function()); | 573 Visit(scope->function()); |
566 } | 574 } |
567 VisitStatements(node->body()); | 575 VisitStatements(node->body()); |
568 | 576 |
569 return Finish(node); | 577 return Finish(node); |
570 } | 578 } |
571 | 579 |
572 | 580 |
573 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { | 581 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { |
574 AstNumberingVisitor visitor(zone); | 582 AstNumberingVisitor visitor(zone); |
575 return visitor.Renumber(function); | 583 return visitor.Renumber(function); |
576 } | 584 } |
577 } | 585 } |
578 } // namespace v8::internal | 586 } // namespace v8::internal |
OLD | NEW |