| 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_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
| 6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/zone.h" | 9 #include "src/zone.h" |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Inform the scope that the corresponding code uses "arguments". | 210 // Inform the scope that the corresponding code uses "arguments". |
| 211 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } | 211 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } |
| 212 | 212 |
| 213 // Inform the scope that the corresponding code uses "super". | 213 // Inform the scope that the corresponding code uses "super". |
| 214 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } | 214 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } |
| 215 | 215 |
| 216 // Inform the scope that the corresponding code uses "this". | 216 // Inform the scope that the corresponding code uses "this". |
| 217 void RecordThisUsage() { scope_uses_this_ = true; } | 217 void RecordThisUsage() { scope_uses_this_ = true; } |
| 218 | 218 |
| 219 // Inform the scope that the corresponding code uses "new.target". |
| 220 void RecordNewTargetUsage() { scope_uses_new_target_ = true; } |
| 221 |
| 219 // Set the language mode flag (unless disabled by a global flag). | 222 // Set the language mode flag (unless disabled by a global flag). |
| 220 void SetLanguageMode(LanguageMode language_mode) { | 223 void SetLanguageMode(LanguageMode language_mode) { |
| 221 language_mode_ = language_mode; | 224 language_mode_ = language_mode; |
| 222 } | 225 } |
| 223 | 226 |
| 224 // Set the ASM module flag. | 227 // Set the ASM module flag. |
| 225 void SetAsmModule() { asm_module_ = true; } | 228 void SetAsmModule() { asm_module_ = true; } |
| 226 | 229 |
| 227 // Position in the source where this scope begins and ends. | 230 // Position in the source where this scope begins and ends. |
| 228 // | 231 // |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // Does this scope access "super" property (super.foo). | 312 // Does this scope access "super" property (super.foo). |
| 310 bool uses_super_property() const { return scope_uses_super_property_; } | 313 bool uses_super_property() const { return scope_uses_super_property_; } |
| 311 // Does any inner scope access "super" property. | 314 // Does any inner scope access "super" property. |
| 312 bool inner_uses_super_property() const { | 315 bool inner_uses_super_property() const { |
| 313 return inner_scope_uses_super_property_; | 316 return inner_scope_uses_super_property_; |
| 314 } | 317 } |
| 315 // Does this scope access "this". | 318 // Does this scope access "this". |
| 316 bool uses_this() const { return scope_uses_this_; } | 319 bool uses_this() const { return scope_uses_this_; } |
| 317 // Does any inner scope access "this". | 320 // Does any inner scope access "this". |
| 318 bool inner_uses_this() const { return inner_scope_uses_this_; } | 321 bool inner_uses_this() const { return inner_scope_uses_this_; } |
| 322 // Does this scope access "new.target". |
| 323 bool uses_new_target() const { return scope_uses_new_target_; } |
| 324 // Does any inner scope access "new.target". |
| 325 bool inner_uses_tnew_target() const { return inner_scope_uses_new_target_; } |
| 326 |
| 319 | 327 |
| 320 // --------------------------------------------------------------------------- | 328 // --------------------------------------------------------------------------- |
| 321 // Accessors. | 329 // Accessors. |
| 322 | 330 |
| 323 // The type of this scope. | 331 // The type of this scope. |
| 324 ScopeType scope_type() const { return scope_type_; } | 332 ScopeType scope_type() const { return scope_type_; } |
| 325 | 333 |
| 326 // The language mode of this scope. | 334 // The language mode of this scope. |
| 327 LanguageMode language_mode() const { return language_mode_; } | 335 LanguageMode language_mode() const { return language_mode_; } |
| 328 | 336 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 bool scope_contains_with_; | 540 bool scope_contains_with_; |
| 533 // This scope or a nested catch scope or with scope contain an 'eval' call. At | 541 // This scope or a nested catch scope or with scope contain an 'eval' call. At |
| 534 // the 'eval' call site this scope is the declaration scope. | 542 // the 'eval' call site this scope is the declaration scope. |
| 535 bool scope_calls_eval_; | 543 bool scope_calls_eval_; |
| 536 // This scope uses "arguments". | 544 // This scope uses "arguments". |
| 537 bool scope_uses_arguments_; | 545 bool scope_uses_arguments_; |
| 538 // This scope uses "super" property ('super.foo'). | 546 // This scope uses "super" property ('super.foo'). |
| 539 bool scope_uses_super_property_; | 547 bool scope_uses_super_property_; |
| 540 // This scope uses "this". | 548 // This scope uses "this". |
| 541 bool scope_uses_this_; | 549 bool scope_uses_this_; |
| 550 // This scope uses "new.target". |
| 551 bool scope_uses_new_target_; |
| 542 // This scope contains an "use asm" annotation. | 552 // This scope contains an "use asm" annotation. |
| 543 bool asm_module_; | 553 bool asm_module_; |
| 544 // This scope's outer context is an asm module. | 554 // This scope's outer context is an asm module. |
| 545 bool asm_function_; | 555 bool asm_function_; |
| 546 // The language mode of this scope. | 556 // The language mode of this scope. |
| 547 LanguageMode language_mode_; | 557 LanguageMode language_mode_; |
| 548 // Source positions. | 558 // Source positions. |
| 549 int start_position_; | 559 int start_position_; |
| 550 int end_position_; | 560 int end_position_; |
| 551 | 561 |
| 552 // Computed via PropagateScopeInfo. | 562 // Computed via PropagateScopeInfo. |
| 553 bool outer_scope_calls_sloppy_eval_; | 563 bool outer_scope_calls_sloppy_eval_; |
| 554 bool inner_scope_calls_eval_; | 564 bool inner_scope_calls_eval_; |
| 555 bool inner_scope_uses_arguments_; | 565 bool inner_scope_uses_arguments_; |
| 556 bool inner_scope_uses_super_property_; | 566 bool inner_scope_uses_super_property_; |
| 557 bool inner_scope_uses_this_; | 567 bool inner_scope_uses_this_; |
| 568 bool inner_scope_uses_new_target_; |
| 558 bool force_eager_compilation_; | 569 bool force_eager_compilation_; |
| 559 bool force_context_allocation_; | 570 bool force_context_allocation_; |
| 560 | 571 |
| 561 // True if it doesn't need scope resolution (e.g., if the scope was | 572 // True if it doesn't need scope resolution (e.g., if the scope was |
| 562 // constructed based on a serialized scope info or a catch context). | 573 // constructed based on a serialized scope info or a catch context). |
| 563 bool already_resolved_; | 574 bool already_resolved_; |
| 564 | 575 |
| 565 // Computed as variables are declared. | 576 // Computed as variables are declared. |
| 566 int num_var_or_const_; | 577 int num_var_or_const_; |
| 567 | 578 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 Scope* outer_scope, | 705 Scope* outer_scope, |
| 695 Handle<ScopeInfo> scope_info); | 706 Handle<ScopeInfo> scope_info); |
| 696 | 707 |
| 697 AstValueFactory* ast_value_factory_; | 708 AstValueFactory* ast_value_factory_; |
| 698 Zone* zone_; | 709 Zone* zone_; |
| 699 }; | 710 }; |
| 700 | 711 |
| 701 } } // namespace v8::internal | 712 } } // namespace v8::internal |
| 702 | 713 |
| 703 #endif // V8_SCOPES_H_ | 714 #endif // V8_SCOPES_H_ |
| OLD | NEW |