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

Side by Side Diff: src/scopes.cc

Issue 1360403002: Revert of [es6] Introduce spec compliant IsConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/scopes.h ('k') | src/x64/builtins-x64.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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // Note that it might never be accessed, in which case it won't be 350 // Note that it might never be accessed, in which case it won't be
351 // allocated during variable allocation. 351 // allocated during variable allocation.
352 variables_.Declare(this, ast_value_factory_->arguments_string(), VAR, 352 variables_.Declare(this, ast_value_factory_->arguments_string(), VAR,
353 Variable::ARGUMENTS, kCreatedInitialized); 353 Variable::ARGUMENTS, kCreatedInitialized);
354 354
355 if (subclass_constructor || FLAG_harmony_new_target) { 355 if (subclass_constructor || FLAG_harmony_new_target) {
356 variables_.Declare(this, ast_value_factory_->new_target_string(), CONST, 356 variables_.Declare(this, ast_value_factory_->new_target_string(), CONST,
357 Variable::NORMAL, kCreatedInitialized); 357 Variable::NORMAL, kCreatedInitialized);
358 } 358 }
359 359
360 if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) || 360 if (IsConciseMethod(function_kind_) || IsConstructor(function_kind_) ||
361 IsAccessorFunction(function_kind_)) { 361 IsAccessorFunction(function_kind_)) {
362 variables_.Declare(this, ast_value_factory_->this_function_string(), 362 variables_.Declare(this, ast_value_factory_->this_function_string(),
363 CONST, Variable::NORMAL, kCreatedInitialized); 363 CONST, Variable::NORMAL, kCreatedInitialized);
364 } 364 }
365 } 365 }
366 } 366 }
367 367
368 368
369 Scope* Scope::FinalizeBlockScope() { 369 Scope* Scope::FinalizeBlockScope() {
370 DCHECK(is_block_scope()); 370 DCHECK(is_block_scope());
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 } 1278 }
1279 1279
1280 1280
1281 ClassVariable* Scope::ClassVariableForMethod() const { 1281 ClassVariable* Scope::ClassVariableForMethod() const {
1282 // TODO(marja, rossberg): This fails to find a class variable in the following 1282 // TODO(marja, rossberg): This fails to find a class variable in the following
1283 // cases: 1283 // cases:
1284 // let A = class { ... } 1284 // let A = class { ... }
1285 // It needs to be investigated whether this causes any practical problems. 1285 // It needs to be investigated whether this causes any practical problems.
1286 if (!is_function_scope()) return nullptr; 1286 if (!is_function_scope()) return nullptr;
1287 if (IsInObjectLiteral(function_kind_)) return nullptr; 1287 if (IsInObjectLiteral(function_kind_)) return nullptr;
1288 if (!IsConciseMethod(function_kind_) && !IsClassConstructor(function_kind_) && 1288 if (!IsConciseMethod(function_kind_) && !IsConstructor(function_kind_) &&
1289 !IsAccessorFunction(function_kind_)) { 1289 !IsAccessorFunction(function_kind_)) {
1290 return nullptr; 1290 return nullptr;
1291 } 1291 }
1292 DCHECK_NOT_NULL(outer_scope_); 1292 DCHECK_NOT_NULL(outer_scope_);
1293 // The class scope contains at most one variable, the class name. 1293 // The class scope contains at most one variable, the class name.
1294 DCHECK(outer_scope_->variables_.occupancy() <= 1); 1294 DCHECK(outer_scope_->variables_.occupancy() <= 1);
1295 if (outer_scope_->variables_.occupancy() == 0) return nullptr; 1295 if (outer_scope_->variables_.occupancy() == 0) return nullptr;
1296 VariableMap::Entry* p = outer_scope_->variables_.Start(); 1296 VariableMap::Entry* p = outer_scope_->variables_.Start();
1297 Variable* var = reinterpret_cast<Variable*>(p->value); 1297 Variable* var = reinterpret_cast<Variable*>(p->value);
1298 if (!var->is_class()) return nullptr; 1298 if (!var->is_class()) return nullptr;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1649 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1650 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1650 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1651 (is_function_var_in_context ? 1 : 0); 1651 (is_function_var_in_context ? 1 : 0);
1652 } 1652 }
1653 1653
1654 1654
1655 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1655 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1656 1656
1657 } // namespace internal 1657 } // namespace internal
1658 } // namespace v8 1658 } // namespace v8
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698