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

Side by Side Diff: src/scopeinfo.cc

Issue 1386253002: Use Scope::function_kind_ to distinguish arrow function scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/scopeinfo.h" 5 #include "src/scopeinfo.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if (length() > 0) { 336 if (length() > 0) {
337 int context_locals = ContextLocalCount(); 337 int context_locals = ContextLocalCount();
338 int context_globals = ContextGlobalCount(); 338 int context_globals = ContextGlobalCount();
339 bool function_name_context_slot = 339 bool function_name_context_slot =
340 FunctionVariableField::decode(Flags()) == CONTEXT; 340 FunctionVariableField::decode(Flags()) == CONTEXT;
341 bool has_context = context_locals > 0 || context_globals > 0 || 341 bool has_context = context_locals > 0 || context_globals > 0 ||
342 function_name_context_slot || 342 function_name_context_slot ||
343 scope_type() == WITH_SCOPE || 343 scope_type() == WITH_SCOPE ||
344 (scope_type() == BLOCK_SCOPE && CallsSloppyEval() && 344 (scope_type() == BLOCK_SCOPE && CallsSloppyEval() &&
345 is_declaration_scope()) || 345 is_declaration_scope()) ||
346 (scope_type() == ARROW_SCOPE && CallsSloppyEval()) ||
347 (scope_type() == FUNCTION_SCOPE && CallsSloppyEval()) || 346 (scope_type() == FUNCTION_SCOPE && CallsSloppyEval()) ||
348 scope_type() == MODULE_SCOPE; 347 scope_type() == MODULE_SCOPE;
349 348
350 if (has_context) { 349 if (has_context) {
351 return Context::MIN_CONTEXT_SLOTS + context_locals + context_globals + 350 return Context::MIN_CONTEXT_SLOTS + context_locals + context_globals +
352 (function_name_context_slot ? 1 : 0); 351 (function_name_context_slot ? 1 : 0);
353 } 352 }
354 } 353 }
355 return 0; 354 return 0;
356 } 355 }
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 info->set_mode(i, var->mode()); 843 info->set_mode(i, var->mode());
845 DCHECK(var->index() >= 0); 844 DCHECK(var->index() >= 0);
846 info->set_index(i, var->index()); 845 info->set_index(i, var->index());
847 } 846 }
848 DCHECK(i == info->length()); 847 DCHECK(i == info->length());
849 return info; 848 return info;
850 } 849 }
851 850
852 } // namespace internal 851 } // namespace internal
853 } // namespace v8 852 } // namespace v8
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/scopes.h » ('j') | test/mjsunit/es6/regress/regress-4466.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698