| 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 #ifndef V8_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
| 6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
| 9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void set_is_hidden() { is_hidden_ = true; } | 316 void set_is_hidden() { is_hidden_ = true; } |
| 317 | 317 |
| 318 // In some cases we want to force context allocation for a whole scope. | 318 // In some cases we want to force context allocation for a whole scope. |
| 319 void ForceContextAllocation() { | 319 void ForceContextAllocation() { |
| 320 DCHECK(!already_resolved_); | 320 DCHECK(!already_resolved_); |
| 321 force_context_allocation_ = true; | 321 force_context_allocation_ = true; |
| 322 } | 322 } |
| 323 bool has_forced_context_allocation() const { | 323 bool has_forced_context_allocation() const { |
| 324 return force_context_allocation_; | 324 return force_context_allocation_; |
| 325 } | 325 } |
| 326 void ForceContextAllocationForParameters() { | |
| 327 DCHECK(!already_resolved_); | |
| 328 force_context_allocation_for_parameters_ = true; | |
| 329 } | |
| 330 bool has_forced_context_allocation_for_parameters() const { | |
| 331 return force_context_allocation_for_parameters_; | |
| 332 } | |
| 333 | 326 |
| 334 // --------------------------------------------------------------------------- | 327 // --------------------------------------------------------------------------- |
| 335 // Predicates. | 328 // Predicates. |
| 336 | 329 |
| 337 // Specific scope types. | 330 // Specific scope types. |
| 338 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } | 331 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } |
| 339 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } | 332 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } |
| 340 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } | 333 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } |
| 341 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } | 334 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } |
| 342 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } | 335 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 bool scope_calls_eval_ : 1; | 567 bool scope_calls_eval_ : 1; |
| 575 // This scope's declarations might not be executed in order (e.g., switch). | 568 // This scope's declarations might not be executed in order (e.g., switch). |
| 576 bool scope_nonlinear_ : 1; | 569 bool scope_nonlinear_ : 1; |
| 577 bool is_hidden_ : 1; | 570 bool is_hidden_ : 1; |
| 578 // Temporary workaround that allows masking of 'this' in debug-evalute scopes. | 571 // Temporary workaround that allows masking of 'this' in debug-evalute scopes. |
| 579 bool is_debug_evaluate_scope_ : 1; | 572 bool is_debug_evaluate_scope_ : 1; |
| 580 | 573 |
| 581 // True if one of the inner scopes or the scope itself calls eval. | 574 // True if one of the inner scopes or the scope itself calls eval. |
| 582 bool inner_scope_calls_eval_ : 1; | 575 bool inner_scope_calls_eval_ : 1; |
| 583 bool force_context_allocation_ : 1; | 576 bool force_context_allocation_ : 1; |
| 584 bool force_context_allocation_for_parameters_ : 1; | |
| 585 | 577 |
| 586 // True if it holds 'var' declarations. | 578 // True if it holds 'var' declarations. |
| 587 bool is_declaration_scope_ : 1; | 579 bool is_declaration_scope_ : 1; |
| 588 | 580 |
| 589 bool must_use_preparsed_scope_data_ : 1; | 581 bool must_use_preparsed_scope_data_ : 1; |
| 590 | 582 |
| 591 // Create a non-local variable with a given name. | 583 // Create a non-local variable with a given name. |
| 592 // These variables are looked up dynamically at runtime. | 584 // These variables are looked up dynamically at runtime. |
| 593 Variable* NonLocal(const AstRawString* name, VariableMode mode); | 585 Variable* NonLocal(const AstRawString* name, VariableMode mode); |
| 594 | 586 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 void AllocateModuleVariables(); | 1008 void AllocateModuleVariables(); |
| 1017 | 1009 |
| 1018 private: | 1010 private: |
| 1019 ModuleDescriptor* module_descriptor_; | 1011 ModuleDescriptor* module_descriptor_; |
| 1020 }; | 1012 }; |
| 1021 | 1013 |
| 1022 } // namespace internal | 1014 } // namespace internal |
| 1023 } // namespace v8 | 1015 } // namespace v8 |
| 1024 | 1016 |
| 1025 #endif // V8_AST_SCOPES_H_ | 1017 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |