Index: runtime/vm/precompiler.cc |
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc |
index 3743b1efe72e1f0904c7a17b47596758c05ab328..e61e916218cb9abe1876e1b26fdccf377f39076b 100644 |
--- a/runtime/vm/precompiler.cc |
+++ b/runtime/vm/precompiler.cc |
@@ -2013,7 +2013,12 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { |
"OptimizationPasses"); |
#endif // !PRODUCT |
inline_id_to_function.Add(&function); |
- inline_id_to_token_pos.Add(function.token_pos()); |
+ // We do not add the token position now because we don't know the |
+ // position of the inlined call until later. A side effect of this |
+ // is that the length of |inline_id_to_function| is always larger |
+ // than the length of |inline_id_to_token_pos| by one. |
+ // Top scope function has no caller (-1). We do this because we expect |
+ // all token positions to be at an inlined call. |
// Top scope function has no caller (-1). |
caller_inline_id.Add(-1); |
CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); |