[vm/bytecode] Fix CollectBytecodeFunctionTokenPositions for functions without bytecode

Certain functions (e.g. abstract) don't have bytecode although they are
declared in bytecode. As CollectBytecodeFunctionTokenPositions is called
for all functions, it should account for absence of bytecode.

This fix prevents crashes when certain functions are opened in observatory profiler.

Change-Id: I191b01df60a1eff06c8b09fbce80f15fbf409a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108965
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2019-07-12 23:42:33 +00:00 committed by commit-bot@chromium.org
parent 6c03c1a47c
commit 117c65c901

View file

@ -287,7 +287,9 @@ static void CollectBytecodeFunctionTokenPositions(
}
}
Bytecode& bytecode = Bytecode::Handle(zone, function.bytecode());
ASSERT(!bytecode.IsNull());
if (bytecode.IsNull()) {
return;
}
if (bytecode.HasSourcePositions() && !function.IsLocalFunction()) {
CollectBytecodeTokenPositions(bytecode, zone, token_positions);
// Find closure functions in the object pool.