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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) { | 541 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) { |
542 DCHECK(is_script_scope()); | 542 DCHECK(is_script_scope()); |
543 return variables_.Declare(this, | 543 return variables_.Declare(this, |
544 name, | 544 name, |
545 DYNAMIC_GLOBAL, | 545 DYNAMIC_GLOBAL, |
546 Variable::NORMAL, | 546 Variable::NORMAL, |
547 kCreatedInitialized); | 547 kCreatedInitialized); |
548 } | 548 } |
549 | 549 |
550 | 550 |
551 bool Scope::RemoveUnresolved(VariableProxy* var) { | 551 void Scope::RemoveUnresolved(VariableProxy* var) { |
552 // Most likely (always?) any variable we want to remove | 552 // Most likely (always?) any variable we want to remove |
553 // was just added before, so we search backwards. | 553 // was just added before, so we search backwards. |
554 for (int i = unresolved_.length(); i-- > 0;) { | 554 for (int i = unresolved_.length(); i-- > 0;) { |
555 if (unresolved_[i] == var) { | 555 if (unresolved_[i] == var) { |
556 unresolved_.Remove(i); | 556 unresolved_.Remove(i); |
557 return true; | 557 return; |
558 } | 558 } |
559 } | 559 } |
560 return false; | |
561 } | 560 } |
562 | 561 |
563 | 562 |
564 Variable* Scope::NewTemporary(const AstRawString* name) { | 563 Variable* Scope::NewTemporary(const AstRawString* name) { |
565 DCHECK(!already_resolved()); | 564 DCHECK(!already_resolved()); |
566 Scope* scope = this->ClosureScope(); | 565 Scope* scope = this->ClosureScope(); |
567 Variable* var = new(zone()) Variable(scope, | 566 Variable* var = new(zone()) Variable(scope, |
568 name, | 567 name, |
569 TEMPORARY, | 568 TEMPORARY, |
570 Variable::NORMAL, | 569 Variable::NORMAL, |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1658 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1660 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1659 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1661 (is_function_var_in_context ? 1 : 0); | 1660 (is_function_var_in_context ? 1 : 0); |
1662 } | 1661 } |
1663 | 1662 |
1664 | 1663 |
1665 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1664 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1666 | 1665 |
1667 } // namespace internal | 1666 } // namespace internal |
1668 } // namespace v8 | 1667 } // namespace v8 |
OLD | NEW |