| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 // Traverse the scope tree up to the first unresolved scope or the global | 269 // Traverse the scope tree up to the first unresolved scope or the global |
| 270 // scope and start scope resolution and variable allocation from that scope. | 270 // scope and start scope resolution and variable allocation from that scope. |
| 271 while (!top->is_global_scope() && | 271 while (!top->is_global_scope() && |
| 272 !top->outer_scope()->already_resolved()) { | 272 !top->outer_scope()->already_resolved()) { |
| 273 top = top->outer_scope(); | 273 top = top->outer_scope(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // Allocate the variables. | 276 // Allocate the variables. |
| 277 { | 277 { |
| 278 AstNodeFactory<AstNullVisitor> ast_node_factory( | 278 AstNodeFactory<AstNullVisitor> ast_node_factory(info->ast_value_factory()); |
| 279 info->zone(), info->ast_value_factory(), info->ast_node_id_gen()); | |
| 280 if (!top->AllocateVariables(info, &ast_node_factory)) return false; | 279 if (!top->AllocateVariables(info, &ast_node_factory)) return false; |
| 281 } | 280 } |
| 282 | 281 |
| 283 #ifdef DEBUG | 282 #ifdef DEBUG |
| 284 if (info->isolate()->bootstrapper()->IsActive() | 283 if (info->isolate()->bootstrapper()->IsActive() |
| 285 ? FLAG_print_builtin_scopes | 284 ? FLAG_print_builtin_scopes |
| 286 : FLAG_print_scopes) { | 285 : FLAG_print_scopes) { |
| 287 scope->Print(); | 286 scope->Print(); |
| 288 } | 287 } |
| 289 | 288 |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 } | 1423 } |
| 1425 | 1424 |
| 1426 | 1425 |
| 1427 int Scope::ContextLocalCount() const { | 1426 int Scope::ContextLocalCount() const { |
| 1428 if (num_heap_slots() == 0) return 0; | 1427 if (num_heap_slots() == 0) return 0; |
| 1429 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1428 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
| 1430 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1429 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
| 1431 } | 1430 } |
| 1432 | 1431 |
| 1433 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
| OLD | NEW |