Index: Source/heap/ThreadState.h |
diff --git a/Source/heap/ThreadState.h b/Source/heap/ThreadState.h |
index 2f92dbd49c344d8cf8f1ceb07827083630681468..c5e5ac32d2737d6b48023c85d1a0346ac1005976 100644 |
--- a/Source/heap/ThreadState.h |
+++ b/Source/heap/ThreadState.h |
@@ -52,7 +52,7 @@ enum ThreadAffinity { |
// By default all types are considered to be used on the main thread only. |
template<typename T> |
struct ThreadingTrait { |
- static const ThreadAffinity Affinity = MainThreadOnly; |
+ static const ThreadAffinity Affinity = AnyThread; |
}; |
// Marks specified class as requiring thread safe handles which can be used from any thread. |
@@ -225,7 +225,13 @@ public: |
static void attach(intptr_t* startOfStack); |
static void detach(); |
- static ThreadState* Current() { return **s_threadSpecific; } |
+ static ThreadState* Current() |
+ { |
+ // intptr_t dummy; |
+ // if (LIKELY(s_mainThreadStackTop < &dummy && &dummy <= s_mainThreadStackBottom)) |
+ // return MainThreadState(); |
+ return **s_threadSpecific; |
+ } |
static ThreadState* MainThreadState() { return &s_mainThreadState; } |
static bool IsMainThread() { return Current() == MainThreadState(); } |
@@ -274,6 +280,8 @@ public: |
Interruptor* interruptor() const { return m_interruptor; } |
private: |
+ static intptr_t* s_mainThreadStackBottom; |
+ static intptr_t* s_mainThreadStackTop; |
static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; |
static ThreadState s_mainThreadState; |
static SafePointBarrier* s_safePointBarrier; |