| OLD | NEW |
| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/scopes.h" | 7 #include "src/scopes.h" |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // Declare convenience variables. | 302 // Declare convenience variables. |
| 303 // Declare and allocate receiver (even for the script scope, and even | 303 // Declare and allocate receiver (even for the script scope, and even |
| 304 // if naccesses_ == 0). | 304 // if naccesses_ == 0). |
| 305 // NOTE: When loading parameters in the script scope, we must take | 305 // NOTE: When loading parameters in the script scope, we must take |
| 306 // care not to access them as properties of the global object, but | 306 // care not to access them as properties of the global object, but |
| 307 // instead load them directly from the stack. Currently, the only | 307 // instead load them directly from the stack. Currently, the only |
| 308 // such parameter is 'this' which is passed on the stack when | 308 // such parameter is 'this' which is passed on the stack when |
| 309 // invoking scripts | 309 // invoking scripts |
| 310 if (is_declaration_scope()) { | 310 if (is_declaration_scope()) { |
| 311 DCHECK(!subclass_constructor || is_function_scope()); | 311 DCHECK(!subclass_constructor || is_function_scope()); |
| 312 DCHECK(FLAG_experimental_classes || !subclass_constructor); | |
| 313 Variable* var = variables_.Declare( | 312 Variable* var = variables_.Declare( |
| 314 this, ast_value_factory_->this_string(), | 313 this, ast_value_factory_->this_string(), |
| 315 subclass_constructor ? CONST : VAR, false, Variable::THIS, | 314 subclass_constructor ? CONST : VAR, false, Variable::THIS, |
| 316 subclass_constructor ? kNeedsInitialization : kCreatedInitialized); | 315 subclass_constructor ? kNeedsInitialization : kCreatedInitialized); |
| 317 var->AllocateTo(Variable::PARAMETER, -1); | 316 var->AllocateTo(Variable::PARAMETER, -1); |
| 318 receiver_ = var; | 317 receiver_ = var; |
| 319 | 318 |
| 320 if (subclass_constructor) { | 319 if (subclass_constructor) { |
| 321 new_target_ = variables_.Declare( | 320 new_target_ = variables_.Declare( |
| 322 this, ast_value_factory_->new_target_string(), CONST, false, | 321 this, ast_value_factory_->new_target_string(), CONST, false, |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 } | 1438 } |
| 1440 | 1439 |
| 1441 | 1440 |
| 1442 int Scope::ContextLocalCount() const { | 1441 int Scope::ContextLocalCount() const { |
| 1443 if (num_heap_slots() == 0) return 0; | 1442 if (num_heap_slots() == 0) return 0; |
| 1444 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1443 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
| 1445 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1444 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
| 1446 } | 1445 } |
| 1447 | 1446 |
| 1448 } } // namespace v8::internal | 1447 } } // namespace v8::internal |
| OLD | NEW |