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/frames-inl.h" | 10 #include "src/frames-inl.h" |
10 #include "src/frames.h" | 11 #include "src/frames.h" |
11 #include "src/ostreams.h" | 12 #include "src/ostreams.h" |
12 #include "src/splay-tree-inl.h" | 13 #include "src/splay-tree-inl.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, | 18 AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, |
18 DeclarationScope* scope, BailoutId osr_ast_id, | 19 DeclarationScope* scope, BailoutId osr_ast_id, |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 void AstTyper::VisitSuperPropertyReference(SuperPropertyReference* expr) {} | 765 void AstTyper::VisitSuperPropertyReference(SuperPropertyReference* expr) {} |
765 | 766 |
766 | 767 |
767 void AstTyper::VisitSuperCallReference(SuperCallReference* expr) {} | 768 void AstTyper::VisitSuperCallReference(SuperCallReference* expr) {} |
768 | 769 |
769 | 770 |
770 void AstTyper::VisitRewritableExpression(RewritableExpression* expr) { | 771 void AstTyper::VisitRewritableExpression(RewritableExpression* expr) { |
771 Visit(expr->expression()); | 772 Visit(expr->expression()); |
772 } | 773 } |
773 | 774 |
| 775 int AstTyper::variable_index(Variable* var) { |
| 776 // Stack locals have the range [0 .. l] |
| 777 // Parameters have the range [-1 .. p] |
| 778 // We map this to [-p-2 .. -1, 0 .. l] |
| 779 return var->IsStackLocal() |
| 780 ? stack_local_index(var->index()) |
| 781 : var->IsParameter() ? parameter_index(var->index()) : kNoVar; |
| 782 } |
774 | 783 |
775 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) { | 784 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) { |
776 for (int i = 0; i < decls->length(); ++i) { | 785 for (int i = 0; i < decls->length(); ++i) { |
777 Declaration* decl = decls->at(i); | 786 Declaration* decl = decls->at(i); |
778 RECURSE(Visit(decl)); | 787 RECURSE(Visit(decl)); |
779 } | 788 } |
780 } | 789 } |
781 | 790 |
782 | 791 |
783 void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) { | 792 void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) { |
784 } | 793 } |
785 | 794 |
786 | 795 |
787 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { | 796 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { |
788 RECURSE(Visit(declaration->fun())); | 797 RECURSE(Visit(declaration->fun())); |
789 } | 798 } |
790 | 799 |
791 | 800 |
792 } // namespace internal | 801 } // namespace internal |
793 } // namespace v8 | 802 } // namespace v8 |
OLD | NEW |