Diff
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/ChangeLog (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/ChangeLog 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/ChangeLog 2017-07-12 22:35:47 UTC (rev 219429)
@@ -1,3 +1,21 @@
+2017-07-12 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r219427. rdar://problem/33275032
+
+ 2017-07-12 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r219176.
+ https://bugs.webkit.org/show_bug.cgi?id=174436
+
+ "Can cause infinite recursion on iOS" (Requested by mlam on
+ #webkit).
+
+ Reverted changeset:
+
+ "WTF::Thread should have the threads stack bounds."
+ https://bugs.webkit.org/show_bug.cgi?id=173975
+ http://trac.webkit.org/changeset/219176
+
2017-06-29 Dean Jackson <d...@apple.com>
Disable some features on this release branch.
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -239,6 +239,9 @@
MachineThreads::MachineThread::MachineThread()
: m_thread(WTF::Thread::current())
{
+ auto stackBounds = wtfThreadData().stack();
+ m_stackBase = stackBounds.origin();
+ m_stackEnd = stackBounds.end();
}
size_t MachineThreads::MachineThread::getRegisters(MachineThread::Registers& registers)
@@ -299,7 +302,7 @@
std::pair<void*, size_t> MachineThreads::MachineThread::captureStack(void* stackTop)
{
- char* begin = reinterpret_cast_ptr<char*>(stackBase());
+ char* begin = reinterpret_cast_ptr<char*>(m_stackBase);
char* end = bitwise_cast<char*>(WTF::roundUpToMultipleOf<sizeof(void*)>(reinterpret_cast<uintptr_t>(stackTop)));
ASSERT(begin >= end);
@@ -306,8 +309,8 @@
char* endWithRedZone = end + osRedZoneAdjustment();
ASSERT(WTF::roundUpToMultipleOf<sizeof(void*)>(reinterpret_cast<uintptr_t>(endWithRedZone)) == reinterpret_cast<uintptr_t>(endWithRedZone));
- if (endWithRedZone < stackEnd())
- endWithRedZone = reinterpret_cast_ptr<char*>(stackEnd());
+ if (endWithRedZone < m_stackEnd)
+ endWithRedZone = reinterpret_cast_ptr<char*>(m_stackEnd);
std::swap(begin, endWithRedZone);
return std::make_pair(begin, endWithRedZone - begin);
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/heap/MachineStackMarker.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -72,10 +72,12 @@
std::pair<void*, size_t> captureStack(void* stackTop);
WTF::ThreadIdentifier threadID() const { return m_thread->id(); }
- void* stackBase() const { return m_thread->stack().origin(); }
- void* stackEnd() const { return m_thread->stack().end(); }
+ void* stackBase() const { return m_stackBase; }
+ void* stackEnd() const { return m_stackEnd; }
Ref<WTF::Thread> m_thread;
+ void* m_stackBase;
+ void* m_stackEnd;
MachineThread* m_next { nullptr };
MachineThread* m_prev { nullptr };
};
@@ -102,7 +104,7 @@
#define DECLARE_AND_COMPUTE_CURRENT_THREAD_STATE(stateName) \
CurrentThreadState stateName; \
stateName.stackTop = &stateName; \
- stateName.stackOrigin = Thread::current().stack().origin(); \
+ stateName.stackOrigin = wtfThreadData().stack().origin(); \
ALLOCATE_AND_GET_REGISTER_STATE(stateName ## _registerState); \
stateName.registerState = &stateName ## _registerState
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/InitializeThreading.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/InitializeThreading.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/InitializeThreading.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -75,7 +75,8 @@
DisallowVMReentry::initialize();
#endif
initializeSuperSampler();
- wtfThreadData().setSavedLastStackTop(Thread::current().stack().origin());
+ WTFThreadData& threadData = wtfThreadData();
+ threadData.setSavedLastStackTop(threadData.stack().origin());
#if ENABLE(WEBASSEMBLY)
Wasm::Thunks::initialize();
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -211,7 +211,7 @@
, m_shadowChicken(std::make_unique<ShadowChicken>())
{
interpreter = new Interpreter(*this);
- StackBounds stack = Thread::current().stack();
+ StackBounds stack = wtfThreadData().stack();
updateSoftReservedZoneSize(Options::softReservedZoneSize());
setLastStackTop(stack.origin());
@@ -671,7 +671,7 @@
void* lastSoftStackLimit = m_softStackLimit;
#endif
- const StackBounds& stack = Thread::current().stack();
+ const StackBounds& stack = wtfThreadData().stack();
size_t reservedZoneSize = Options::reservedZoneSize();
// We should have already ensured that Options::reservedZoneSize() >= minimumReserveZoneSize at
// options initialization time, and the option value should not have been changed thereafter.
@@ -885,9 +885,9 @@
#if ENABLE(JIT)
// When using the C stack, we don't know how many stack pages are actually
// committed. So, we use the current stack usage as an estimate.
- ASSERT(Thread::current().stack().isGrowingDownward());
+ ASSERT(wtfThreadData().stack().isGrowingDownward());
int8_t* current = reinterpret_cast<int8_t*>(¤t);
- int8_t* high = reinterpret_cast<int8_t*>(Thread::current().stack().origin());
+ int8_t* high = reinterpret_cast<int8_t*>(wtfThreadData().stack().origin());
return high - current;
#else
return CLoopStack::committedByteCount();
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VM.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -689,7 +689,7 @@
bool isSafeToRecurse(void* stackLimit) const
{
- ASSERT(Thread::current().stack().isGrowingDownward());
+ ASSERT(wtfThreadData().stack().isGrowingDownward());
void* curr = reinterpret_cast<void*>(&curr);
return curr >= stackLimit;
}
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMEntryScope.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMEntryScope.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMEntryScope.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -41,7 +41,7 @@
, m_globalObject(globalObject)
{
ASSERT(!DisallowVMReentry::isInEffectOnCurrentThread());
- ASSERT(Thread::current().stack().isGrowingDownward());
+ ASSERT(wtfThreadData().stack().isGrowingDownward());
if (!vm.entryScope) {
vm.entryScope = this;
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMInlines.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMInlines.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMInlines.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -34,7 +34,7 @@
bool VM::ensureStackCapacityFor(Register* newTopOfStack)
{
#if ENABLE(JIT)
- ASSERT(Thread::current().stack().isGrowingDownward());
+ ASSERT(wtfThreadData().stack().isGrowingDownward());
return newTopOfStack >= m_softStackLimit;
#else
return ensureStackCapacityForCLoop(newTopOfStack);
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMTraps.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMTraps.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/runtime/VMTraps.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -267,7 +267,25 @@
return;
Thread& thread = *ownerThread->get();
- vm.traps().tryInstallTrapBreakpoints(context, thread.stack());
+ StackBounds stackBounds = StackBounds::emptyBounds();
+ {
+ // FIXME: We need to use the machine threads because it is the only non-TLS source
+ // for the stack bounds of this thread. We should keep in on the WTF::Thread instead.
+ // see: https://bugs.webkit.org/show_bug.cgi?id=173975
+ MachineThreads& machineThreads = vm.heap.machineThreads();
+ auto machineThreadsLock = tryHoldLock(machineThreads.getLock());
+ if (!machineThreadsLock)
+ return; // Try again later.
+
+ auto& threadList = machineThreads.threadsListHead(machineThreadsLock);
+ for (MachineThreads::MachineThread* machineThread = threadList.head(); machineThread; machineThread = machineThread->next()) {
+ if (machineThread->m_thread.get() == thread)
+ stackBounds = StackBounds(machineThread->stackBase(), machineThread->stackEnd());
+ }
+ RELEASE_ASSERT(!stackBounds.isEmpty());
+ }
+
+ vm.traps().tryInstallTrapBreakpoints(context, stackBounds);
});
}
Modified: branches/safari-604.1.31-branch/Source/_javascript_Core/yarr/YarrPattern.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/_javascript_Core/yarr/YarrPattern.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/_javascript_Core/yarr/YarrPattern.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -880,7 +880,7 @@
{
if (!m_stackLimit)
return true;
- ASSERT(Thread::current().stack().isGrowingDownward());
+ ASSERT(wtfThreadData().stack().isGrowingDownward());
int8_t* curr = reinterpret_cast<int8_t*>(&curr);
int8_t* limit = reinterpret_cast<int8_t*>(m_stackLimit);
return curr >= limit;
Modified: branches/safari-604.1.31-branch/Source/WTF/ChangeLog (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/ChangeLog 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/ChangeLog 2017-07-12 22:35:47 UTC (rev 219429)
@@ -1,3 +1,21 @@
+2017-07-12 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r219427. rdar://problem/33275032
+
+ 2017-07-12 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r219176.
+ https://bugs.webkit.org/show_bug.cgi?id=174436
+
+ "Can cause infinite recursion on iOS" (Requested by mlam on
+ #webkit).
+
+ Reverted changeset:
+
+ "WTF::Thread should have the threads stack bounds."
+ https://bugs.webkit.org/show_bug.cgi?id=173975
+ http://trac.webkit.org/changeset/219176
+
2017-07-12 Yusuke Suzuki <utatane....@gmail.com>
Unreviewed, attempt to fix Windows build
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/StackBounds.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/StackBounds.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/StackBounds.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -40,7 +40,7 @@
const static size_t s_defaultAvailabilityDelta = 64 * 1024;
public:
- static constexpr StackBounds emptyBounds() { return StackBounds(); }
+ static StackBounds emptyBounds() { return StackBounds(); }
static StackBounds currentThreadStackBounds()
{
@@ -127,9 +127,9 @@
}
private:
- constexpr StackBounds()
- : m_origin(nullptr)
- , m_bound(nullptr)
+ StackBounds()
+ : m_origin(0)
+ , m_bound(0)
{
}
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/StackStats.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/StackStats.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/StackStats.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -59,7 +59,7 @@
StackStats::PerThreadStats::PerThreadStats()
{
- const StackBounds& stack = Thread::current().stack();
+ const StackBounds& stack = wtfThreadData().stack();
m_reentryDepth = 0;
m_stackStart = (char*)stack.origin();
m_currentCheckPoint = 0;
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -46,16 +46,12 @@
namespace WTF {
-enum class Stage {
- Start, Initialized
-};
-
struct NewThreadContext {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
const char* name;
Function<void()> entryPoint;
- Stage stage;
- Mutex mutex;
- ThreadCondition condition;
+ Mutex creationMutex;
};
const char* Thread::normalizeThreadName(const char* threadName)
@@ -88,48 +84,33 @@
static void threadEntryPoint(void* contextData)
{
NewThreadContext* context = static_cast<NewThreadContext*>(contextData);
- Function<void()> entryPoint;
+
+ // Block until our creating thread has completed any extra setup work, including
+ // establishing ThreadIdentifier.
{
- // Block until our creating thread has completed any extra setup work, including establishing ThreadIdentifier.
- MutexLocker locker(context->mutex);
+ MutexLocker locker(context->creationMutex);
+ }
- Thread::initializeCurrentThreadInternal(context->name);
- entryPoint = WTFMove(context->entryPoint);
+ Thread::initializeCurrentThreadInternal(context->name);
- // Ack completion of initialization to the creating thread.
- context->stage = Stage::Initialized;
- context->condition.signal();
- }
+ auto entryPoint = WTFMove(context->entryPoint);
+ // Delete the context before starting the thread.
+ delete context;
+
entryPoint();
}
RefPtr<Thread> Thread::create(const char* name, Function<void()>&& entryPoint)
{
- NewThreadContext context { name, WTFMove(entryPoint), Stage::Start, { }, { } };
+ NewThreadContext* context = new NewThreadContext { name, WTFMove(entryPoint), { } };
- MutexLocker locker(context.mutex);
- RefPtr<Thread> result = Thread::createInternal(threadEntryPoint, &context, name);
- // After establishing Thread, release the mutex and wait for completion of initialization.
- while (context.stage != Stage::Initialized)
- context.condition.wait(context.mutex);
+ // Prevent the thread body from executing until we've established the thread identifier.
+ MutexLocker locker(context->creationMutex);
- return result;
+ return Thread::createInternal(threadEntryPoint, context, name);
}
-Thread* Thread::currentMayBeNull()
-{
- ThreadHolder* data = ""
- if (data)
- return &data->thread();
- return nullptr;
-}
-
-void Thread::initialize()
-{
- m_stack = StackBounds::currentThreadStackBounds();
-}
-
void Thread::didExit()
{
std::lock_guard<std::mutex> locker(m_mutex);
@@ -185,6 +166,9 @@
static std::once_flag initializeKey;
std::call_once(initializeKey, [] {
ThreadHolder::initializeOnce();
+ // StringImpl::empty() does not construct its static string in a threadsafe fashion,
+ // so ensure it has been initialized from here.
+ StringImpl::empty();
initializeRandomNumberGenerator();
wtfThreadData();
initializeDates();
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/Threading.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -38,7 +38,6 @@
#include <wtf/Function.h>
#include <wtf/PlatformRegisters.h>
#include <wtf/RefPtr.h>
-#include <wtf/StackBounds.h>
#include <wtf/ThreadSafeRefCounted.h>
#if USE(PTHREADS) && !OS(DARWIN)
@@ -68,7 +67,7 @@
// Returns Thread object.
WTF_EXPORT_PRIVATE static Thread& current();
- static Thread* currentMayBeNull();
+ WTF_EXPORT_PRIVATE static Thread* currentMayBeNull();
// Returns ThreadIdentifier directly. It is useful if the user only cares about identity
// of threads. At that time, users should know that holding this ThreadIdentifier does not ensure
@@ -109,7 +108,6 @@
// Called in the thread during initialization.
// Helpful for platforms where the thread name must be set from within the thread.
static void initializeCurrentThreadInternal(const char* threadName);
- static void initializeCurrentThreadEvenIfNonWTFCreated();
WTF_EXPORT_PRIVATE void dump(PrintStream& out) const;
@@ -127,11 +125,6 @@
static void initializePlatformThreading();
- const StackBounds& stack() const
- {
- return m_stack;
- }
-
#if OS(DARWIN)
mach_port_t machThread() { return m_platformThread; }
#endif
@@ -147,7 +140,6 @@
#else
void establish(HANDLE, ThreadIdentifier);
#endif
- void initialize();
#if USE(PTHREADS) && !OS(DARWIN)
static void signalHandlerSuspendResume(int, siginfo_t*, void* ucontext);
@@ -179,7 +171,6 @@
std::mutex m_mutex;
ThreadIdentifier m_id { 0 };
JoinableState m_joinableState { Joinable };
- StackBounds m_stack { StackBounds::emptyBounds() };
bool m_didExit { false };
#if USE(PTHREADS)
pthread_t m_handle;
@@ -199,7 +190,9 @@
#endif
};
-// This function can be called from any threads.
+// This function must be called from the main thread. It is safe to call it repeatedly.
+// Darwin is an exception to this rule: it is OK to call it from any thread, the only
+// requirement is that the calls are not reentrant.
WTF_EXPORT_PRIVATE void initializeThreading();
inline ThreadIdentifier currentThread()
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingPthreads.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingPthreads.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingPthreads.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -188,9 +188,8 @@
#endif
}
-void Thread::initializeCurrentThreadEvenIfNonWTFCreated()
+static void initializeCurrentThreadEvenIfNonWTFCreated()
{
- Thread::current().initialize();
#if !OS(DARWIN)
sigset_t mask;
sigemptyset(&mask);
@@ -300,6 +299,14 @@
didBecomeDetached();
}
+Thread* Thread::currentMayBeNull()
+{
+ ThreadHolder* data = ""
+ if (data)
+ return &data->thread();
+ return nullptr;
+}
+
Thread& Thread::current()
{
if (Thread* current = currentMayBeNull())
@@ -306,11 +313,11 @@
return *current;
// Not a WTF-created thread, ThreadIdentifier is not established yet.
- Ref<Thread> thread = adoptRef(*new Thread());
+ RefPtr<Thread> thread = adoptRef(new Thread());
thread->establish(pthread_self());
- ThreadHolder::initialize(thread.get());
+ ThreadHolder::initialize(*thread);
initializeCurrentThreadEvenIfNonWTFCreated();
- return thread.get();
+ return *thread;
}
ThreadIdentifier Thread::currentID()
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingWin.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingWin.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/ThreadingWin.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -116,11 +116,6 @@
CloseHandle(m_handle);
}
-void Thread::initializeCurrentThreadEvenIfNonWTFCreated()
-{
- Thread::current().initialize();
-}
-
// MS_VC_EXCEPTION, THREADNAME_INFO, and setThreadNameInternal all come from <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>.
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
@@ -150,7 +145,6 @@
} __except (EXCEPTION_CONTINUE_EXECUTION) {
}
#endif
- initializeCurrentThreadEvenIfNonWTFCreated();
}
void Thread::initializePlatformThreading()
@@ -267,8 +261,9 @@
Thread& Thread::current()
{
- if (Thread* current = currentMayBeNull())
- return *current;
+ ThreadHolder* data = ""
+ if (data)
+ return data->thread();
// Not a WTF-created thread, ThreadIdentifier is not established yet.
Ref<Thread> thread = adoptRef(*new Thread());
@@ -279,7 +274,6 @@
thread->establish(handle, currentID());
ThreadHolder::initialize(thread.get(), Thread::currentID());
- initializeCurrentThreadEvenIfNonWTFCreated();
return thread.get();
}
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.cpp (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.cpp 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.cpp 2017-07-12 22:35:47 UTC (rev 219429)
@@ -44,11 +44,12 @@
, m_currentAtomicStringTable(0)
, m_defaultAtomicStringTable(0)
, m_atomicStringTableDestructor(0)
+ , m_stackBounds(StackBounds::currentThreadStackBounds())
#if ENABLE(STACK_STATS)
, m_stackStats()
#endif
, m_savedStackPointerAtVMEntry(0)
- , m_savedLastStackTop(Thread::current().stack().origin())
+ , m_savedLastStackTop(stack().origin())
{
AtomicStringTable::create(*this);
m_currentAtomicStringTable = m_defaultAtomicStringTable;
Modified: branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.h (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.h 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WTF/wtf/WTFThreadData.h 2017-07-12 22:35:47 UTC (rev 219429)
@@ -29,6 +29,7 @@
#include <wtf/FastTLS.h>
#include <wtf/Noncopyable.h>
+#include <wtf/StackBounds.h>
#include <wtf/StackStats.h>
#include <wtf/ThreadSpecific.h>
@@ -56,6 +57,16 @@
return oldAtomicStringTable;
}
+ const StackBounds& stack()
+ {
+ // We need to always get a fresh StackBounds from the OS due to how fibers work.
+ // See https://bugs.webkit.org/show_bug.cgi?id=102411
+#if OS(WINDOWS)
+ m_stackBounds = StackBounds::currentThreadStackBounds();
+#endif
+ return m_stackBounds;
+ }
+
#if ENABLE(STACK_STATS)
StackStats::PerThreadStats& stackStats()
{
@@ -90,6 +101,7 @@
AtomicStringTable* m_defaultAtomicStringTable;
AtomicStringTableDestructor m_atomicStringTableDestructor;
+ StackBounds m_stackBounds;
#if ENABLE(STACK_STATS)
StackStats::PerThreadStats m_stackStats;
#endif
Modified: branches/safari-604.1.31-branch/Source/WebCore/ChangeLog (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WebCore/ChangeLog 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WebCore/ChangeLog 2017-07-12 22:35:47 UTC (rev 219429)
@@ -1,3 +1,21 @@
+2017-07-12 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r219427. rdar://problem/33275032
+
+ 2017-07-12 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r219176.
+ https://bugs.webkit.org/show_bug.cgi?id=174436
+
+ "Can cause infinite recursion on iOS" (Requested by mlam on
+ #webkit).
+
+ Reverted changeset:
+
+ "WTF::Thread should have the threads stack bounds."
+ https://bugs.webkit.org/show_bug.cgi?id=173975
+ http://trac.webkit.org/changeset/219176
+
2017-06-29 Dean Jackson <d...@apple.com>
Disable some features on this release branch.
Modified: branches/safari-604.1.31-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm (219428 => 219429)
--- branches/safari-604.1.31-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm 2017-07-12 22:31:45 UTC (rev 219428)
+++ branches/safari-604.1.31-branch/Source/WebCore/platform/ios/wak/WebCoreThread.mm 2017-07-12 22:35:47 UTC (rev 219429)
@@ -702,17 +702,14 @@
{
webThreadStarted = TRUE;
- // ThreadGlobalData touches AtomicString, which requires WTFThreadData and Threading initialization.
- WTF::initializeThreading();
-
- // Initialize AtomicString on the main thread.
- WTF::AtomicString::init();
-
// Initialize ThreadGlobalData on the main UI thread so that the WebCore thread
// can later set it's thread-specific data to point to the same objects.
WebCore::ThreadGlobalData& unused = WebCore::threadGlobalData();
(void)unused;
+ // Initialize AtomicString on the main thread.
+ WTF::AtomicString::init();
+
RunLoop::initializeMainRunLoop();
// register class for WebThread deallocation