Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: src/debug/debug-scopes.cc

Issue 2685543003: Revert of Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/parsing/parse-info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (scope_info->scope_type() == FUNCTION_SCOPE) { 80 if (scope_info->scope_type() == FUNCTION_SCOPE) {
81 nested_scope_chain_.Add(ExtendedScopeInfo(scope_info, 81 nested_scope_chain_.Add(ExtendedScopeInfo(scope_info,
82 shared_info->start_position(), 82 shared_info->start_position(),
83 shared_info->end_position())); 83 shared_info->end_position()));
84 } 84 }
85 if (!collect_non_locals) return; 85 if (!collect_non_locals) return;
86 } 86 }
87 87
88 // Reparse the code and analyze the scopes. 88 // Reparse the code and analyze the scopes.
89 // Check whether we are in global, eval or function code. 89 // Check whether we are in global, eval or function code.
90 Zone zone(isolate->allocator(), ZONE_NAME);
90 std::unique_ptr<ParseInfo> info; 91 std::unique_ptr<ParseInfo> info;
91 if (scope_info->scope_type() != FUNCTION_SCOPE) { 92 if (scope_info->scope_type() != FUNCTION_SCOPE) {
92 // Global or eval code. 93 // Global or eval code.
93 Handle<Script> script(Script::cast(shared_info->script())); 94 Handle<Script> script(Script::cast(shared_info->script()));
94 info.reset(new ParseInfo(script)); 95 info.reset(new ParseInfo(&zone, script));
95 if (scope_info->scope_type() == EVAL_SCOPE) { 96 if (scope_info->scope_type() == EVAL_SCOPE) {
96 info->set_eval(); 97 info->set_eval();
97 if (!function->context()->IsNativeContext()) { 98 if (!function->context()->IsNativeContext()) {
98 info->set_outer_scope_info(handle(function->context()->scope_info())); 99 info->set_outer_scope_info(handle(function->context()->scope_info()));
99 } 100 }
100 // Language mode may be inherited from the eval caller. 101 // Language mode may be inherited from the eval caller.
101 // Retrieve it from shared function info. 102 // Retrieve it from shared function info.
102 info->set_language_mode(shared_info->language_mode()); 103 info->set_language_mode(shared_info->language_mode());
103 } else if (scope_info->scope_type() == MODULE_SCOPE) { 104 } else if (scope_info->scope_type() == MODULE_SCOPE) {
104 info->set_module(); 105 info->set_module();
105 } else { 106 } else {
106 DCHECK(scope_info->scope_type() == SCRIPT_SCOPE); 107 DCHECK(scope_info->scope_type() == SCRIPT_SCOPE);
107 } 108 }
108 } else { 109 } else {
109 // Inner function. 110 // Inner function.
110 info.reset(new ParseInfo(shared_info)); 111 info.reset(new ParseInfo(&zone, shared_info));
111 } 112 }
112 if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get())) { 113 if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get())) {
113 DeclarationScope* scope = info->literal()->scope(); 114 DeclarationScope* scope = info->literal()->scope();
114 if (!ignore_nested_scopes || collect_non_locals) { 115 if (!ignore_nested_scopes || collect_non_locals) {
115 CollectNonLocals(info.get(), scope); 116 CollectNonLocals(info.get(), scope);
116 } 117 }
117 if (!ignore_nested_scopes) { 118 if (!ignore_nested_scopes) {
118 DeclarationScope::Analyze(info.get(), AnalyzeMode::kDebugger); 119 DeclarationScope::Analyze(info.get(), AnalyzeMode::kDebugger);
119 RetrieveScopeChain(scope); 120 RetrieveScopeChain(scope);
120 } 121 }
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); 857 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden());
857 if (beg_pos <= position && position < end_pos) { 858 if (beg_pos <= position && position < end_pos) {
858 GetNestedScopeChain(isolate, inner_scope, position); 859 GetNestedScopeChain(isolate, inner_scope, position);
859 return; 860 return;
860 } 861 }
861 } 862 }
862 } 863 }
863 864
864 } // namespace internal 865 } // namespace internal
865 } // namespace v8 866 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/parsing/parse-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698