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

Side by Side Diff: runtime/vm/debugger.cc

Issue 10665009: Fix parent function of deeply nested closures (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/parser.h » ('j') | runtime/vm/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 872 }
873 EnsureFunctionIsDeoptimized(target_function); 873 EnsureFunctionIsDeoptimized(target_function);
874 SourceBreakpoint* bpt = GetSourceBreakpoint(target_function, token_index); 874 SourceBreakpoint* bpt = GetSourceBreakpoint(target_function, token_index);
875 if (bpt != NULL) { 875 if (bpt != NULL) {
876 // A breakpoint for this location already exists, return it. 876 // A breakpoint for this location already exists, return it.
877 return bpt; 877 return bpt;
878 } 878 }
879 bpt = new SourceBreakpoint(nextId(), target_function, token_index); 879 bpt = new SourceBreakpoint(nextId(), target_function, token_index);
880 RegisterSourceBreakpoint(bpt); 880 RegisterSourceBreakpoint(bpt);
881 if (verbose && !target_function.HasCode()) { 881 if (verbose && !target_function.HasCode()) {
882 OS::Print("Registering breakpoint for uncompiled function '%s'" 882 OS::Print("Registering breakpoint for "
883 " (%s:%d)\n", 883 "uncompiled function '%s' at line %d\n",
884 String::Handle(target_function.name()).ToCString(), 884 target_function.ToFullyQualifiedCString(),
885 String::Handle(bpt->SourceUrl()).ToCString(),
886 bpt->LineNumber()); 885 bpt->LineNumber());
887 } 886 }
888 887
889 if (target_function.HasCode()) { 888 if (target_function.HasCode()) {
890 CodeBreakpoint* cbpt = MakeCodeBreakpoint(target_function, token_index); 889 CodeBreakpoint* cbpt = MakeCodeBreakpoint(target_function, token_index);
891 if (cbpt != NULL) { 890 if (cbpt != NULL) {
892 ASSERT(cbpt->src_bpt() == NULL); 891 ASSERT(cbpt->src_bpt() == NULL);
893 cbpt->set_src_bpt(bpt); 892 cbpt->set_src_bpt(bpt);
894 SignalBpResolved(bpt); 893 SignalBpResolved(bpt);
895 } else { 894 } else {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 while (bpt != NULL) { 1330 while (bpt != NULL) {
1332 if (lookup_function.raw() == bpt->function()) { 1331 if (lookup_function.raw() == bpt->function()) {
1333 // Check if the breakpoint is inside a closure or local function 1332 // Check if the breakpoint is inside a closure or local function
1334 // within the newly compiled function. 1333 // within the newly compiled function.
1335 Class& owner = Class::Handle(lookup_function.owner()); 1334 Class& owner = Class::Handle(lookup_function.owner());
1336 Function& closure = 1335 Function& closure =
1337 Function::Handle(owner.LookupClosureFunction(bpt->token_index())); 1336 Function::Handle(owner.LookupClosureFunction(bpt->token_index()));
1338 if (!closure.IsNull() && (closure.raw() != lookup_function.raw())) { 1337 if (!closure.IsNull() && (closure.raw() != lookup_function.raw())) {
1339 if (verbose) { 1338 if (verbose) {
1340 OS::Print("Resetting pending breakpoint to function %s\n", 1339 OS::Print("Resetting pending breakpoint to function %s\n",
1341 String::Handle(closure.name()).ToCString()); 1340 closure.ToFullyQualifiedCString());
1342 } 1341 }
1343 bpt->set_function(closure); 1342 bpt->set_function(closure);
1344 } else { 1343 } else {
1345 if (verbose) { 1344 if (verbose) {
1346 OS::Print("Enable pending breakpoint for function '%s'\n", 1345 OS::Print("Enable pending breakpoint for function '%s'\n",
1347 String::Handle(lookup_function.name()).ToCString()); 1346 String::Handle(lookup_function.name()).ToCString());
1348 } 1347 }
1349 // Set breakpoint in newly compiled code of function func. 1348 // Set breakpoint in newly compiled code of function func.
1350 CodeBreakpoint* cbpt = MakeCodeBreakpoint(func, bpt->token_index()); 1349 CodeBreakpoint* cbpt = MakeCodeBreakpoint(func, bpt->token_index());
1351 if (cbpt != NULL) { 1350 if (cbpt != NULL) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 } 1471 }
1473 1472
1474 1473
1475 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1474 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1476 ASSERT(bpt->next() == NULL); 1475 ASSERT(bpt->next() == NULL);
1477 bpt->set_next(code_breakpoints_); 1476 bpt->set_next(code_breakpoints_);
1478 code_breakpoints_ = bpt; 1477 code_breakpoints_ = bpt;
1479 } 1478 }
1480 1479
1481 } // namespace dart 1480 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.h » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698