Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 980e62bfe93baaa3841445a628ec536b4f97d3da..ccd7f25336eb8ac0355e8d39ec991b23466daed9 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -8782,8 +8782,6 @@ const char* Script::GetKindAsCString() const { |
return "patch"; |
case RawScript::kEvaluateTag: |
return "evaluate"; |
- case RawScript::kKernelTag: |
- return "kernel"; |
default: |
UNIMPLEMENTED(); |
} |
@@ -8806,10 +8804,6 @@ void Script::set_source(const String& value) const { |
StorePointer(&raw_ptr()->source_, value.raw()); |
} |
-void Script::set_line_starts(const Array& value) const { |
- StorePointer(&raw_ptr()->line_starts_, value.raw()); |
-} |
- |
void Script::set_kind(RawScript::Kind value) const { |
StoreNonPointer(&raw_ptr()->kind_, value); |
@@ -8860,51 +8854,10 @@ void Script::GetTokenLocation(TokenPosition token_pos, |
intptr_t* token_len) const { |
ASSERT(line != NULL); |
Zone* zone = Thread::Current()->zone(); |
- |
- if (kind() == RawScript::kKernelTag) { |
- const Array& line_starts_array = Array::Handle(line_starts()); |
- if (line_starts_array.IsNull()) { |
- // Scripts in the AOT snapshot do not have a line starts array. |
- *line = -1; |
- if (column != NULL) { |
- *column = -1; |
- } |
- if (token_len != NULL) { |
- *token_len = 1; |
- } |
- return; |
- } |
- ASSERT(line_starts_array.Length() > 0); |
- intptr_t offset = token_pos.value(); |
- int min = 0; |
- int max = line_starts_array.Length() - 1; |
- |
- // Binary search to find the line containing this offset. |
- Smi& smi = Smi::Handle(); |
- while (min < max) { |
- int midpoint = (max - min + 1) / 2 + min; |
- |
- smi ^= line_starts_array.At(midpoint); |
- if (smi.Value() > offset) { |
- max = midpoint - 1; |
- } else { |
- min = midpoint; |
- } |
- } |
- *line = min + 1; |
- if (column != NULL) { |
- smi ^= line_starts_array.At(min); |
- *column = offset - smi.Value() + 1; |
- } |
- if (token_len != NULL) { |
- *token_len = 1; |
- } |
- return; |
- } |
- |
const TokenStream& tkns = TokenStream::Handle(zone, tokens()); |
if (tkns.IsNull()) { |
- ASSERT((Dart::snapshot_kind() == Snapshot::kAppNoJIT)); |
+ ASSERT((Dart::snapshot_kind() == Snapshot::kAppNoJIT) || |
+ (url() == Symbols::KernelScriptUri().raw())); |
*line = -1; |
if (column != NULL) { |
*column = -1; |
@@ -8914,7 +8867,7 @@ void Script::GetTokenLocation(TokenPosition token_pos, |
} |
return; |
} |
- if (!HasSource()) { |
+ if (column == NULL) { |
TokenStream::Iterator tkit(zone, tkns, TokenPosition::kMinSource, |
TokenStream::Iterator::kAllTokens); |
intptr_t cur_line = line_offset() + 1; |
@@ -8933,9 +8886,7 @@ void Script::GetTokenLocation(TokenPosition token_pos, |
scanner.ScanTo(src_pos); |
intptr_t relative_line = scanner.CurrentPosition().line; |
*line = relative_line + line_offset(); |
- if (column != NULL) { |
- *column = scanner.CurrentPosition().column; |
- } |
+ *column = scanner.CurrentPosition().column; |
if (token_len != NULL) { |
if (scanner.current_token().literal != NULL) { |
*token_len = scanner.current_token().literal->Length(); |
@@ -8944,7 +8895,7 @@ void Script::GetTokenLocation(TokenPosition token_pos, |
} |
} |
// On the first line of the script we must add the column offset. |
- if (column != NULL && relative_line == 1) { |
+ if (relative_line == 1) { |
*column += col_offset(); |
} |
} |
@@ -22361,7 +22312,11 @@ static intptr_t PrintOneStacktrace(Zone* zone, |
intptr_t line = -1; |
intptr_t column = -1; |
if (!script.IsNull() && token_pos.IsReal()) { |
- script.GetTokenLocation(token_pos, &line, &column); |
+ if (script.HasSource()) { |
+ script.GetTokenLocation(token_pos, &line, &column); |
+ } else { |
+ script.GetTokenLocation(token_pos, &line, NULL); |
+ } |
} |
char* chars = NULL; |
if (column >= 0) { |