OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/debug/debug-scopes.h" | 5 #include "src/debug/debug-scopes.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } else { | 108 } else { |
109 // Inner function. | 109 // Inner function. |
110 info.reset(new ParseInfo(&zone, function)); | 110 info.reset(new ParseInfo(&zone, function)); |
111 } | 111 } |
112 if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) { | 112 if (Parser::ParseStatic(info.get()) && Rewriter::Rewrite(info.get())) { |
113 DeclarationScope* scope = info->literal()->scope(); | 113 DeclarationScope* scope = info->literal()->scope(); |
114 if (!ignore_nested_scopes || collect_non_locals) { | 114 if (!ignore_nested_scopes || collect_non_locals) { |
115 CollectNonLocals(info.get(), scope); | 115 CollectNonLocals(info.get(), scope); |
116 } | 116 } |
117 if (!ignore_nested_scopes) { | 117 if (!ignore_nested_scopes) { |
118 AstNodeFactory ast_node_factory(info.get()->ast_value_factory()); | 118 scope->AllocateVariables(info.get()); |
119 scope->AllocateVariables(info.get(), &ast_node_factory); | |
120 RetrieveScopeChain(scope); | 119 RetrieveScopeChain(scope); |
121 } | 120 } |
122 } else if (!ignore_nested_scopes) { | 121 } else if (!ignore_nested_scopes) { |
123 // A failed reparse indicates that the preparser has diverged from the | 122 // A failed reparse indicates that the preparser has diverged from the |
124 // parser or that the preparse data given to the initial parse has been | 123 // parser or that the preparse data given to the initial parse has been |
125 // faulty. We fail in debug mode but in release mode we only provide the | 124 // faulty. We fail in debug mode but in release mode we only provide the |
126 // information we get from the context chain but nothing about | 125 // information we get from the context chain but nothing about |
127 // completely stack allocated scopes or stack allocated locals. | 126 // completely stack allocated scopes or stack allocated locals. |
128 // Or it could be due to stack overflow. | 127 // Or it could be due to stack overflow. |
129 DCHECK(isolate_->has_pending_exception()); | 128 DCHECK(isolate_->has_pending_exception()); |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 831 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
833 if (beg_pos <= position && position < end_pos) { | 832 if (beg_pos <= position && position < end_pos) { |
834 GetNestedScopeChain(isolate, inner_scope, position); | 833 GetNestedScopeChain(isolate, inner_scope, position); |
835 return; | 834 return; |
836 } | 835 } |
837 } | 836 } |
838 } | 837 } |
839 | 838 |
840 } // namespace internal | 839 } // namespace internal |
841 } // namespace v8 | 840 } // namespace v8 |
OLD | NEW |