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

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

Issue 1537683002: Partial revert of rest parameter desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures. Created 4 years, 12 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/bailout-reason.h » ('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 "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/scopeinfo.h" 8 #include "src/ast/scopeinfo.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 force_eager_compilation_ = false; 198 force_eager_compilation_ = false;
199 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) 199 force_context_allocation_ = (outer_scope != NULL && !is_function_scope())
200 ? outer_scope->has_forced_context_allocation() : false; 200 ? outer_scope->has_forced_context_allocation() : false;
201 num_var_or_const_ = 0; 201 num_var_or_const_ = 0;
202 num_stack_slots_ = 0; 202 num_stack_slots_ = 0;
203 num_heap_slots_ = 0; 203 num_heap_slots_ = 0;
204 num_global_slots_ = 0; 204 num_global_slots_ = 0;
205 arity_ = 0; 205 arity_ = 0;
206 has_simple_parameters_ = true; 206 has_simple_parameters_ = true;
207 rest_parameter_ = NULL; 207 rest_parameter_ = NULL;
208 rest_index_ = -1;
208 scope_info_ = scope_info; 209 scope_info_ = scope_info;
209 start_position_ = RelocInfo::kNoPosition; 210 start_position_ = RelocInfo::kNoPosition;
210 end_position_ = RelocInfo::kNoPosition; 211 end_position_ = RelocInfo::kNoPosition;
211 if (!scope_info.is_null()) { 212 if (!scope_info.is_null()) {
212 scope_calls_eval_ = scope_info->CallsEval(); 213 scope_calls_eval_ = scope_info->CallsEval();
213 language_mode_ = scope_info->language_mode(); 214 language_mode_ = scope_info->language_mode();
214 is_declaration_scope_ = scope_info->is_declaration_scope(); 215 is_declaration_scope_ = scope_info->is_declaration_scope();
215 function_kind_ = scope_info->function_kind(); 216 function_kind_ = scope_info->function_kind();
216 } 217 }
217 } 218 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 kCreatedInitialized); 515 kCreatedInitialized);
515 // TODO(wingo): Avoid O(n^2) check. 516 // TODO(wingo): Avoid O(n^2) check.
516 *is_duplicate = IsDeclaredParameter(name); 517 *is_duplicate = IsDeclaredParameter(name);
517 } 518 }
518 if (!is_optional && !is_rest && arity_ == params_.length()) { 519 if (!is_optional && !is_rest && arity_ == params_.length()) {
519 ++arity_; 520 ++arity_;
520 } 521 }
521 if (is_rest) { 522 if (is_rest) {
522 DCHECK_NULL(rest_parameter_); 523 DCHECK_NULL(rest_parameter_);
523 rest_parameter_ = var; 524 rest_parameter_ = var;
525 rest_index_ = num_parameters();
524 } 526 }
525 params_.Add(var, zone()); 527 params_.Add(var, zone());
526 return var; 528 return var;
527 } 529 }
528 530
529 531
530 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, 532 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
531 InitializationFlag init_flag, Variable::Kind kind, 533 InitializationFlag init_flag, Variable::Kind kind,
532 MaybeAssignedFlag maybe_assigned_flag, 534 MaybeAssignedFlag maybe_assigned_flag,
533 int declaration_group_start) { 535 int declaration_group_start) {
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1676 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1675 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1677 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1676 (is_function_var_in_context ? 1 : 0); 1678 (is_function_var_in_context ? 1 : 0);
1677 } 1679 }
1678 1680
1679 1681
1680 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1682 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1681 1683
1682 } // namespace internal 1684 } // namespace internal
1683 } // namespace v8 1685 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/bailout-reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698