OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 if (scope_info_.is_null()) { | 654 if (scope_info_.is_null()) { |
655 scope_info_ = ScopeInfo::Create(this); | 655 scope_info_ = ScopeInfo::Create(this); |
656 } | 656 } |
657 return scope_info_; | 657 return scope_info_; |
658 } | 658 } |
659 | 659 |
660 | 660 |
661 void Scope::GetNestedScopeChain( | 661 void Scope::GetNestedScopeChain( |
662 List<Handle<ScopeInfo> >* chain, | 662 List<Handle<ScopeInfo> >* chain, |
663 int position) { | 663 int position) { |
664 chain->Add(Handle<ScopeInfo>(GetScopeInfo())); | 664 if (!is_eval_scope()) chain->Add(Handle<ScopeInfo>(GetScopeInfo())); |
665 | 665 |
666 for (int i = 0; i < inner_scopes_.length(); i++) { | 666 for (int i = 0; i < inner_scopes_.length(); i++) { |
667 Scope* scope = inner_scopes_[i]; | 667 Scope* scope = inner_scopes_[i]; |
668 int beg_pos = scope->start_position(); | 668 int beg_pos = scope->start_position(); |
669 int end_pos = scope->end_position(); | 669 int end_pos = scope->end_position(); |
670 ASSERT(beg_pos >= 0 && end_pos >= 0); | 670 ASSERT(beg_pos >= 0 && end_pos >= 0); |
671 if (beg_pos <= position && position <= end_pos) { | 671 if (beg_pos <= position && position < end_pos) { |
672 scope->GetNestedScopeChain(chain, position); | 672 scope->GetNestedScopeChain(chain, position); |
673 return; | 673 return; |
674 } | 674 } |
675 } | 675 } |
676 } | 676 } |
677 | 677 |
678 | 678 |
679 #ifdef DEBUG | 679 #ifdef DEBUG |
680 static const char* Header(ScopeType type) { | 680 static const char* Header(ScopeType type) { |
681 switch (type) { | 681 switch (type) { |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 } | 1189 } |
1190 | 1190 |
1191 | 1191 |
1192 int Scope::ContextLocalCount() const { | 1192 int Scope::ContextLocalCount() const { |
1193 if (num_heap_slots() == 0) return 0; | 1193 if (num_heap_slots() == 0) return 0; |
1194 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1194 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1195 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); | 1195 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); |
1196 } | 1196 } |
1197 | 1197 |
1198 } } // namespace v8::internal | 1198 } } // namespace v8::internal |
OLD | NEW |