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

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

Issue 2898163002: Make non-Module generators only context allocate parameters. (Closed)
Patch Set: Fix comment Created 3 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
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 set_language_mode(SLOPPY); 342 set_language_mode(SLOPPY);
343 343
344 scope_calls_eval_ = false; 344 scope_calls_eval_ = false;
345 scope_nonlinear_ = false; 345 scope_nonlinear_ = false;
346 is_hidden_ = false; 346 is_hidden_ = false;
347 is_debug_evaluate_scope_ = false; 347 is_debug_evaluate_scope_ = false;
348 348
349 inner_scope_calls_eval_ = false; 349 inner_scope_calls_eval_ = false;
350 force_context_allocation_ = false; 350 force_context_allocation_ = false;
351 force_context_allocation_for_parameters_ = false;
351 352
352 is_declaration_scope_ = false; 353 is_declaration_scope_ = false;
353 354
354 must_use_preparsed_scope_data_ = false; 355 must_use_preparsed_scope_data_ = false;
355 } 356 }
356 357
357 bool Scope::HasSimpleParameters() { 358 bool Scope::HasSimpleParameters() {
358 DeclarationScope* scope = GetClosureScope(); 359 DeclarationScope* scope = GetClosureScope();
359 return !scope->is_function_scope() || scope->has_simple_parameters(); 360 return !scope->is_function_scope() || scope->has_simple_parameters();
360 } 361 }
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 var->set_is_used(); 2187 var->set_is_used();
2187 var->set_maybe_assigned(); 2188 var->set_maybe_assigned();
2188 var->ForceContextAllocation(); 2189 var->ForceContextAllocation();
2189 } 2190 }
2190 AllocateParameter(var, i); 2191 AllocateParameter(var, i);
2191 } 2192 }
2192 } 2193 }
2193 2194
2194 void DeclarationScope::AllocateParameter(Variable* var, int index) { 2195 void DeclarationScope::AllocateParameter(Variable* var, int index) {
2195 if (MustAllocate(var)) { 2196 if (MustAllocate(var)) {
2196 if (MustAllocateInContext(var)) { 2197 if (has_forced_context_allocation_for_parameters() ||
2198 MustAllocateInContext(var)) {
neis 2017/05/24 10:39:36 This should be moved into MustAllocateInContext(va
Jarin 2017/05/24 12:32:21 I do not know this code well enough to say whether
adamk 2017/05/24 13:04:00 Indeed the problem is that MustAllocateInContext d
2197 DCHECK(var->IsUnallocated() || var->IsContextSlot()); 2199 DCHECK(var->IsUnallocated() || var->IsContextSlot());
2198 if (var->IsUnallocated()) { 2200 if (var->IsUnallocated()) {
2199 AllocateHeapSlot(var); 2201 AllocateHeapSlot(var);
2200 } 2202 }
2201 } else { 2203 } else {
2202 DCHECK(var->IsUnallocated() || var->IsParameter()); 2204 DCHECK(var->IsUnallocated() || var->IsParameter());
2203 if (var->IsUnallocated()) { 2205 if (var->IsUnallocated()) {
2204 var->AllocateTo(VariableLocation::PARAMETER, index); 2206 var->AllocateTo(VariableLocation::PARAMETER, index);
2205 } 2207 }
2206 } 2208 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 Variable* function = 2364 Variable* function =
2363 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2365 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2364 bool is_function_var_in_context = 2366 bool is_function_var_in_context =
2365 function != nullptr && function->IsContextSlot(); 2367 function != nullptr && function->IsContextSlot();
2366 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2368 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2367 (is_function_var_in_context ? 1 : 0); 2369 (is_function_var_in_context ? 1 : 0);
2368 } 2370 }
2369 2371
2370 } // namespace internal 2372 } // namespace internal
2371 } // namespace v8 2373 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698