[vm] Extend --trace_deoptimization to cover the lazy deopt causes.

Change-Id: I09843815297fe13ca2f6880e794cc26c76dc6267
Reviewed-on: https://dart-review.googlesource.com/75126
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2018-09-17 22:18:12 +00:00 committed by commit-bot@chromium.org
parent d68f685cab
commit c1ea77a3a0
3 changed files with 21 additions and 2 deletions

View file

@ -58,6 +58,7 @@ DEFINE_FLAG(bool,
"the VM service.");
DECLARE_FLAG(bool, enable_interpreter);
DECLARE_FLAG(bool, trace_deoptimization);
DECLARE_FLAG(bool, warn_on_pause_with_no_debugger);
#ifndef PRODUCT
@ -1868,6 +1869,9 @@ RawFunction* Debugger::ResolveFunction(const Library& library,
// We currently don't have this info so we deoptimize all functions.
void Debugger::DeoptimizeWorld() {
BackgroundCompiler::Stop(isolate_);
if (FLAG_trace_deoptimization) {
THR_Print("Deopt for debugger\n");
}
DeoptimizeFunctionsOnStack();
// Iterate over all classes, deoptimize functions.
// TODO(hausner): Could possibly be combined with RemoveOptimizedCode()

View file

@ -53,6 +53,8 @@ DEFINE_FLAG(bool,
false,
"Assert that an isolate has reloaded at least once.")
DECLARE_FLAG(bool, trace_deoptimization);
#define I (isolate())
#define Z (thread->zone())
@ -1951,6 +1953,9 @@ void IsolateReloadContext::MarkAllFunctionsForRecompilation() {
void IsolateReloadContext::InvalidateWorld() {
TIR_Print("---- INVALIDATING WORLD\n");
ResetMegamorphicCaches();
if (FLAG_trace_deoptimization) {
THR_Print("Deopt for reload\n");
}
DeoptimizeFunctionsOnStack();
ResetUnoptimizedICsOnStack();
MarkAllFunctionsForRecompilation();

View file

@ -3098,8 +3098,12 @@ void Class::RegisterCHACode(const Code& code) {
void Class::DisableCHAOptimizedCode(const Class& subclass) {
ASSERT(Thread::Current()->IsMutatorThread());
CHACodeArray a(*this);
if (FLAG_trace_deoptimization && a.HasCodes() && !subclass.IsNull()) {
THR_Print("Adding subclass %s\n", subclass.ToCString());
if (FLAG_trace_deoptimization && a.HasCodes()) {
if (subclass.IsNull()) {
THR_Print("Deopt for CHA (all)\n");
} else {
THR_Print("Deopt for CHA (new subclass %s)\n", subclass.ToCString());
}
}
a.DisableCode();
}
@ -9007,6 +9011,9 @@ void Field::DeoptimizeDependentCode() const {
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(IsOriginal());
FieldDependentArray a(*this);
if (FLAG_trace_deoptimization && a.HasCodes()) {
THR_Print("Deopt for field guard (field %s)\n", ToCString());
}
a.DisableCode();
}
@ -12968,6 +12975,9 @@ void LibraryPrefix::RegisterDependentCode(const Code& code) const {
void LibraryPrefix::InvalidateDependentCode() const {
PrefixDependentArray a(*this);
if (FLAG_trace_deoptimization && a.HasCodes()) {
THR_Print("Deopt for lazy load (prefix %s)\n", ToCString());
}
a.DisableCode();
set_is_loaded();
}