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

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

Issue 1312763010: Support column-based breakpoints in the VM and Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweak test Created 5 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
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 8575 matching lines...) Expand 10 before | Expand all | Expand 10 after
8586 intptr_t col_offset) const { 8586 intptr_t col_offset) const {
8587 ASSERT(line_offset >= 0); 8587 ASSERT(line_offset >= 0);
8588 ASSERT(col_offset >= 0); 8588 ASSERT(col_offset >= 0);
8589 StoreNonPointer(&raw_ptr()->line_offset_, line_offset); 8589 StoreNonPointer(&raw_ptr()->line_offset_, line_offset);
8590 StoreNonPointer(&raw_ptr()->col_offset_, col_offset); 8590 StoreNonPointer(&raw_ptr()->col_offset_, col_offset);
8591 } 8591 }
8592 8592
8593 8593
8594 void Script::GetTokenLocation(intptr_t token_pos, 8594 void Script::GetTokenLocation(intptr_t token_pos,
8595 intptr_t* line, 8595 intptr_t* line,
8596 intptr_t* column) const { 8596 intptr_t* column,
8597 intptr_t* token_len) const {
8597 ASSERT(line != NULL); 8598 ASSERT(line != NULL);
8598 const TokenStream& tkns = TokenStream::Handle(tokens()); 8599 const TokenStream& tkns = TokenStream::Handle(tokens());
8599 if (column == NULL) { 8600 if (column == NULL) {
8600 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens); 8601 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens);
8601 intptr_t cur_line = line_offset() + 1; 8602 intptr_t cur_line = line_offset() + 1;
8602 while (tkit.CurrentPosition() < token_pos && 8603 while (tkit.CurrentPosition() < token_pos &&
8603 tkit.CurrentTokenKind() != Token::kEOS) { 8604 tkit.CurrentTokenKind() != Token::kEOS) {
8604 if (tkit.CurrentTokenKind() == Token::kNEWLINE) { 8605 if (tkit.CurrentTokenKind() == Token::kNEWLINE) {
8605 cur_line++; 8606 cur_line++;
8606 } 8607 }
8607 tkit.Advance(); 8608 tkit.Advance();
8608 } 8609 }
8609 *line = cur_line; 8610 *line = cur_line;
8610 } else { 8611 } else {
8611 const String& src = String::Handle(Source()); 8612 const String& src = String::Handle(Source());
8612 intptr_t src_pos = tkns.ComputeSourcePosition(token_pos); 8613 intptr_t src_pos = tkns.ComputeSourcePosition(token_pos);
8613 Scanner scanner(src, Symbols::Empty()); 8614 Scanner scanner(src, Symbols::Empty());
8614 scanner.ScanTo(src_pos); 8615 scanner.ScanTo(src_pos);
8615 intptr_t relative_line = scanner.CurrentPosition().line; 8616 intptr_t relative_line = scanner.CurrentPosition().line;
8616 *line = relative_line + line_offset(); 8617 *line = relative_line + line_offset();
8617 *column = scanner.CurrentPosition().column; 8618 *column = scanner.CurrentPosition().column;
8619 if (token_len != NULL) {
8620 if (scanner.current_token().literal != NULL) {
8621 *token_len = scanner.current_token().literal->Length();
8622 } else {
8623 *token_len = 1;
8624 }
8625 }
8618 // On the first line of the script we must add the column offset. 8626 // On the first line of the script we must add the column offset.
8619 if (relative_line == 1) { 8627 if (relative_line == 1) {
8620 *column += col_offset(); 8628 *column += col_offset();
8621 } 8629 }
8622 } 8630 }
8623 } 8631 }
8624 8632
8625 8633
8626 void Script::TokenRangeAtLine(intptr_t line_number, 8634 void Script::TokenRangeAtLine(intptr_t line_number,
8627 intptr_t* first_token_index, 8635 intptr_t* first_token_index,
(...skipping 12880 matching lines...) Expand 10 before | Expand all | Expand 10 after
21508 return tag_label.ToCString(); 21516 return tag_label.ToCString();
21509 } 21517 }
21510 21518
21511 21519
21512 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21520 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21513 Instance::PrintJSONImpl(stream, ref); 21521 Instance::PrintJSONImpl(stream, ref);
21514 } 21522 }
21515 21523
21516 21524
21517 } // namespace dart 21525 } // namespace dart
OLDNEW
« runtime/vm/debugger.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698