OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/typing.h" | 5 #include "src/crankshaft/typing.h" |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/ast/variables.h" | 9 #include "src/ast/variables.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 774 |
775 int AstTyper::variable_index(Variable* var) { | 775 int AstTyper::variable_index(Variable* var) { |
776 // Stack locals have the range [0 .. l] | 776 // Stack locals have the range [0 .. l] |
777 // Parameters have the range [-1 .. p] | 777 // Parameters have the range [-1 .. p] |
778 // We map this to [-p-2 .. -1, 0 .. l] | 778 // We map this to [-p-2 .. -1, 0 .. l] |
779 return var->IsStackLocal() | 779 return var->IsStackLocal() |
780 ? stack_local_index(var->index()) | 780 ? stack_local_index(var->index()) |
781 : var->IsParameter() ? parameter_index(var->index()) : kNoVar; | 781 : var->IsParameter() ? parameter_index(var->index()) : kNoVar; |
782 } | 782 } |
783 | 783 |
784 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) { | 784 void AstTyper::VisitDeclarations(Declaration::List* decls) { |
785 for (int i = 0; i < decls->length(); ++i) { | 785 for (Declaration* decl : *decls) { |
786 Declaration* decl = decls->at(i); | |
787 RECURSE(Visit(decl)); | 786 RECURSE(Visit(decl)); |
788 } | 787 } |
789 } | 788 } |
790 | 789 |
791 | 790 |
792 void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) { | 791 void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) { |
793 } | 792 } |
794 | 793 |
795 | 794 |
796 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { | 795 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { |
797 RECURSE(Visit(declaration->fun())); | 796 RECURSE(Visit(declaration->fun())); |
798 } | 797 } |
799 | 798 |
800 | 799 |
801 } // namespace internal | 800 } // namespace internal |
802 } // namespace v8 | 801 } // namespace v8 |
OLD | NEW |