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

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

Issue 2414003002: Move function length tracking from Scope to (Pre)?ParserFormalParameters. (Closed)
Patch Set: oops cont Created 4 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
« no previous file with comments | « src/ast/scopes.h ('k') | src/objects.cc » ('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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 asm_function_ = false; 264 asm_function_ = false;
265 force_eager_compilation_ = false; 265 force_eager_compilation_ = false;
266 has_arguments_parameter_ = false; 266 has_arguments_parameter_ = false;
267 scope_uses_super_property_ = false; 267 scope_uses_super_property_ = false;
268 has_rest_ = false; 268 has_rest_ = false;
269 receiver_ = nullptr; 269 receiver_ = nullptr;
270 new_target_ = nullptr; 270 new_target_ = nullptr;
271 function_ = nullptr; 271 function_ = nullptr;
272 arguments_ = nullptr; 272 arguments_ = nullptr;
273 this_function_ = nullptr; 273 this_function_ = nullptr;
274 arity_ = 0;
275 } 274 }
276 275
277 void Scope::SetDefaults() { 276 void Scope::SetDefaults() {
278 #ifdef DEBUG 277 #ifdef DEBUG
279 scope_name_ = nullptr; 278 scope_name_ = nullptr;
280 already_resolved_ = false; 279 already_resolved_ = false;
281 needs_migration_ = false; 280 needs_migration_ = false;
282 #endif 281 #endif
283 inner_scope_ = nullptr; 282 inner_scope_ = nullptr;
284 sibling_ = nullptr; 283 sibling_ = nullptr;
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 DCHECK(!is_optional || !is_rest); 832 DCHECK(!is_optional || !is_rest);
834 Variable* var; 833 Variable* var;
835 if (mode == TEMPORARY) { 834 if (mode == TEMPORARY) {
836 var = NewTemporary(name); 835 var = NewTemporary(name);
837 } else { 836 } else {
838 var = 837 var =
839 Declare(zone(), this, name, mode, NORMAL_VARIABLE, kCreatedInitialized); 838 Declare(zone(), this, name, mode, NORMAL_VARIABLE, kCreatedInitialized);
840 // TODO(wingo): Avoid O(n^2) check. 839 // TODO(wingo): Avoid O(n^2) check.
841 *is_duplicate = IsDeclaredParameter(name); 840 *is_duplicate = IsDeclaredParameter(name);
842 } 841 }
843 if (!is_optional && !is_rest && arity_ == params_.length()) {
844 ++arity_;
845 }
846 has_rest_ = is_rest; 842 has_rest_ = is_rest;
847 params_.Add(var, zone()); 843 params_.Add(var, zone());
848 if (name == ast_value_factory->arguments_string()) { 844 if (name == ast_value_factory->arguments_string()) {
849 has_arguments_parameter_ = true; 845 has_arguments_parameter_ = true;
850 } 846 }
851 return var; 847 return var;
852 } 848 }
853 849
854 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, 850 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
855 InitializationFlag init_flag, VariableKind kind, 851 InitializationFlag init_flag, VariableKind kind,
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 Variable* function = 1941 Variable* function =
1946 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1942 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1947 bool is_function_var_in_context = 1943 bool is_function_var_in_context =
1948 function != nullptr && function->IsContextSlot(); 1944 function != nullptr && function->IsContextSlot();
1949 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1945 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1950 (is_function_var_in_context ? 1 : 0); 1946 (is_function_var_in_context ? 1 : 0);
1951 } 1947 }
1952 1948
1953 } // namespace internal 1949 } // namespace internal
1954 } // namespace v8 1950 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698