Chromium Code Reviews| Index: runtime/vm/profiler_service.cc |
| diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc |
| index 9a4fe3b6916104fcf09acde7a1eaa54342033f1b..7275da2e24ba639c7f0dc3c7e21e870fa791338b 100644 |
| --- a/runtime/vm/profiler_service.cc |
| +++ b/runtime/vm/profiler_service.cc |
| @@ -2678,11 +2678,6 @@ const char* ProfileTrieWalker::CurrentToken() { |
| // No script. |
| return NULL; |
| } |
| - const TokenStream& token_stream = TokenStream::Handle(zone, script.tokens()); |
| - if (token_stream.IsNull()) { |
| - // No token position. |
| - return NULL; |
| - } |
| ProfileFunctionSourcePosition pfsp(TokenPosition::kNoSource); |
| if (!func->GetSinglePosition(&pfsp)) { |
| // Not exactly one source position. |
| @@ -2696,12 +2691,30 @@ const char* ProfileTrieWalker::CurrentToken() { |
| if (token_pos.IsSynthetic()) { |
| token_pos = token_pos.FromSynthetic(); |
| } |
| - TokenStream::Iterator iterator(zone, token_stream, token_pos); |
| - const String& str = String::Handle(zone, iterator.CurrentLiteral()); |
| - if (str.IsNull()) { |
| - return NULL; |
| + |
| + if (script.kind() == RawScript::kKernelTag) { |
|
Vyacheslav Egorov (Google)
2017/06/16 11:09:18
Please update CL description to include descriptio
jensj
2017/06/16 11:39:07
"fix some cc tests" isn't descriptive enough?
Kevin Millikin (Google)
2017/06/21 06:50:43
I would probably factor out the common code from t
|
| + intptr_t line = 0, column = 0, token_len = 0; |
| + script.GetTokenLocation(token_pos, &line, &column, &token_len); |
| + const String& str = String::Handle( |
| + zone, script.GetSnippet(line, column, line, column + token_len)); |
| + if (str.IsNull()) { |
| + return NULL; |
| + } |
| + return str.ToCString(); |
| + } else { |
| + const TokenStream& token_stream = |
| + TokenStream::Handle(zone, script.tokens()); |
| + if (token_stream.IsNull()) { |
| + // No token position. |
| + return NULL; |
| + } |
| + TokenStream::Iterator iterator(zone, token_stream, token_pos); |
| + const String& str = String::Handle(zone, iterator.CurrentLiteral()); |
| + if (str.IsNull()) { |
| + return NULL; |
| + } |
| + return str.ToCString(); |
| } |
| - return str.ToCString(); |
| } |
| bool ProfileTrieWalker::Down() { |