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/scopes.h" | 7 #include "src/scopes.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 } | 1024 } |
1025 | 1025 |
1026 | 1026 |
1027 bool Scope::ResolveVariable(CompilationInfo* info, | 1027 bool Scope::ResolveVariable(CompilationInfo* info, |
1028 VariableProxy* proxy, | 1028 VariableProxy* proxy, |
1029 AstNodeFactory<AstNullVisitor>* factory) { | 1029 AstNodeFactory<AstNullVisitor>* factory) { |
1030 DCHECK(info->global_scope()->is_global_scope()); | 1030 DCHECK(info->global_scope()->is_global_scope()); |
1031 | 1031 |
1032 // If the proxy is already resolved there's nothing to do | 1032 // If the proxy is already resolved there's nothing to do |
1033 // (functions and consts may be resolved by the parser). | 1033 // (functions and consts may be resolved by the parser). |
1034 if (proxy->var() != NULL) return true; | 1034 if (proxy->is_resolved()) return true; |
1035 | 1035 |
1036 // Otherwise, try to resolve the variable. | 1036 // Otherwise, try to resolve the variable. |
1037 BindingKind binding_kind; | 1037 BindingKind binding_kind; |
1038 Variable* var = LookupRecursive(proxy, &binding_kind, factory); | 1038 Variable* var = LookupRecursive(proxy, &binding_kind, factory); |
1039 switch (binding_kind) { | 1039 switch (binding_kind) { |
1040 case BOUND: | 1040 case BOUND: |
1041 // We found a variable binding. | 1041 // We found a variable binding. |
1042 break; | 1042 break; |
1043 | 1043 |
1044 case BOUND_EVAL_SHADOWED: | 1044 case BOUND_EVAL_SHADOWED: |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 } | 1402 } |
1403 | 1403 |
1404 | 1404 |
1405 int Scope::ContextLocalCount() const { | 1405 int Scope::ContextLocalCount() const { |
1406 if (num_heap_slots() == 0) return 0; | 1406 if (num_heap_slots() == 0) return 0; |
1407 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1407 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1408 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1408 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1409 } | 1409 } |
1410 | 1410 |
1411 } } // namespace v8::internal | 1411 } } // namespace v8::internal |
OLD | NEW |