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 } | |
326 | 333 |
neis
2017/05/24 10:39:37
I don't like the fact that has_forced_context_allo
Jarin
2017/05/24 12:32:21
Not sure. Adam, do you think it is a good idea?
adamk
2017/05/24 13:04:00
I think an enum is fine if Georg finds this confus
| |
327 // --------------------------------------------------------------------------- | 334 // --------------------------------------------------------------------------- |
328 // Predicates. | 335 // Predicates. |
329 | 336 |
330 // Specific scope types. | 337 // Specific scope types. |
331 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } | 338 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } |
332 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } | 339 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; } |
333 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } | 340 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } |
334 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } | 341 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } |
335 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } | 342 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } |
336 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } | 343 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 bool scope_calls_eval_ : 1; | 574 bool scope_calls_eval_ : 1; |
568 // This scope's declarations might not be executed in order (e.g., switch). | 575 // This scope's declarations might not be executed in order (e.g., switch). |
569 bool scope_nonlinear_ : 1; | 576 bool scope_nonlinear_ : 1; |
570 bool is_hidden_ : 1; | 577 bool is_hidden_ : 1; |
571 // Temporary workaround that allows masking of 'this' in debug-evalute scopes. | 578 // Temporary workaround that allows masking of 'this' in debug-evalute scopes. |
572 bool is_debug_evaluate_scope_ : 1; | 579 bool is_debug_evaluate_scope_ : 1; |
573 | 580 |
574 // True if one of the inner scopes or the scope itself calls eval. | 581 // True if one of the inner scopes or the scope itself calls eval. |
575 bool inner_scope_calls_eval_ : 1; | 582 bool inner_scope_calls_eval_ : 1; |
576 bool force_context_allocation_ : 1; | 583 bool force_context_allocation_ : 1; |
584 bool force_context_allocation_for_parameters_ : 1; | |
577 | 585 |
578 // True if it holds 'var' declarations. | 586 // True if it holds 'var' declarations. |
579 bool is_declaration_scope_ : 1; | 587 bool is_declaration_scope_ : 1; |
580 | 588 |
581 bool must_use_preparsed_scope_data_ : 1; | 589 bool must_use_preparsed_scope_data_ : 1; |
582 | 590 |
583 // Create a non-local variable with a given name. | 591 // Create a non-local variable with a given name. |
584 // These variables are looked up dynamically at runtime. | 592 // These variables are looked up dynamically at runtime. |
585 Variable* NonLocal(const AstRawString* name, VariableMode mode); | 593 Variable* NonLocal(const AstRawString* name, VariableMode mode); |
586 | 594 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 void AllocateModuleVariables(); | 1016 void AllocateModuleVariables(); |
1009 | 1017 |
1010 private: | 1018 private: |
1011 ModuleDescriptor* module_descriptor_; | 1019 ModuleDescriptor* module_descriptor_; |
1012 }; | 1020 }; |
1013 | 1021 |
1014 } // namespace internal | 1022 } // namespace internal |
1015 } // namespace v8 | 1023 } // namespace v8 |
1016 | 1024 |
1017 #endif // V8_AST_SCOPES_H_ | 1025 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |