Chromium Code Reviews| Index: runtime/vm/deopt_instructions.cc |
| diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc |
| index 22ecaf5019ec47352c646a2c553e15aa068fd56f..73722716567f050d1a8ce8bef726588a2cc8e7ff 100644 |
| --- a/runtime/vm/deopt_instructions.cc |
| +++ b/runtime/vm/deopt_instructions.cc |
| @@ -12,6 +12,7 @@ |
| #include "vm/parser.h" |
| #include "vm/stack_frame.h" |
| #include "vm/thread.h" |
| +#include "vm/timeline.h" |
| namespace dart { |
| @@ -41,6 +42,7 @@ DeoptContext::DeoptContext(const StackFrame* frame, |
| deopt_reason_(ICData::kDeoptUnknown), |
| deopt_flags_(0), |
| thread_(Thread::Current()), |
| + timeline_event_(NULL), |
| deferred_slots_(NULL), |
| deferred_objects_count_(0), |
| deferred_objects_(NULL) { |
| @@ -92,6 +94,31 @@ DeoptContext::DeoptContext(const StackFrame* frame, |
| dest_frame_is_allocated_ = true; |
| } |
| + if (dest_options != kDestIsAllocated) { |
| + // kDestIsAllocated is used by the debugger to generate a stack trace |
| + // and does not signal a real deopt. |
| + Isolate* isolate = Isolate::Current(); |
| + TimelineStream* compiler_stream = isolate->GetCompilerStream(); |
| + timeline_event_ = compiler_stream->RecordEvent(); |
| + if (timeline_event_ != NULL) { |
| + timeline_event_->DurationBegin(compiler_stream, "Deoptimize"); |
| + timeline_event_->SetNumArguments(3); |
| + timeline_event_->CopyArgument( |
| + 0, |
| + "function", |
| + const_cast<char*>(function.QualifiedUserVisibleNameCString())); |
|
rmacnak
2015/06/10 20:25:14
The whole leaf runtime entry is in a NoSafepointSc
Cutch
2015/06/10 21:20:57
Done.
|
| + timeline_event_->CopyArgument( |
| + 1, |
| + "reason", |
| + const_cast<char*>(DeoptReasonToCString(deopt_reason()))); |
| + timeline_event_->FormatArgument( |
| + 2, |
| + "deoptimizationCount", |
| + "%d", |
| + function.deoptimization_counter()); |
| + } |
| + } |
| + |
| if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| OS::PrintErr( |
| "Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n", |
| @@ -126,6 +153,9 @@ DeoptContext::~DeoptContext() { |
| delete[] deferred_objects_; |
| deferred_objects_ = NULL; |
| deferred_objects_count_ = 0; |
| + if (timeline_event_ != NULL) { |
| + timeline_event_->DurationEnd(); |
| + } |
| } |