Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 3675bfb32ff3382e8771900b79c80636bf4cdfb1..6c9502daf11f0fa12cacd7221e946d2ea67a444b 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -8845,15 +8845,42 @@ RawGrowableObjectArray* Script::GenerateLineNumberArray() const { |
| } |
| intptr_t line_count = line_starts_array.Length(); |
| ASSERT(line_count > 0); |
| + const Array& tokens_seen_array = Array::Handle(tokens_seen()); |
| + intptr_t token_count = tokens_seen_array.Length(); |
| + int token_idx = 0; |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
You can also spell out index.
jensj
2017/01/25 12:52:22
Done.
|
| + int last_line = -1; |
| for (int i = 0; i < line_count; i++) { |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
Instead of i, it's clearer to use the name 'line_i
jensj
2017/01/25 12:52:22
Done.
|
| - info.Add(line_separator); // New line. |
| - value = Smi::New(i + 1); |
| - info.Add(value); // Line number. |
| value ^= line_starts_array.At(i); |
| - info.Add(value); // Token position. |
| - value = Smi::New(1); |
| - info.Add(value); // Column. |
| + intptr_t start = value.Value(); |
| + // Output the rest of the tokens if we have no next line. |
| + intptr_t end = LONG_MAX; |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
INTPTR_MAX
jensj
2017/01/25 12:52:22
Done.
|
| + if (i + 1 < line_count) { |
| + value ^= line_starts_array.At(i + 1); |
| + end = value.Value(); |
| + } |
| + while (token_idx < token_count) { |
| + value ^= tokens_seen_array.At(token_idx); |
| + intptr_t seen = value.Value(); |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
seen ==> debug_position ?
jensj
2017/01/25 12:52:22
Done.
|
| + if (seen == -1) { |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
Can we just eliminate the -1 entries, or do we nee
jensj
2017/01/25 12:52:22
I'll move the check to the recording of the entrie
|
| + ++token_idx; |
| + continue; |
| + } |
| + if (seen >= end) break; |
| + |
| + if (i != last_line) { |
|
Kevin Millikin (Google)
2017/01/24 13:44:13
last_line is just used to detect the first debug p
jensj
2017/01/25 12:52:22
It was done to look like the non-kernel version. I
|
| + info.Add(line_separator); // New line. |
| + value = Smi::New(i + 1); // Line number. |
| + info.Add(value); |
| + last_line = i; |
| + } |
| + |
| + value ^= tokens_seen_array.At(token_idx); |
| + info.Add(value); // Token position. |
| + value = Smi::New(seen - start + 1); // Column. |
| + info.Add(value); |
| + ++token_idx; |
| + } |
| } |
| return info.raw(); |
| } |
| @@ -8974,6 +9001,16 @@ void Script::set_line_starts(const Array& value) const { |
| } |
| +void Script::set_tokens_seen(const Array& value) const { |
| + StorePointer(&raw_ptr()->tokens_seen_, value.raw()); |
| +} |
| + |
| + |
| +void Script::set_yields_seen(const Array& value) const { |
| + StorePointer(&raw_ptr()->yields_seen_, value.raw()); |
| +} |
| + |
| + |
| void Script::set_kind(RawScript::Kind value) const { |
| StoreNonPointer(&raw_ptr()->kind_, value); |
| } |
| @@ -9064,6 +9101,8 @@ void Script::GetTokenLocation(TokenPosition token_pos, |
| *column = offset - smi.Value() + 1; |
| } |
| if (token_len != NULL) { |
| + // We don't explicitly save this data. |
| + // TODO(jensj): Load the source and attempt to find it from there. |
| *token_len = 1; |
| } |
| return; |