| 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/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Scope* top_inner_scope_; | 107 Scope* top_inner_scope_; |
| 108 VariableProxy* top_unresolved_; | 108 VariableProxy* top_unresolved_; |
| 109 int top_temp_; | 109 int top_temp_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // Compute top scope and allocate variables. For lazy compilation the top | 112 // Compute top scope and allocate variables. For lazy compilation the top |
| 113 // scope only contains the single lazily compiled function, so this | 113 // scope only contains the single lazily compiled function, so this |
| 114 // doesn't re-allocate variables repeatedly. | 114 // doesn't re-allocate variables repeatedly. |
| 115 static bool Analyze(ParseInfo* info); | 115 static bool Analyze(ParseInfo* info); |
| 116 | 116 |
| 117 enum class DeserializationMode { kDeserializeOffHeap, kKeepScopeInfo }; |
| 118 |
| 117 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, | 119 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, |
| 118 Context* context, Scope* script_scope, | 120 Context* context, Scope* script_scope, |
| 119 AstValueFactory* ast_value_factory); | 121 AstValueFactory* ast_value_factory, |
| 122 DeserializationMode deserialization_mode); |
| 120 | 123 |
| 121 // The scope name is only used for printing/debugging. | 124 // The scope name is only used for printing/debugging. |
| 122 void SetScopeName(const AstRawString* scope_name) { | 125 void SetScopeName(const AstRawString* scope_name) { |
| 123 scope_name_ = scope_name; | 126 scope_name_ = scope_name; |
| 124 } | 127 } |
| 125 | 128 |
| 126 void DeclareThis(AstValueFactory* ast_value_factory); | 129 void DeclareThis(AstValueFactory* ast_value_factory); |
| 127 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); | 130 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); |
| 128 | 131 |
| 129 // Checks if the block scope is redundant, i.e. it does not contain any | 132 // Checks if the block scope is redundant, i.e. it does not contain any |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 scope = scope->sibling_) { | 847 scope = scope->sibling_) { |
| 845 if (scope->sibling_ == inner_scope) { | 848 if (scope->sibling_ == inner_scope) { |
| 846 scope->sibling_ = scope->sibling_->sibling_; | 849 scope->sibling_ = scope->sibling_->sibling_; |
| 847 return; | 850 return; |
| 848 } | 851 } |
| 849 } | 852 } |
| 850 } | 853 } |
| 851 | 854 |
| 852 void SetDefaults(); | 855 void SetDefaults(); |
| 853 | 856 |
| 857 void DeserializeScopeInfo(Isolate* isolate, |
| 858 AstValueFactory* ast_value_factory); |
| 859 |
| 854 PendingCompilationErrorHandler pending_error_handler_; | 860 PendingCompilationErrorHandler pending_error_handler_; |
| 855 }; | 861 }; |
| 856 | 862 |
| 857 } // namespace internal | 863 } // namespace internal |
| 858 } // namespace v8 | 864 } // namespace v8 |
| 859 | 865 |
| 860 #endif // V8_AST_SCOPES_H_ | 866 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |