Undo rollout in r217638 with bug fix
https://bugs.webkit.org/show_bug.cgi?id=172824

Unreviewed, reland patch with unused set_state code removed.


Source/JavaScriptCore:

* API/tests/ExecutionTimeLimitTest.cpp:
(dispatchTermitateCallback):
(testExecutionTimeLimit):
* runtime/JSLock.cpp:
(JSC::JSLock::didAcquireLock):
* runtime/Options.cpp:
(JSC::overrideDefaults):
(JSC::Options::initialize):
* runtime/Options.h:
* runtime/VMTraps.cpp:
(JSC::SignalContext::SignalContext):
(JSC::SignalContext::adjustPCToPointToTrappingInstruction):
(JSC::installSignalHandler):
(JSC::VMTraps::SignalSender::send):
* tools/SigillCrashAnalyzer.cpp:
(JSC::SignalContext::SignalContext):
(JSC::SignalContext::dump):
(JSC::installCrashHandler):
* wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::compileFunctions):
* wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
(JSC::Wasm::enableFastMemory):
* wasm/WasmMachineThreads.cpp:
(JSC::Wasm::resetInstructionCacheOnAllThreads):

Source/WTF:

* Configurations/WTF.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
(WTF::registersFromUContext):
* wtf/StackBounds.h:
(WTF::StackBounds::StackBounds):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageUsingSignal):
(WTF::sendMessageUsingMach):
(WTF::deliverMessagesUsingMach):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h:
(WTF::sendMessage):
* wtf/Threading.h:
(WTF::Thread::machThread):
* wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
* wtf/threads/Signals.cpp:
(WTF::startMachExceptionHandlerThread):
(WTF::fromMachException):
(WTF::toMachMask):
(WTF::handleSignalsWithMach):
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::unregisterThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::jscSignalHandler):
* wtf/threads/Signals.h:

Tools:

* TestWebKitAPI/Tests/WTF/ThreadMessages.cpp:
(runThreadMessageTest):
(TEST):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@217669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
index 1dd0cd1..b1b598d 100644
--- a/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
+++ b/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
@@ -242,7 +242,7 @@
         ASSERT(validateFunction(functionStart, functionLength, signature, m_moduleInformation.get()));
 
         m_unlinkedWasmToWasmCalls[functionIndex] = Vector<UnlinkedWasmToWasmCall>();
-        TierUpCount* tierUp = &m_tierUpCounts[functionIndex];
+        TierUpCount* tierUp = Options::useBBQTierUpChecks() ? &m_tierUpCounts[functionIndex] : nullptr;
         auto parseAndCompileResult = parseAndCompile(m_compilationContexts[functionIndex], functionStart, functionLength, signature, m_unlinkedWasmToWasmCalls[functionIndex], m_moduleInformation.get(), m_mode, CompilationMode::BBQMode, functionIndex, tierUp);
 
         if (UNLIKELY(!parseAndCompileResult)) {