Chromium Code Reviews| 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/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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 for (Scope* scope = this; | 459 for (Scope* scope = this; |
| 460 scope != NULL; | 460 scope != NULL; |
| 461 scope = scope->outer_scope()) { | 461 scope = scope->outer_scope()) { |
| 462 Variable* var = scope->LookupLocal(name); | 462 Variable* var = scope->LookupLocal(name); |
| 463 if (var != NULL) return var; | 463 if (var != NULL) return var; |
| 464 } | 464 } |
| 465 return NULL; | 465 return NULL; |
| 466 } | 466 } |
| 467 | 467 |
| 468 | 468 |
| 469 Variable* Scope::DeclareParameter( | 469 Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode, |
|
Benedikt Meurer
2015/08/27 04:34:51
And this one.
gdeepti
2015/08/27 18:49:17
Done.
| |
| 470 const AstRawString* name, VariableMode mode, | 470 bool is_optional, bool is_rest, |
| 471 bool is_optional, bool is_rest, bool* is_duplicate) { | 471 bool* is_duplicate) { |
| 472 DCHECK(!already_resolved()); | 472 DCHECK(!already_resolved()); |
| 473 DCHECK(is_function_scope()); | 473 DCHECK(is_function_scope()); |
| 474 DCHECK(!is_optional || !is_rest); | 474 DCHECK(!is_optional || !is_rest); |
| 475 Variable* var; | 475 Variable* var; |
| 476 if (mode == TEMPORARY) { | 476 if (mode == TEMPORARY) { |
| 477 var = NewTemporary(name); | 477 var = NewTemporary(name); |
| 478 } else { | 478 } else { |
| 479 var = variables_.Declare(this, name, mode, Variable::NORMAL, | 479 var = variables_.Declare(this, name, mode, Variable::NORMAL, |
| 480 kCreatedInitialized); | 480 kCreatedInitialized); |
| 481 // TODO(wingo): Avoid O(n^2) check. | 481 // TODO(wingo): Avoid O(n^2) check. |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1620 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1620 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
| 1621 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1621 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
| 1622 (is_function_var_in_context ? 1 : 0); | 1622 (is_function_var_in_context ? 1 : 0); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 | 1625 |
| 1626 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1626 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
| 1627 | 1627 |
| 1628 } // namespace internal | 1628 } // namespace internal |
| 1629 } // namespace v8 | 1629 } // namespace v8 |
| OLD | NEW |