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

Side by Side Diff: src/ast/scopes.cc

Issue 2721633004: [inspector] fixed crash on attempt to access empty scope_info on break (Closed)
Patch Set: better test Created 3 years, 9 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 | « no previous file | test/inspector/debugger/step-into-arrow.js » ('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 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 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 } 2253 }
2254 } 2254 }
2255 2255
2256 void Scope::AllocateDebuggerScopeInfos(Isolate* isolate, 2256 void Scope::AllocateDebuggerScopeInfos(Isolate* isolate,
2257 MaybeHandle<ScopeInfo> outer_scope) { 2257 MaybeHandle<ScopeInfo> outer_scope) {
2258 if (scope_info_.is_null()) { 2258 if (scope_info_.is_null()) {
2259 scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope); 2259 scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope);
2260 } 2260 }
2261 MaybeHandle<ScopeInfo> outer = NeedsContext() ? scope_info_ : outer_scope; 2261 MaybeHandle<ScopeInfo> outer = NeedsContext() ? scope_info_ : outer_scope;
2262 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { 2262 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
2263 if (scope->is_function_scope()) continue; 2263 if (!scope->is_function_scope() ||
2264 scope->AllocateDebuggerScopeInfos(isolate, outer); 2264 scope->AsDeclarationScope()->is_arrow_scope()) {
2265 scope->AllocateDebuggerScopeInfos(isolate, outer);
2266 }
2265 } 2267 }
2266 } 2268 }
2267 2269
2268 void Scope::CollectVariableData(PreParsedScopeData* data) { 2270 void Scope::CollectVariableData(PreParsedScopeData* data) {
2269 PreParsedScopeData::ScopeScope scope_scope(data, scope_type(), 2271 PreParsedScopeData::ScopeScope scope_scope(data, scope_type(),
2270 start_position(), end_position()); 2272 start_position(), end_position());
2271 for (Variable* local : locals_) { 2273 for (Variable* local : locals_) {
2272 scope_scope.MaybeAddVariable(local); 2274 scope_scope.MaybeAddVariable(local);
2273 } 2275 }
2274 for (Scope* inner = inner_scope_; inner != nullptr; inner = inner->sibling_) { 2276 for (Scope* inner = inner_scope_; inner != nullptr; inner = inner->sibling_) {
(...skipping 14 matching lines...) Expand all
2289 Variable* function = 2291 Variable* function =
2290 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2292 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2291 bool is_function_var_in_context = 2293 bool is_function_var_in_context =
2292 function != nullptr && function->IsContextSlot(); 2294 function != nullptr && function->IsContextSlot();
2293 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2295 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2294 (is_function_var_in_context ? 1 : 0); 2296 (is_function_var_in_context ? 1 : 0);
2295 } 2297 }
2296 2298
2297 } // namespace internal 2299 } // namespace internal
2298 } // namespace v8 2300 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/inspector/debugger/step-into-arrow.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698