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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Reparent inner scopes. | 366 // Reparent inner scopes. |
367 for (int i = 0; i < inner_scopes_.length(); i++) { | 367 for (int i = 0; i < inner_scopes_.length(); i++) { |
368 outer_scope()->AddInnerScope(inner_scopes_[i]); | 368 outer_scope()->AddInnerScope(inner_scopes_[i]); |
369 } | 369 } |
370 | 370 |
371 // Move unresolved variables | 371 // Move unresolved variables |
372 for (int i = 0; i < unresolved_.length(); i++) { | 372 for (int i = 0; i < unresolved_.length(); i++) { |
373 outer_scope()->unresolved_.Add(unresolved_[i], zone()); | 373 outer_scope()->unresolved_.Add(unresolved_[i], zone()); |
374 } | 374 } |
375 | 375 |
| 376 // Propagate usage flags to outer scope. |
| 377 if (uses_arguments()) outer_scope_->RecordArgumentsUsage(); |
| 378 if (uses_super()) outer_scope_->RecordSuperUsage(); |
| 379 if (uses_this()) outer_scope_->RecordThisUsage(); |
| 380 |
376 return NULL; | 381 return NULL; |
377 } | 382 } |
378 | 383 |
379 | 384 |
380 Variable* Scope::LookupLocal(const AstRawString* name) { | 385 Variable* Scope::LookupLocal(const AstRawString* name) { |
381 Variable* result = variables_.Lookup(name); | 386 Variable* result = variables_.Lookup(name); |
382 if (result != NULL || scope_info_.is_null()) { | 387 if (result != NULL || scope_info_.is_null()) { |
383 return result; | 388 return result; |
384 } | 389 } |
385 // The Scope is backed up by ScopeInfo. This means it cannot operate in a | 390 // The Scope is backed up by ScopeInfo. This means it cannot operate in a |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 } | 1435 } |
1431 | 1436 |
1432 | 1437 |
1433 int Scope::ContextLocalCount() const { | 1438 int Scope::ContextLocalCount() const { |
1434 if (num_heap_slots() == 0) return 0; | 1439 if (num_heap_slots() == 0) return 0; |
1435 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1440 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1436 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1441 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1437 } | 1442 } |
1438 | 1443 |
1439 } } // namespace v8::internal | 1444 } } // namespace v8::internal |
OLD | NEW |