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

Side by Side Diff: runtime/vm/thread.cc

Issue 2646443005: Track async causal stack traces (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/thread.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/compiler_stats.h" 7 #include "vm/compiler_stats.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 Thread::Thread(Isolate* isolate) 63 Thread::Thread(Isolate* isolate)
64 : BaseThread(false), 64 : BaseThread(false),
65 stack_limit_(0), 65 stack_limit_(0),
66 stack_overflow_flags_(0), 66 stack_overflow_flags_(0),
67 isolate_(NULL), 67 isolate_(NULL),
68 heap_(NULL), 68 heap_(NULL),
69 top_exit_frame_info_(0), 69 top_exit_frame_info_(0),
70 store_buffer_block_(NULL), 70 store_buffer_block_(NULL),
71 vm_tag_(0), 71 vm_tag_(0),
72 task_kind_(kUnknownTask), 72 task_kind_(kUnknownTask),
73 async_stack_trace_(StackTrace::null()),
73 dart_stream_(NULL), 74 dart_stream_(NULL),
74 os_thread_(NULL), 75 os_thread_(NULL),
75 thread_lock_(new Monitor()), 76 thread_lock_(new Monitor()),
76 zone_(NULL), 77 zone_(NULL),
77 current_thread_memory_(0), 78 current_thread_memory_(0),
78 memory_high_watermark_(0), 79 memory_high_watermark_(0),
79 api_reusable_scope_(NULL), 80 api_reusable_scope_(NULL),
80 api_top_scope_(NULL), 81 api_top_scope_(NULL),
81 top_resource_(NULL), 82 top_resource_(NULL),
82 long_jump_base_(NULL), 83 long_jump_base_(NULL),
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return "kMarkerTask"; 297 return "kMarkerTask";
297 case kFinalizerTask: 298 case kFinalizerTask:
298 return "kFinalizerTask"; 299 return "kFinalizerTask";
299 default: 300 default:
300 UNREACHABLE(); 301 UNREACHABLE();
301 return ""; 302 return "";
302 } 303 }
303 } 304 }
304 305
305 306
307 RawStackTrace* Thread::async_stack_trace() const {
308 return async_stack_trace_;
309 }
310
311
312 void Thread::set_async_stack_trace(const StackTrace& stack_trace) {
313 ASSERT(!stack_trace.IsNull());
314 async_stack_trace_ = stack_trace.raw();
315 }
316
317
318 void Thread::set_raw_async_stack_trace(RawStackTrace* raw_stack_trace) {
319 async_stack_trace_ = raw_stack_trace;
320 }
321
322
323 void Thread::clear_async_stack_trace() {
324 async_stack_trace_ = StackTrace::null();
325 }
326
327
306 bool Thread::EnterIsolate(Isolate* isolate) { 328 bool Thread::EnterIsolate(Isolate* isolate) {
307 const bool kIsMutatorThread = true; 329 const bool kIsMutatorThread = true;
308 Thread* thread = isolate->ScheduleThread(kIsMutatorThread); 330 Thread* thread = isolate->ScheduleThread(kIsMutatorThread);
309 if (thread != NULL) { 331 if (thread != NULL) {
310 ASSERT(thread->store_buffer_block_ == NULL); 332 ASSERT(thread->store_buffer_block_ == NULL);
311 thread->task_kind_ = kMutatorTask; 333 thread->task_kind_ = kMutatorTask;
312 thread->StoreBufferAcquire(); 334 thread->StoreBufferAcquire();
313 return true; 335 return true;
314 } 336 }
315 return false; 337 return false;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 zone_->VisitObjectPointers(visitor); 696 zone_->VisitObjectPointers(visitor);
675 } 697 }
676 698
677 // Visit objects in thread specific handles area. 699 // Visit objects in thread specific handles area.
678 reusable_handles_.VisitObjectPointers(visitor); 700 reusable_handles_.VisitObjectPointers(visitor);
679 701
680 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_)); 702 visitor->VisitPointer(reinterpret_cast<RawObject**>(&pending_functions_));
681 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_exception_)); 703 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_exception_));
682 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_stacktrace_)); 704 visitor->VisitPointer(reinterpret_cast<RawObject**>(&active_stacktrace_));
683 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_)); 705 visitor->VisitPointer(reinterpret_cast<RawObject**>(&sticky_error_));
706 visitor->VisitPointer(reinterpret_cast<RawObject**>(&async_stack_trace_));
684 707
685 // Visit the api local scope as it has all the api local handles. 708 // Visit the api local scope as it has all the api local handles.
686 ApiLocalScope* scope = api_top_scope_; 709 ApiLocalScope* scope = api_top_scope_;
687 while (scope != NULL) { 710 while (scope != NULL) {
688 scope->local_handles()->VisitObjectPointers(visitor); 711 scope->local_handles()->VisitObjectPointers(visitor);
689 scope = scope->previous(); 712 scope = scope->previous();
690 } 713 }
691 714
692 // Iterate over all the stack frames and visit objects on the stack. 715 // Iterate over all the stack frames and visit objects on the stack.
693 StackFrameIterator frames_iterator(top_exit_frame_info(), validate_frames); 716 StackFrameIterator frames_iterator(top_exit_frame_info(), validate_frames);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 908
886 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { 909 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() {
887 if (thread() != NULL) { 910 if (thread() != NULL) {
888 OSThread* os_thread = thread()->os_thread(); 911 OSThread* os_thread = thread()->os_thread();
889 ASSERT(os_thread != NULL); 912 ASSERT(os_thread != NULL);
890 os_thread->EnableThreadInterrupts(); 913 os_thread->EnableThreadInterrupts();
891 } 914 }
892 } 915 }
893 916
894 } // namespace dart 917 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698