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

Unified Diff: runtime/vm/thread.h

Issue 1412733008: Switch profiler from isolates to threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index c5f095c3a62300880d273c314d542bd036c4958e..5f2b13e783fe8e0efab6464cfba9a9b0cf34a687 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -92,7 +92,6 @@ class Zone;
CACHED_ADDRESSES_LIST(V) \
struct InterruptedThreadState {
- ThreadId tid;
uintptr_t pc;
uintptr_t csp;
uintptr_t dsp;
@@ -109,8 +108,8 @@ struct InterruptedThreadState {
// * Allocating memory -- Because this takes locks which may already be held,
// resulting in a dead lock.
// * Taking a lock -- See above.
-typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state,
- void* data);
+typedef void (*ThreadInterruptCallback)(Thread* thread,
+ const InterruptedThreadState& state);
// A VM thread; may be executing Dart code or performing helper tasks like
// garbage collection or compilation. The Thread structure associated with
@@ -163,6 +162,12 @@ class Thread {
}
bool IsMutatorThread() const;
+ // Is |this| executing Dart code?
+ bool IsExecutingDartCode() const;
+
+ // Has |this| exited Dart code?
+ bool HasExitedDartCode() const;
+
// The (topmost) CHA for the compilation in this thread.
CHA* cha() const;
void set_cha(CHA* value);
@@ -377,10 +382,15 @@ LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
return join_id_;
}
- void SetThreadInterrupter(ThreadInterruptCallback callback, void* data);
+ // Used to temporarily disable or enable thread interrupts.
+ void DisableThreadInterrupts();
+ void EnableThreadInterrupts();
+ bool ThreadInterruptsEnabled();
+
+ void SetThreadInterruptCallback(ThreadInterruptCallback callback);
- bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback,
- void** data) const;
+ // Returns true if *callback != null.
+ bool GetThreadInterruptCallback(ThreadInterruptCallback* callback) const;
#if defined(DEBUG)
#define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
@@ -425,7 +435,7 @@ LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
const ThreadId id_;
const ThreadId join_id_;
ThreadInterruptCallback thread_interrupt_callback_;
- void* thread_interrupt_data_;
+ uintptr_t thread_interrupt_disabled_;
Isolate* isolate_;
Heap* heap_;
State state_;

Powered by Google App Engine
This is Rietveld 408576698