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

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

Issue 23850014: - Use simplified token location call where appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 RawString* SourceBreakpoint::SourceUrl() { 95 RawString* SourceBreakpoint::SourceUrl() {
96 const Script& script = Script::Handle(SourceCode()); 96 const Script& script = Script::Handle(SourceCode());
97 return script.url(); 97 return script.url();
98 } 98 }
99 99
100 100
101 intptr_t SourceBreakpoint::LineNumber() { 101 intptr_t SourceBreakpoint::LineNumber() {
102 // Compute line number lazily since it causes scanning of the script. 102 // Compute line number lazily since it causes scanning of the script.
103 if (line_number_ < 0) { 103 if (line_number_ < 0) {
104 const Script& script = Script::Handle(SourceCode()); 104 const Script& script = Script::Handle(SourceCode());
105 intptr_t ignore_column; 105 script.GetTokenLocation(token_pos_, &line_number_, NULL);
106 script.GetTokenLocation(token_pos_, &line_number_, &ignore_column);
107 } 106 }
108 return line_number_; 107 return line_number_;
109 } 108 }
110 109
111 110
112 void SourceBreakpoint::set_function(const Function& func) { 111 void SourceBreakpoint::set_function(const Function& func) {
113 function_ = func.raw(); 112 function_ = func.raw();
114 } 113 }
115 114
116 115
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } else { 272 } else {
274 return pc_desc_.TryIndex(desc_index); 273 return pc_desc_.TryIndex(desc_index);
275 } 274 }
276 } 275 }
277 276
278 277
279 intptr_t ActivationFrame::LineNumber() { 278 intptr_t ActivationFrame::LineNumber() {
280 // Compute line number lazily since it causes scanning of the script. 279 // Compute line number lazily since it causes scanning of the script.
281 if ((line_number_ < 0) && (TokenPos() >= 0)) { 280 if ((line_number_ < 0) && (TokenPos() >= 0)) {
282 const Script& script = Script::Handle(SourceScript()); 281 const Script& script = Script::Handle(SourceScript());
283 intptr_t ignore_column; 282 script.GetTokenLocation(TokenPos(), &line_number_, NULL);
284 script.GetTokenLocation(TokenPos(), &line_number_, &ignore_column);
285 } 283 }
286 return line_number_; 284 return line_number_;
287 } 285 }
288 286
289 287
290 void ActivationFrame::GetVarDescriptors() { 288 void ActivationFrame::GetVarDescriptors() {
291 if (var_descriptors_.IsNull()) { 289 if (var_descriptors_.IsNull()) {
292 var_descriptors_ = code().var_descriptors(); 290 var_descriptors_ = code().var_descriptors();
293 ASSERT(!var_descriptors_.IsNull()); 291 ASSERT(!var_descriptors_.IsNull());
294 } 292 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 RawString* CodeBreakpoint::SourceUrl() { 655 RawString* CodeBreakpoint::SourceUrl() {
658 const Script& script = Script::Handle(SourceCode()); 656 const Script& script = Script::Handle(SourceCode());
659 return script.url(); 657 return script.url();
660 } 658 }
661 659
662 660
663 intptr_t CodeBreakpoint::LineNumber() { 661 intptr_t CodeBreakpoint::LineNumber() {
664 // Compute line number lazily since it causes scanning of the script. 662 // Compute line number lazily since it causes scanning of the script.
665 if (line_number_ < 0) { 663 if (line_number_ < 0) {
666 const Script& script = Script::Handle(SourceCode()); 664 const Script& script = Script::Handle(SourceCode());
667 intptr_t ignore_column; 665 script.GetTokenLocation(token_pos_, &line_number_, NULL);
668 script.GetTokenLocation(token_pos_, &line_number_, &ignore_column);
669 } 666 }
670 return line_number_; 667 return line_number_;
671 } 668 }
672 669
673 670
674 void CodeBreakpoint::PatchCode() { 671 void CodeBreakpoint::PatchCode() {
675 ASSERT(!is_enabled_); 672 ASSERT(!is_enabled_);
676 switch (breakpoint_kind_) { 673 switch (breakpoint_kind_) {
677 case PcDescriptors::kIcCall: { 674 case PcDescriptors::kIcCall: {
678 const Code& code = 675 const Code& code =
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 } 1874 }
1878 1875
1879 1876
1880 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1877 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1881 ASSERT(bpt->next() == NULL); 1878 ASSERT(bpt->next() == NULL);
1882 bpt->set_next(code_breakpoints_); 1879 bpt->set_next(code_breakpoints_);
1883 code_breakpoints_ = bpt; 1880 code_breakpoints_ = bpt;
1884 } 1881 }
1885 1882
1886 } // namespace dart 1883 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698