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

Unified Diff: runtime/vm/thread.h

Issue 1423473004: Switch profiler from isolates to threads [second landing] (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/stub_code.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index c5f095c3a62300880d273c314d542bd036c4958e..9bba418a5d6d8998bcfc8619c2256641a25085e6 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,10 @@ LEAF_RUNTIME_ENTRY_LIST(DEFINE_OFFSET_METHOD)
return join_id_;
}
- void SetThreadInterrupter(ThreadInterruptCallback callback, void* data);
-
- bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback,
- void** data) const;
+ // Used to temporarily disable or enable thread interrupts.
+ void DisableThreadInterrupts();
+ void EnableThreadInterrupts();
+ bool ThreadInterruptsEnabled();
#if defined(DEBUG)
#define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
@@ -424,8 +429,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_;
@@ -542,6 +546,14 @@ class ThreadIterator : public ValueObject {
void WindowsThreadCleanUp();
#endif
+
+// Disable thread interrupts.
+class DisableThreadInterruptsScope : public StackResource {
+ public:
+ explicit DisableThreadInterruptsScope(Thread* thread);
+ ~DisableThreadInterruptsScope();
+};
+
} // namespace dart
#endif // VM_THREAD_H_
« no previous file with comments | « runtime/vm/stub_code.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698