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

Side by Side Diff: src/ast/scopes.cc

Issue 2536153002: [scopes] Propagate inner-scope-calls-eval to make sure we context allocate in inserted scopes (Closed)
Patch Set: Created 4 years 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/ast/scopes.h ('k') | test/mjsunit/regress/regress-5664.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 // 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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 outer->AddInnerScope(this); 788 outer->AddInnerScope(this);
789 outer_scope_ = outer; 789 outer_scope_ = outer;
790 } 790 }
791 791
792 792
793 void Scope::PropagateUsageFlagsToScope(Scope* other) { 793 void Scope::PropagateUsageFlagsToScope(Scope* other) {
794 DCHECK_NOT_NULL(other); 794 DCHECK_NOT_NULL(other);
795 DCHECK(!already_resolved_); 795 DCHECK(!already_resolved_);
796 DCHECK(!other->already_resolved_); 796 DCHECK(!other->already_resolved_);
797 if (calls_eval()) other->RecordEvalCall(); 797 if (calls_eval()) other->RecordEvalCall();
798 if (inner_scope_calls_eval_) other->inner_scope_calls_eval_ = true;
798 } 799 }
799 800
800 Variable* Scope::LookupInScopeInfo(const AstRawString* name) { 801 Variable* Scope::LookupInScopeInfo(const AstRawString* name) {
801 Handle<String> name_handle = name->string(); 802 Handle<String> name_handle = name->string();
802 // The Scope is backed up by ScopeInfo. This means it cannot operate in a 803 // The Scope is backed up by ScopeInfo. This means it cannot operate in a
803 // heap-independent mode, and all strings must be internalized immediately. So 804 // heap-independent mode, and all strings must be internalized immediately. So
804 // it's ok to get the Handle<String> here. 805 // it's ok to get the Handle<String> here.
805 // If we have a serialized scope info, we might find the variable there. 806 // If we have a serialized scope info, we might find the variable there.
806 // There should be no local slot with the given name. 807 // There should be no local slot with the given name.
807 DCHECK_LT(scope_info_->StackSlotIndex(*name_handle), 0); 808 DCHECK_LT(scope_info_->StackSlotIndex(*name_handle), 0);
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 Variable* function = 2072 Variable* function =
2072 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2073 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2073 bool is_function_var_in_context = 2074 bool is_function_var_in_context =
2074 function != nullptr && function->IsContextSlot(); 2075 function != nullptr && function->IsContextSlot();
2075 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2076 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2076 (is_function_var_in_context ? 1 : 0); 2077 (is_function_var_in_context ? 1 : 0);
2077 } 2078 }
2078 2079
2079 } // namespace internal 2080 } // namespace internal
2080 } // namespace v8 2081 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | test/mjsunit/regress/regress-5664.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698