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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 asm_function_ = false; | 291 asm_function_ = false; |
292 force_eager_compilation_ = false; | 292 force_eager_compilation_ = false; |
293 has_arguments_parameter_ = false; | 293 has_arguments_parameter_ = false; |
294 scope_uses_super_property_ = false; | 294 scope_uses_super_property_ = false; |
295 has_rest_ = false; | 295 has_rest_ = false; |
296 receiver_ = nullptr; | 296 receiver_ = nullptr; |
297 new_target_ = nullptr; | 297 new_target_ = nullptr; |
298 function_ = nullptr; | 298 function_ = nullptr; |
299 arguments_ = nullptr; | 299 arguments_ = nullptr; |
300 this_function_ = nullptr; | 300 this_function_ = nullptr; |
| 301 generator_object_ = nullptr; |
| 302 promise_ = nullptr; |
301 should_eager_compile_ = false; | 303 should_eager_compile_ = false; |
302 was_lazily_parsed_ = false; | 304 was_lazily_parsed_ = false; |
303 #ifdef DEBUG | 305 #ifdef DEBUG |
304 DeclarationScope* outer_declaration_scope = | 306 DeclarationScope* outer_declaration_scope = |
305 outer_scope_ ? outer_scope_->GetDeclarationScope() : nullptr; | 307 outer_scope_ ? outer_scope_->GetDeclarationScope() : nullptr; |
306 is_being_lazily_parsed_ = | 308 is_being_lazily_parsed_ = |
307 outer_declaration_scope ? outer_declaration_scope->is_being_lazily_parsed_ | 309 outer_declaration_scope ? outer_declaration_scope->is_being_lazily_parsed_ |
308 : false; | 310 : false; |
309 #endif | 311 #endif |
310 } | 312 } |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 function_ = | 698 function_ = |
697 new (zone()) Variable(this, name, CONST, kind, kCreatedInitialized); | 699 new (zone()) Variable(this, name, CONST, kind, kCreatedInitialized); |
698 if (calls_sloppy_eval()) { | 700 if (calls_sloppy_eval()) { |
699 NonLocal(name, DYNAMIC); | 701 NonLocal(name, DYNAMIC); |
700 } else { | 702 } else { |
701 variables_.Add(zone(), function_); | 703 variables_.Add(zone(), function_); |
702 } | 704 } |
703 return function_; | 705 return function_; |
704 } | 706 } |
705 | 707 |
| 708 Variable* DeclarationScope::DeclareGeneratorObjectVar( |
| 709 const AstRawString* name) { |
| 710 DCHECK(is_function_scope() || is_module_scope()); |
| 711 DCHECK_NULL(generator_object_); |
| 712 generator_object_ = NewTemporary(name); |
| 713 return generator_object_; |
| 714 } |
| 715 |
| 716 Variable* DeclarationScope::DeclarePromiseVar(const AstRawString* name) { |
| 717 DCHECK(is_function_scope()); |
| 718 DCHECK_NULL(promise_); |
| 719 promise_ = NewTemporary(name); |
| 720 return promise_; |
| 721 } |
| 722 |
706 bool Scope::HasBeenRemoved() const { | 723 bool Scope::HasBeenRemoved() const { |
707 if (sibling() == this) { | 724 if (sibling() == this) { |
708 DCHECK_NULL(inner_scope_); | 725 DCHECK_NULL(inner_scope_); |
709 DCHECK(is_block_scope()); | 726 DCHECK(is_block_scope()); |
710 return true; | 727 return true; |
711 } | 728 } |
712 return false; | 729 return false; |
713 } | 730 } |
714 | 731 |
715 Scope* Scope::GetUnremovedScope() { | 732 Scope* Scope::GetUnremovedScope() { |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 Variable* function = | 2249 Variable* function = |
2233 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2250 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
2234 bool is_function_var_in_context = | 2251 bool is_function_var_in_context = |
2235 function != nullptr && function->IsContextSlot(); | 2252 function != nullptr && function->IsContextSlot(); |
2236 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2253 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
2237 (is_function_var_in_context ? 1 : 0); | 2254 (is_function_var_in_context ? 1 : 0); |
2238 } | 2255 } |
2239 | 2256 |
2240 } // namespace internal | 2257 } // namespace internal |
2241 } // namespace v8 | 2258 } // namespace v8 |
OLD | NEW |