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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Traverse the scope tree up to the first unresolved scope or the global | 261 // Traverse the scope tree up to the first unresolved scope or the global |
262 // scope and start scope resolution and variable allocation from that scope. | 262 // scope and start scope resolution and variable allocation from that scope. |
263 while (!top->is_global_scope() && | 263 while (!top->is_global_scope() && |
264 !top->outer_scope()->already_resolved()) { | 264 !top->outer_scope()->already_resolved()) { |
265 top = top->outer_scope(); | 265 top = top->outer_scope(); |
266 } | 266 } |
267 | 267 |
268 // Allocate the variables. | 268 // Allocate the variables. |
269 { | 269 { |
270 // Passing NULL as AstValueFactory is ok, because AllocateVariables doesn't | 270 AstNodeFactory<AstNullVisitor> ast_node_factory( |
271 // need to create new strings or values. | 271 info->zone(), info->ast_value_factory(), info->ast_node_id_gen()); |
272 AstNodeFactory<AstNullVisitor> ast_node_factory(info->zone(), NULL); | |
273 if (!top->AllocateVariables(info, &ast_node_factory)) return false; | 272 if (!top->AllocateVariables(info, &ast_node_factory)) return false; |
274 } | 273 } |
275 | 274 |
276 #ifdef DEBUG | 275 #ifdef DEBUG |
277 if (info->isolate()->bootstrapper()->IsActive() | 276 if (info->isolate()->bootstrapper()->IsActive() |
278 ? FLAG_print_builtin_scopes | 277 ? FLAG_print_builtin_scopes |
279 : FLAG_print_scopes) { | 278 : FLAG_print_scopes) { |
280 scope->Print(); | 279 scope->Print(); |
281 } | 280 } |
282 | 281 |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 } | 1393 } |
1395 | 1394 |
1396 | 1395 |
1397 int Scope::ContextLocalCount() const { | 1396 int Scope::ContextLocalCount() const { |
1398 if (num_heap_slots() == 0) return 0; | 1397 if (num_heap_slots() == 0) return 0; |
1399 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1398 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1400 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1399 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1401 } | 1400 } |
1402 | 1401 |
1403 } } // namespace v8::internal | 1402 } } // namespace v8::internal |
OLD | NEW |