mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Fix notifications of code observers from background compiler
This CL fixes crash in vm/cc/DartAPI_DartInitializeCallsCodeObserver test after kernel service is switched to bytecode (so background compilations are more likely to happen). Change-Id: Idfc97f16f8658c953628ba0a878b1d6dd2d46186 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113134 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
802937e5a6
commit
b60def0de4
|
@ -15053,6 +15053,7 @@ void Code::NotifyCodeObservers(const Function& function,
|
|||
const Code& code,
|
||||
bool optimized) {
|
||||
#if !defined(PRODUCT)
|
||||
ASSERT(!function.IsNull());
|
||||
ASSERT(!Thread::Current()->IsAtSafepoint());
|
||||
// Calling ToLibNamePrefixedQualifiedCString is very expensive,
|
||||
// try to avoid it.
|
||||
|
@ -15067,6 +15068,8 @@ void Code::NotifyCodeObservers(const char* name,
|
|||
const Code& code,
|
||||
bool optimized) {
|
||||
#if !defined(PRODUCT)
|
||||
ASSERT(name != nullptr);
|
||||
ASSERT(!code.IsNull());
|
||||
ASSERT(!Thread::Current()->IsAtSafepoint());
|
||||
if (CodeObservers::AreActive()) {
|
||||
const auto& instrs = Instructions::Handle(code.instructions());
|
||||
|
|
|
@ -210,7 +210,7 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
|
|||
|
||||
// We notify code observers after finalizing the code in order to be
|
||||
// outside a [SafepointOperationScope].
|
||||
Code::NotifyCodeObservers(nullptr, stub, /*optimized=*/false);
|
||||
Code::NotifyCodeObservers(name, stub, /*optimized=*/false);
|
||||
}
|
||||
#ifndef PRODUCT
|
||||
if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
|
||||
|
|
Loading…
Reference in a new issue