Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(927)

Side by Side Diff: src/scopes.cc

Issue 14416011: Fix yield inside with (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Add assertion Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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++;
730 // Catch scopes always have heap slots.
731 ASSERT(!s->is_catch_scope() || s->num_heap_slots() > 0);
730 } 732 }
731 return n; 733 return n;
732 } 734 }
733 735
734 736
735 Scope* Scope::GlobalScope() { 737 Scope* Scope::GlobalScope() {
736 Scope* scope = this; 738 Scope* scope = this;
737 while (!scope->is_global_scope()) { 739 while (!scope->is_global_scope()) {
738 scope = scope->outer_scope(); 740 scope = scope->outer_scope();
739 } 741 }
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 } 1392 }
1391 1393
1392 1394
1393 int Scope::ContextLocalCount() const { 1395 int Scope::ContextLocalCount() const {
1394 if (num_heap_slots() == 0) return 0; 1396 if (num_heap_slots() == 0) return 0;
1395 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1397 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1396 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1398 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1397 } 1399 }
1398 1400
1399 } } // namespace v8::internal 1401 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698