| OLD | NEW |
| 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_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 | 536 |
| 537 CodeBreakpoint* Debugger::MakeCodeBreakpoint(const Function& func, | 537 CodeBreakpoint* Debugger::MakeCodeBreakpoint(const Function& func, |
| 538 intptr_t token_index) { | 538 intptr_t token_index) { |
| 539 ASSERT(func.HasCode()); | 539 ASSERT(func.HasCode()); |
| 540 ASSERT(!func.HasOptimizedCode()); | 540 ASSERT(!func.HasOptimizedCode()); |
| 541 Code& code = Code::Handle(func.unoptimized_code()); | 541 Code& code = Code::Handle(func.unoptimized_code()); |
| 542 ASSERT(!code.IsNull()); | 542 ASSERT(!code.IsNull()); |
| 543 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); | 543 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); |
| 544 intptr_t best_fit_index = -1; | 544 intptr_t best_fit_index = -1; |
| 545 intptr_t best_fit = INTPTR_MAX; | 545 // TODO(hausner): find a symbolic value that works on all platforms. |
| 546 intptr_t best_fit = 0x8fffffff; |
| 546 for (int i = 0; i < desc.Length(); i++) { | 547 for (int i = 0; i < desc.Length(); i++) { |
| 547 intptr_t desc_token_index = desc.TokenIndex(i); | 548 intptr_t desc_token_index = desc.TokenIndex(i); |
| 548 if (desc_token_index < token_index) { | 549 if (desc_token_index < token_index) { |
| 549 continue; | 550 continue; |
| 550 } | 551 } |
| 551 PcDescriptors::Kind kind = desc.DescriptorKind(i); | 552 PcDescriptors::Kind kind = desc.DescriptorKind(i); |
| 552 if ((kind == PcDescriptors::kIcCall) || | 553 if ((kind == PcDescriptors::kIcCall) || |
| 553 (kind == PcDescriptors::kFuncCall) || | 554 (kind == PcDescriptors::kFuncCall) || |
| 554 (kind == PcDescriptors::kReturn)) { | 555 (kind == PcDescriptors::kReturn)) { |
| 555 if ((desc_token_index - token_index) < best_fit) { | 556 if ((desc_token_index - token_index) < best_fit) { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1051 } |
| 1051 | 1052 |
| 1052 | 1053 |
| 1053 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1054 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1054 ASSERT(bpt->next() == NULL); | 1055 ASSERT(bpt->next() == NULL); |
| 1055 bpt->set_next(code_breakpoints_); | 1056 bpt->set_next(code_breakpoints_); |
| 1056 code_breakpoints_ = bpt; | 1057 code_breakpoints_ = bpt; |
| 1057 } | 1058 } |
| 1058 | 1059 |
| 1059 } // namespace dart | 1060 } // namespace dart |
| OLD | NEW |