OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 | 719 |
720 bool Scope::AllowsLazyCompilationWithoutContext() const { | 720 bool Scope::AllowsLazyCompilationWithoutContext() const { |
721 return !force_eager_compilation_ && HasTrivialOuterContext(); | 721 return !force_eager_compilation_ && HasTrivialOuterContext(); |
722 } | 722 } |
723 | 723 |
724 | 724 |
725 int Scope::ContextChainLength(Scope* scope) { | 725 int Scope::ContextChainLength(Scope* scope) { |
726 int n = 0; | 726 int n = 0; |
727 for (Scope* s = this; s != scope; s = s->outer_scope_) { | 727 for (Scope* s = this; s != scope; s = s->outer_scope_) { |
728 ASSERT(s != NULL); // scope must be in the scope chain | 728 ASSERT(s != NULL); // scope must be in the scope chain |
729 if (s->num_heap_slots() > 0) n++; | 729 if (s->is_with_scope() || s->num_heap_slots() > 0) n++; |
Michael Starzinger
2013/04/26 11:31:10
As discussed offline: It is confusing that we don'
| |
730 } | 730 } |
731 return n; | 731 return n; |
732 } | 732 } |
733 | 733 |
734 | 734 |
735 Scope* Scope::GlobalScope() { | 735 Scope* Scope::GlobalScope() { |
736 Scope* scope = this; | 736 Scope* scope = this; |
737 while (!scope->is_global_scope()) { | 737 while (!scope->is_global_scope()) { |
738 scope = scope->outer_scope(); | 738 scope = scope->outer_scope(); |
739 } | 739 } |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1390 } | 1390 } |
1391 | 1391 |
1392 | 1392 |
1393 int Scope::ContextLocalCount() const { | 1393 int Scope::ContextLocalCount() const { |
1394 if (num_heap_slots() == 0) return 0; | 1394 if (num_heap_slots() == 0) return 0; |
1395 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1395 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1396 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1396 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1397 } | 1397 } |
1398 | 1398 |
1399 } } // namespace v8::internal | 1399 } } // namespace v8::internal |
OLD | NEW |