| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 bool scope_calls_eval_; | 464 bool scope_calls_eval_; |
| 465 // The strict mode of this scope. | 465 // The strict mode of this scope. |
| 466 StrictMode strict_mode_; | 466 StrictMode strict_mode_; |
| 467 // Source positions. | 467 // Source positions. |
| 468 int start_position_; | 468 int start_position_; |
| 469 int end_position_; | 469 int end_position_; |
| 470 | 470 |
| 471 // Computed via PropagateScopeInfo. | 471 // Computed via PropagateScopeInfo. |
| 472 bool outer_scope_calls_sloppy_eval_; | 472 bool outer_scope_calls_sloppy_eval_; |
| 473 bool inner_scope_calls_eval_; | 473 bool inner_scope_calls_eval_; |
| 474 bool inner_scope_contains_with_; |
| 474 bool force_eager_compilation_; | 475 bool force_eager_compilation_; |
| 475 bool force_context_allocation_; | 476 bool force_context_allocation_; |
| 476 | 477 |
| 477 // True if it doesn't need scope resolution (e.g., if the scope was | 478 // True if it doesn't need scope resolution (e.g., if the scope was |
| 478 // constructed based on a serialized scope info or a catch context). | 479 // constructed based on a serialized scope info or a catch context). |
| 479 bool already_resolved_; | 480 bool already_resolved_; |
| 480 | 481 |
| 481 // Computed as variables are declared. | 482 // Computed as variables are declared. |
| 482 int num_var_or_const_; | 483 int num_var_or_const_; |
| 483 | 484 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 // The variable potentially references a property of the 'with' object. | 542 // The variable potentially references a property of the 'with' object. |
| 542 // * The code is being executed as part of a call to 'eval' and the calling | 543 // * The code is being executed as part of a call to 'eval' and the calling |
| 543 // context chain contains either a variable binding for the name or it | 544 // context chain contains either a variable binding for the name or it |
| 544 // contains a 'with' context. | 545 // contains a 'with' context. |
| 545 DYNAMIC_LOOKUP | 546 DYNAMIC_LOOKUP |
| 546 }; | 547 }; |
| 547 | 548 |
| 548 // Lookup a variable reference given by name recursively starting with this | 549 // Lookup a variable reference given by name recursively starting with this |
| 549 // scope. If the code is executed because of a call to 'eval', the context | 550 // scope. If the code is executed because of a call to 'eval', the context |
| 550 // parameter should be set to the calling context of 'eval'. | 551 // parameter should be set to the calling context of 'eval'. |
| 551 Variable* LookupRecursive(Handle<String> name, | 552 Variable* LookupRecursive(VariableProxy* proxy, |
| 552 BindingKind* binding_kind, | 553 BindingKind* binding_kind, |
| 553 AstNodeFactory<AstNullVisitor>* factory); | 554 AstNodeFactory<AstNullVisitor>* factory); |
| 554 MUST_USE_RESULT | 555 MUST_USE_RESULT |
| 555 bool ResolveVariable(CompilationInfo* info, | 556 bool ResolveVariable(CompilationInfo* info, |
| 556 VariableProxy* proxy, | 557 VariableProxy* proxy, |
| 557 AstNodeFactory<AstNullVisitor>* factory); | 558 AstNodeFactory<AstNullVisitor>* factory); |
| 558 MUST_USE_RESULT | 559 MUST_USE_RESULT |
| 559 bool ResolveVariablesRecursively(CompilationInfo* info, | 560 bool ResolveVariablesRecursively(CompilationInfo* info, |
| 560 AstNodeFactory<AstNullVisitor>* factory); | 561 AstNodeFactory<AstNullVisitor>* factory); |
| 561 | 562 |
| 562 // Scope analysis. | 563 // Scope analysis. |
| 563 bool PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); | 564 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); |
| 564 bool HasTrivialContext() const; | 565 bool HasTrivialContext() const; |
| 565 | 566 |
| 566 // Predicates. | 567 // Predicates. |
| 567 bool MustAllocate(Variable* var); | 568 bool MustAllocate(Variable* var); |
| 568 bool MustAllocateInContext(Variable* var); | 569 bool MustAllocateInContext(Variable* var); |
| 569 bool HasArgumentsParameter(); | 570 bool HasArgumentsParameter(); |
| 570 | 571 |
| 571 // Variable allocation. | 572 // Variable allocation. |
| 572 void AllocateStackSlot(Variable* var); | 573 void AllocateStackSlot(Variable* var); |
| 573 void AllocateHeapSlot(Variable* var); | 574 void AllocateHeapSlot(Variable* var); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 void SetDefaults(ScopeType type, | 608 void SetDefaults(ScopeType type, |
| 608 Scope* outer_scope, | 609 Scope* outer_scope, |
| 609 Handle<ScopeInfo> scope_info); | 610 Handle<ScopeInfo> scope_info); |
| 610 | 611 |
| 611 Zone* zone_; | 612 Zone* zone_; |
| 612 }; | 613 }; |
| 613 | 614 |
| 614 } } // namespace v8::internal | 615 } } // namespace v8::internal |
| 615 | 616 |
| 616 #endif // V8_SCOPES_H_ | 617 #endif // V8_SCOPES_H_ |
| OLD | NEW |