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

Unified Diff: runtime/vm/deopt_instructions.cc

Issue 1514653002: - Assert that we do not hold the timeline lock while entering (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
Index: runtime/vm/deopt_instructions.cc
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
index 134d85cbb1a4ac2681752c4145cf7127ace7b12d..658e973b1ead281d5ed2c54d858f79525435d1e1 100644
--- a/runtime/vm/deopt_instructions.cc
+++ b/runtime/vm/deopt_instructions.cc
@@ -43,7 +43,7 @@ DeoptContext::DeoptContext(const StackFrame* frame,
deopt_reason_(ICData::kDeoptUnknown),
deopt_flags_(0),
thread_(Thread::Current()),
- timeline_event_(NULL),
+ deopt_start_micros_(0),
deferred_slots_(NULL),
deferred_objects_count_(0),
deferred_objects_(NULL),
@@ -99,14 +99,7 @@ DeoptContext::DeoptContext(const StackFrame* frame,
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->StartEvent();
- if (timeline_event_ != NULL) {
- timeline_event_->DurationBegin("Deoptimize");
- timeline_event_->SetNumArguments(3);
- }
+ deopt_start_micros_ = OS::GetCurrentMonotonicMicros();
}
if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
@@ -143,24 +136,28 @@ 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();
- timeline_event_->Complete();
+ if (deopt_start_micros_ != 0) {
+ Isolate* isolate = Isolate::Current();
+ TimelineStream* compiler_stream = isolate->GetCompilerStream();
+ ASSERT(compiler_stream != NULL);
+ if (compiler_stream->Enabled()) {
+ const Code& code = Code::Handle(zone(), code_);
+ const Function& function = Function::Handle(zone(), code.function());
+ const char* function_name = function.QualifiedUserVisibleNameCString();
+ const char* reason = DeoptReasonToCString(deopt_reason());
+ int counter = function.deoptimization_counter();
+ TimelineEvent* timeline_event = compiler_stream->StartEvent();
+ if (timeline_event != NULL) {
+ timeline_event->Duration("Deoptimize",
+ deopt_start_micros_,
+ OS::GetCurrentMonotonicMicros());
+ timeline_event->SetNumArguments(3);
+ timeline_event->CopyArgument(0, "function", function_name);
+ timeline_event->CopyArgument(1, "reason", reason);
+ timeline_event->FormatArgument(2, "deoptimizationCount", "%d", counter);
+ timeline_event->Complete();
+ }
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698