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

Side by Side Diff: src/scopes.cc

Issue 1411723007: Remove --harmony-new-target flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 1 month 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/preparser.h ('k') | test/cctest/test-parsing.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/scopes.h" 5 #include "src/scopes.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/messages.h" 9 #include "src/messages.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 if (native ? FLAG_print_builtin_scopes : FLAG_print_scopes) scope->Print(); 318 if (native ? FLAG_print_builtin_scopes : FLAG_print_scopes) scope->Print();
319 #endif 319 #endif
320 320
321 info->set_scope(scope); 321 info->set_scope(scope);
322 return true; 322 return true;
323 } 323 }
324 324
325 325
326 void Scope::Initialize() { 326 void Scope::Initialize() {
327 bool subclass_constructor = IsSubclassConstructor(function_kind_);
328 DCHECK(!already_resolved()); 327 DCHECK(!already_resolved());
329 328
330 // Add this scope as a new inner scope of the outer scope. 329 // Add this scope as a new inner scope of the outer scope.
331 if (outer_scope_ != NULL) { 330 if (outer_scope_ != NULL) {
332 outer_scope_->inner_scopes_.Add(this, zone()); 331 outer_scope_->inner_scopes_.Add(this, zone());
333 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); 332 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope();
334 } else { 333 } else {
335 scope_inside_with_ = is_with_scope(); 334 scope_inside_with_ = is_with_scope();
336 } 335 }
337 336
338 // Declare convenience variables and the receiver. 337 // Declare convenience variables and the receiver.
339 if (is_declaration_scope() && has_this_declaration()) { 338 if (is_declaration_scope() && has_this_declaration()) {
339 bool subclass_constructor = IsSubclassConstructor(function_kind_);
340 Variable* var = variables_.Declare( 340 Variable* var = variables_.Declare(
341 this, ast_value_factory_->this_string(), 341 this, ast_value_factory_->this_string(),
342 subclass_constructor ? CONST : VAR, Variable::THIS, 342 subclass_constructor ? CONST : VAR, Variable::THIS,
343 subclass_constructor ? kNeedsInitialization : kCreatedInitialized); 343 subclass_constructor ? kNeedsInitialization : kCreatedInitialized);
344 receiver_ = var; 344 receiver_ = var;
345 } 345 }
346 346
347 if (is_function_scope() && !is_arrow_scope()) { 347 if (is_function_scope() && !is_arrow_scope()) {
348 // Declare 'arguments' variable which exists in all non arrow functions. 348 // Declare 'arguments' variable which exists in all non arrow functions.
349 // Note that it might never be accessed, in which case it won't be 349 // Note that it might never be accessed, in which case it won't be
350 // allocated during variable allocation. 350 // allocated during variable allocation.
351 variables_.Declare(this, ast_value_factory_->arguments_string(), VAR, 351 variables_.Declare(this, ast_value_factory_->arguments_string(), VAR,
352 Variable::ARGUMENTS, kCreatedInitialized); 352 Variable::ARGUMENTS, kCreatedInitialized);
353 353
354 if (subclass_constructor || FLAG_harmony_new_target) { 354 variables_.Declare(this, ast_value_factory_->new_target_string(), CONST,
355 variables_.Declare(this, ast_value_factory_->new_target_string(), CONST, 355 Variable::NORMAL, kCreatedInitialized);
356 Variable::NORMAL, kCreatedInitialized);
357 }
358 356
359 if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) || 357 if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) ||
360 IsAccessorFunction(function_kind_)) { 358 IsAccessorFunction(function_kind_)) {
361 variables_.Declare(this, ast_value_factory_->this_function_string(), 359 variables_.Declare(this, ast_value_factory_->this_function_string(),
362 CONST, Variable::NORMAL, kCreatedInitialized); 360 CONST, Variable::NORMAL, kCreatedInitialized);
363 } 361 }
364 } 362 }
365 } 363 }
366 364
367 365
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1650 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1653 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1651 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1654 (is_function_var_in_context ? 1 : 0); 1652 (is_function_var_in_context ? 1 : 0);
1655 } 1653 }
1656 1654
1657 1655
1658 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1656 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1659 1657
1660 } // namespace internal 1658 } // namespace internal
1661 } // namespace v8 1659 } // namespace v8
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698