Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1107)

Unified Diff: runtime/vm/deopt_instructions.cc

Issue 1170503004: Initial Timeline Events (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/deopt_instructions.cc
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
index 0acf361fb8ad0c09aad7ea14bf984cd080e54266..211cb78e6ea475c094424bc0880754c07371dd78 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,19 @@ 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();
+ ASSERT(compiler_stream != NULL);
+ timeline_event_ = compiler_stream->RecordEvent();
+ if (timeline_event_ != NULL) {
+ timeline_event_->DurationBegin(compiler_stream, "Deoptimize");
+ timeline_event_->SetNumArguments(3);
+ }
+ }
+
if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
OS::PrintErr(
"Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n",
@@ -126,6 +141,24 @@ DeoptContext::~DeoptContext() {
delete[] deferred_objects_;
deferred_objects_ = NULL;
deferred_objects_count_ = 0;
+ if (timeline_event_ != NULL) {
+ const Code& code = Code::Handle(zone(), code_);
+ const Function& function = Function::Handle(zone(), code.function());
+ timeline_event_->CopyArgument(
+ 0,
+ "function",
+ const_cast<char*>(function.QualifiedUserVisibleNameCString()));
+ timeline_event_->CopyArgument(
+ 1,
+ "reason",
+ const_cast<char*>(DeoptReasonToCString(deopt_reason())));
+ timeline_event_->FormatArgument(
+ 2,
+ "deoptimizationCount",
+ "%d",
+ function.deoptimization_counter());
+ timeline_event_->DurationEnd();
+ }
}
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698