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

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

Issue 116223006: Fix setting breakpoint in non-finalized class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | tests/standalone/debugger/local_function_test.dart » ('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 (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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 Class& cls = Class::Handle(isolate_); 1385 Class& cls = Class::Handle(isolate_);
1386 Array& functions = Array::Handle(isolate_); 1386 Array& functions = Array::Handle(isolate_);
1387 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_); 1387 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_);
1388 Function& function = Function::Handle(isolate_); 1388 Function& function = Function::Handle(isolate_);
1389 1389
1390 const ClassTable& class_table = *isolate_->class_table(); 1390 const ClassTable& class_table = *isolate_->class_table();
1391 const intptr_t num_classes = class_table.NumCids(); 1391 const intptr_t num_classes = class_table.NumCids();
1392 for (intptr_t i = 1; i < num_classes; i++) { 1392 for (intptr_t i = 1; i < num_classes; i++) {
1393 if (class_table.HasValidClassAt(i)) { 1393 if (class_table.HasValidClassAt(i)) {
1394 cls = class_table.At(i); 1394 cls = class_table.At(i);
1395 // If the class is not finalized, e.g. if it hasn't been parsed
1396 // yet entirely, we can ignore it. If it contains a function with
1397 // a latent breakpoint, we will detect it if and when the function
1398 // gets compiled.
1399 if (!cls.is_finalized()) {
1400 continue;
1401 }
1395 // Note: we need to check the functions of this class even if 1402 // Note: we need to check the functions of this class even if
1396 // the class is defined in a differenct 'script'. There could 1403 // the class is defined in a differenct 'script'. There could
1397 // be mixin functions from the given script in this class. 1404 // be mixin functions from the given script in this class.
1398 functions = cls.functions(); 1405 functions = cls.functions();
1399 if (!functions.IsNull()) { 1406 if (!functions.IsNull()) {
1400 const intptr_t num_functions = functions.Length(); 1407 const intptr_t num_functions = functions.Length();
1401 for (intptr_t pos = 0; pos < num_functions; pos++) { 1408 for (intptr_t pos = 0; pos < num_functions; pos++) {
1402 function ^= functions.At(pos); 1409 function ^= functions.At(pos);
1403 ASSERT(!function.IsNull()); 1410 ASSERT(!function.IsNull());
1404 // Check token position first to avoid unnecessary calls 1411 // Check token position first to avoid unnecessary calls
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 Array& functions = Array::Handle(isolate_); 1475 Array& functions = Array::Handle(isolate_);
1469 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_); 1476 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_);
1470 Function& function = Function::Handle(isolate_); 1477 Function& function = Function::Handle(isolate_);
1471 Function& best_fit = Function::Handle(isolate_); 1478 Function& best_fit = Function::Handle(isolate_);
1472 1479
1473 const ClassTable& class_table = *isolate_->class_table(); 1480 const ClassTable& class_table = *isolate_->class_table();
1474 const intptr_t num_classes = class_table.NumCids(); 1481 const intptr_t num_classes = class_table.NumCids();
1475 for (intptr_t i = 1; i < num_classes; i++) { 1482 for (intptr_t i = 1; i < num_classes; i++) {
1476 if (class_table.HasValidClassAt(i)) { 1483 if (class_table.HasValidClassAt(i)) {
1477 cls = class_table.At(i); 1484 cls = class_table.At(i);
1478 // Note: we need to check the functions of this class even if 1485 // Note: if this class has been parsed and finalized already,
1479 // the class is defined in a differenct 'script'. There could 1486 // we need to check the functions of this class even if
1487 // it is defined in a differenct 'script'. There could
1480 // be mixin functions from the given script in this class. 1488 // be mixin functions from the given script in this class.
1489 // However, if this class is not parsed yet (not finalized),
1490 // we can ignore it and avoid the side effect of parsing it.
1491 if ((cls.script() != script.raw()) && !cls.is_finalized()) {
1492 continue;
1493 }
1494 // Parse class definition if not done yet.
1495 cls.EnsureIsFinalized(isolate_);
Ivan Posva 2014/01/03 20:21:13 What happens if there is a compilation failure dur
hausner 2014/01/03 20:52:52 The compilation error gets dropped and the class r
1481 functions = cls.functions(); 1496 functions = cls.functions();
1482 if (!functions.IsNull()) { 1497 if (!functions.IsNull()) {
1483 const intptr_t num_functions = functions.Length(); 1498 const intptr_t num_functions = functions.Length();
1484 for (intptr_t pos = 0; pos < num_functions; pos++) { 1499 for (intptr_t pos = 0; pos < num_functions; pos++) {
1485 function ^= functions.At(pos); 1500 function ^= functions.At(pos);
1486 ASSERT(!function.IsNull()); 1501 ASSERT(!function.IsNull());
1487 if (FunctionContains(function, script, token_pos)) { 1502 if (FunctionContains(function, script, token_pos)) {
1488 SelectBestFit(&best_fit, &function); 1503 SelectBestFit(&best_fit, &function);
1489 } 1504 }
1490 } 1505 }
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 } 2286 }
2272 2287
2273 2288
2274 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2289 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2275 ASSERT(bpt->next() == NULL); 2290 ASSERT(bpt->next() == NULL);
2276 bpt->set_next(code_breakpoints_); 2291 bpt->set_next(code_breakpoints_);
2277 code_breakpoints_ = bpt; 2292 code_breakpoints_ = bpt;
2278 } 2293 }
2279 2294
2280 } // namespace dart 2295 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/debugger/local_function_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698