[runtime] Add --trace-interrupts flag

Add a flag which traces which interrupts are being handled by the
StackGuard's HandleInterrupts function.

Change-Id: I18fcf58b03cf6c255d7457d8a55b0a0dadb00931
Reviewed-on: https://chromium-review.googlesource.com/649530
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47828}
This commit is contained in:
Leszek Swirski 2017-09-05 16:53:08 +01:00 committed by Commit Bot
parent e11cee846f
commit 2c524b0ca9
2 changed files with 45 additions and 4 deletions

View File

@ -466,32 +466,73 @@ Object* StackGuard::HandleInterrupts() {
isolate_->heap()->MonotonicallyIncreasingTimeInMs();
}
bool any_interrupt_handled = false;
if (FLAG_trace_interrupts) {
PrintF("[Handling interrupts: ");
}
if (CheckAndClearInterrupt(GC_REQUEST)) {
if (FLAG_trace_interrupts) {
PrintF("GC_REQUEST");
any_interrupt_handled = true;
}
isolate_->heap()->HandleGCRequest();
}
if (CheckDebugBreak()) {
if (FLAG_trace_interrupts) {
if (any_interrupt_handled) PrintF(", ");
PrintF("DEBUG_BREAK");
any_interrupt_handled = true;
}
isolate_->debug()->HandleDebugBreak(kIgnoreIfTopFrameBlackboxed);
}
if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) {
if (FLAG_trace_interrupts) {
if (any_interrupt_handled) PrintF(", ");
PrintF("TERMINATE_EXECUTION");
any_interrupt_handled = true;
}
return isolate_->TerminateExecution();
}
if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES)) {
if (FLAG_trace_interrupts) {
if (any_interrupt_handled) PrintF(", ");
PrintF("DEOPT_MARKED_ALLOCATION_SITES");
any_interrupt_handled = true;
}
isolate_->heap()->DeoptMarkedAllocationSites();
}
if (CheckAndClearInterrupt(INSTALL_CODE)) {
if (FLAG_trace_interrupts) {
if (any_interrupt_handled) PrintF(", ");
PrintF("INSTALL_CODE");
any_interrupt_handled = true;
}
DCHECK(isolate_->concurrent_recompilation_enabled());
isolate_->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
}
if (CheckAndClearInterrupt(API_INTERRUPT)) {
if (FLAG_trace_interrupts) {
if (any_interrupt_handled) PrintF(", ");
PrintF("API_INTERRUPT");
any_interrupt_handled = true;
}
// Callbacks must be invoked outside of ExecusionAccess lock.
isolate_->InvokeApiInterruptCallbacks();
}
if (FLAG_trace_interrupts) {
if (!any_interrupt_handled) {
PrintF("No interrupt flags set");
}
PrintF("]\n");
}
isolate_->counters()->stack_interrupts()->Increment();
isolate_->counters()->runtime_profiler_ticks()->Increment();
isolate_->runtime_profiler()->MarkCandidatesForOptimization();

View File

@ -546,9 +546,6 @@ DEFINE_INT(generic_ic_threshold, 30,
"max percentage of megamorphic/generic ICs to allow optimization")
DEFINE_INT(self_opt_count, 130, "call count before self-optimization")
DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
// Garbage collections flags.
DEFINE_INT(min_semi_space_size, 0,
"min size of a semi-space (in MBytes), the new space consists of two"
@ -745,14 +742,17 @@ DEFINE_BOOL(trace, false, "trace function calls")
// codegen.cc
DEFINE_BOOL(lazy, true, "use lazy compilation")
DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
DEFINE_BOOL(trace_opt_stats, false, "trace lazy optimization statistics")
DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
DEFINE_BOOL(trace_file_names, false,
"include file names in trace-opt/trace-deopt output")
DEFINE_BOOL(trace_interrupts, false, "trace interrupts when they are handled")
DEFINE_BOOL(opt, true, "use adaptive optimizations")
DEFINE_BOOL(always_opt, false, "always try to optimize functions")
DEFINE_BOOL(always_osr, false, "always try to OSR functions")
DEFINE_BOOL(prepare_always_opt, false, "prepare for turning on always opt")
DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
DEFINE_BOOL(serialize_toplevel, true, "enable caching of toplevel scripts")
DEFINE_BOOL(serialize_eager, false, "compile eagerly when caching scripts")