[vm/compiler] Do not notify observers if we failed to create code.

CodeObservers don't expect to be notified with `null` code object.

Change-Id: I4ebbe021f827faf9e01b5b3c3734470433e14787
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152803
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Vyacheslav Egorov
2020-06-30 07:10:56 +00:00
committed by commit-bot@chromium.org
parent 49d733ebc3
commit 96e8fa9cb5
+3 -4
View File
@@ -658,12 +658,11 @@ CodePtr CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
//
thread()->isolate_group()->RunWithStoppedMutators(
install_code_fun, install_code_fun, /*use_force_growth=*/true);
// We notify code observers after finalizing the code in order to be
// outside a [SafepointOperationScope].
Code::NotifyCodeObservers(function, *result, optimized());
}
if (!result->IsNull()) {
// Must be called outside of safepoint.
Code::NotifyCodeObservers(function, *result, optimized());
#if !defined(PRODUCT)
if (!function.HasOptimizedCode()) {
isolate()->debugger()->NotifyCompilation(function);