Diff
Modified: trunk/ChangeLog (271774 => 271775)
--- trunk/ChangeLog 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/ChangeLog 2021-01-23 12:32:22 UTC (rev 271775)
@@ -1,3 +1,16 @@
+2021-01-23 Xan Lopez <[email protected]>
+
+ [JSC] Allow to build WebAssembly without B3
+ https://bugs.webkit.org/show_bug.cgi?id=220365
+
+ Reviewed by Yusuke Suzuki.
+
+ Make the WebAssembly feature depend on Baseline JIT, not B3
+ JIT. Also add a WEBASSEMBLY_B3JIT feature to enable or disable the
+ B3 tier in WebAssembly.
+
+ * Source/cmake/WebKitFeatures.cmake: disable on 32bit.
+
2021-01-21 Fujii Hironori <[email protected]>
Remove ENABLE_USERSELECT_ALL macro which is enabled for all ports
Modified: trunk/Source/_javascript_Core/ChangeLog (271774 => 271775)
--- trunk/Source/_javascript_Core/ChangeLog 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-01-23 12:32:22 UTC (rev 271775)
@@ -1,3 +1,46 @@
+2021-01-23 Xan Lopez <[email protected]>
+
+ [JSC] Allow to build WebAssembly without B3
+ https://bugs.webkit.org/show_bug.cgi?id=220365
+
+ Reviewed by Yusuke Suzuki.
+
+ Make all the B3 related code in WebAssembly a compile-time
+ option. When disabled WebAssembly will only use its LLInt tier.
+
+ * llint/LLIntOfflineAsmConfig.h: define WEBASSEMBLY_B3JIT for the
+ offline assembler.
+ * llint/WebAssembly.asm: guard B3 code inside WEBASSEMBLY_B3JTI ifdefs.
+ * wasm/WasmAirIRGenerator.cpp: ditto.
+ * wasm/WasmAirIRGenerator.h: ditto.
+ * wasm/WasmB3IRGenerator.cpp: ditto.
+ * wasm/WasmB3IRGenerator.h: ditto.
+ * wasm/WasmBBQPlan.cpp: ditto.
+ * wasm/WasmBBQPlan.h: ditto.
+ * wasm/WasmCallee.h: ditto.
+ * wasm/WasmCodeBlock.cpp:
+ (JSC::Wasm::CodeBlock::CodeBlock): ditto.
+ * wasm/WasmCodeBlock.h:
+ (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): ditto.
+ * wasm/WasmLLIntGenerator.h: ditto.
+ * wasm/WasmLLIntPlan.cpp: ditto.
+ * wasm/WasmOMGForOSREntryPlan.cpp: ditto.
+ * wasm/WasmOMGForOSREntryPlan.h: ditto.
+ * wasm/WasmOMGPlan.cpp: ditto.
+ * wasm/WasmOMGPlan.h: ditto.
+ * wasm/WasmOSREntryData.h: ditto.
+ * wasm/WasmOperations.cpp: ditto.
+ * wasm/WasmOperations.h: ditto.
+ * wasm/WasmPlan.cpp: ditto.
+ * wasm/WasmPlan.h: ditto.
+ * wasm/WasmSlowPaths.cpp: ditto.
+ * wasm/WasmSlowPaths.h: ditto.
+ * wasm/WasmThunks.cpp: ditto.
+ * wasm/WasmThunks.h: ditto.
+ * wasm/WasmTierUpCount.cpp: ditto.
+ * wasm/WasmTierUpCount.h: ditto.
+ * wasm/generateWasmOpsHeader.py: ditto.
+
2021-01-22 Yusuke Suzuki <[email protected]>
Should SharedArrayBuffer/WebAssembly.Memory really throw?
Modified: trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h (271774 => 271775)
--- trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/llint/LLIntOfflineAsmConfig.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -168,6 +168,12 @@
#define OFFLINE_ASM_WEBASSEMBLY 0
#endif
+#if ENABLE(WEBASSEMBLY_B3JIT)
+#define OFFLINE_ASM_WEBASSEMBLY_B3JIT 1
+#else
+#define OFFLINE_ASM_WEBASSEMBLY_B3JIT 0
+#endif
+
#if HAVE(FAST_TLS)
#define OFFLINE_ASM_HAVE_FAST_TLS 1
#else
Modified: trunk/Source/_javascript_Core/llint/WebAssembly.asm (271774 => 271775)
--- trunk/Source/_javascript_Core/llint/WebAssembly.asm 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/llint/WebAssembly.asm 2021-01-23 12:32:22 UTC (rev 271775)
@@ -119,6 +119,7 @@
end
macro checkSwitchToJITForPrologue(codeBlockRegister)
+ if WEBASSEMBLY_B3JIT
checkSwitchToJIT(
5,
macro()
@@ -148,9 +149,11 @@
.recover:
notFunctionCodeBlockGetter(codeBlockRegister)
end)
+ end
end
macro checkSwitchToJITForLoop()
+ if WEBASSEMBLY_B3JIT
checkSwitchToJIT(
1,
macro()
@@ -174,14 +177,17 @@
.recover:
loadi ArgumentCountIncludingThis + TagOffset[cfr], PC
end)
+ end
end
macro checkSwitchToJITForEpilogue()
+ if WEBASSEMBLY_B3JIT
checkSwitchToJIT(
10,
macro ()
callWasmSlowPath(_slow_path_wasm_epilogue_osr)
end)
+ end
end
# Wasm specific helpers
Modified: trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmAirIRGenerator.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "AirCode.h"
#include "AirGenerate.h"
@@ -4851,4 +4851,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "WasmB3IRGenerator.h"
@@ -35,4 +35,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmB3IRGenerator.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "AirCode.h"
#include "AllowMacroScratchRegisterUsageIf.h"
@@ -64,6 +64,10 @@
#include <wtf/Optional.h>
#include <wtf/StdLibExtras.h>
+#if !ENABLE(WEBASSEMBLY)
+#error ENABLE(WEBASSEMBLY_B3JIT) is enabled, but ENABLE(WEBASSEMBLY) is not.
+#endif
+
void dumpProcedure(void* ptr)
{
JSC::B3::Procedure* proc = static_cast<JSC::B3::Procedure*>(ptr);
@@ -3038,4 +3042,4 @@
#include "WasmB3IRGeneratorInlines.h"
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "B3Common.h"
#include "CCallHelpers.h"
@@ -54,4 +54,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmBBQPlan.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "JITCompilation.h"
#include "JSToWasm.h"
@@ -284,4 +284,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "CompilationResult.h"
#include "WasmB3IRGenerator.h"
@@ -94,4 +94,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmCallee.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmCallee.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmCallee.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -42,7 +42,9 @@
namespace Wasm {
+#if ENABLE(WEBASSEMBLY_B3JIT)
class OMGForOSREntryCallee;
+#endif
class Callee : public ThreadSafeRefCounted<Callee> {
WTF_MAKE_FAST_ALLOCATED;
@@ -57,10 +59,12 @@
virtual RegisterAtOffsetList* calleeSaveRegisters() = 0;
virtual std::tuple<void*, void*> range() const = 0;
+#if ENABLE(WEBASSEMBLY_B3JIT)
virtual void setOSREntryCallee(Ref<OMGForOSREntryCallee>&&)
{
RELEASE_ASSERT_NOT_REACHED();
}
+#endif
void dump(PrintStream&) const;
@@ -95,6 +99,7 @@
Wasm::Entrypoint m_entrypoint;
};
+#if ENABLE(WEBASSEMBLY_B3JIT)
class OMGCallee final : public JITCallee {
public:
static Ref<OMGCallee> create(Wasm::Entrypoint&& entrypoint, size_t index, std::pair<const Name*, RefPtr<NameSection>>&& name, Vector<UnlinkedWasmToWasmCall>&& unlinkedCalls)
@@ -130,6 +135,7 @@
unsigned m_osrEntryScratchBufferSize;
uint32_t m_loopIndex;
};
+#endif
class EmbedderEntrypointCallee final : public JITCallee {
public:
@@ -145,6 +151,7 @@
}
};
+#if ENABLE(WEBASSEMBLY_B3JIT)
class BBQCallee final : public JITCallee {
public:
static Ref<BBQCallee> create(Wasm::Entrypoint&& entrypoint, size_t index, std::pair<const Name*, RefPtr<NameSection>>&& name, std::unique_ptr<TierUpCount>&& tierUpCount, Vector<UnlinkedWasmToWasmCall>&& unlinkedCalls)
@@ -181,6 +188,7 @@
std::unique_ptr<TierUpCount> m_tierUpCount;
bool m_didStartCompilingOSREntryCallee { false };
};
+#endif
class LLIntCallee final : public Callee {
friend LLIntOffsetsExtractor;
@@ -196,6 +204,7 @@
JS_EXPORT_PRIVATE RegisterAtOffsetList* calleeSaveRegisters() final;
JS_EXPORT_PRIVATE std::tuple<void*, void*> range() const final;
+#if ENABLE(WEBASSEMBLY_B3JIT)
JITCallee* replacement() { return m_replacement.get(); }
void setReplacement(Ref<JITCallee>&& replacement)
{
@@ -209,6 +218,7 @@
}
LLIntTierUpCounter& tierUpCounter() { return m_codeBlock->tierUpCounter(); }
+#endif
private:
LLIntCallee(std::unique_ptr<FunctionCodeBlock> codeBlock, size_t index, std::pair<const Name*, RefPtr<NameSection>>&& name)
@@ -218,8 +228,10 @@
RELEASE_ASSERT(m_codeBlock);
}
+#if ENABLE(WEBASSEMBLY_B3JIT)
RefPtr<JITCallee> m_replacement;
RefPtr<OMGForOSREntryCallee> m_osrEntryCallee;
+#endif
std::unique_ptr<FunctionCodeBlock> m_codeBlock;
MacroAssemblerCodePtr<WasmEntryPtrTag> m_entrypoint;
};
Modified: trunk/Source/_javascript_Core/wasm/WasmCodeBlock.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmCodeBlock.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmCodeBlock.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -57,9 +57,11 @@
return;
}
+#if ENABLE(WEBASSEMBLY_B3JIT)
// FIXME: we should eventually collect the BBQ code.
m_bbqCallees.resize(m_calleeCount);
m_omgCallees.resize(m_calleeCount);
+#endif
m_wasmIndirectCallEntryPoints.resize(m_calleeCount);
for (unsigned i = 0; i < m_calleeCount; ++i)
@@ -71,7 +73,9 @@
setCompilationFinished();
})));
- } else {
+ }
+#if ENABLE(WEBASSEMBLY_B3JIT)
+ else {
m_plan = adoptRef(*new BBQPlan(context, makeRef(moduleInformation), EntryPlan::FullCompile, createSharedTask<Plan::CallbackType>([this, protectedThis = WTFMove(protectedThis)] (Plan&) {
auto locker = holdLock(m_lock);
if (m_plan->failed()) {
@@ -101,6 +105,7 @@
setCompilationFinished();
})));
}
+#endif
m_plan->setMode(mode);
auto& worklist = Wasm::ensureWorklist();
Modified: trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmCodeBlock.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -86,18 +86,22 @@
RELEASE_ASSERT(callee);
return *callee;
}
+
Callee& wasmEntrypointCalleeFromFunctionIndexSpace(unsigned functionIndexSpace)
{
ASSERT(runnable());
RELEASE_ASSERT(functionIndexSpace >= functionImportCount());
unsigned calleeIndex = functionIndexSpace - functionImportCount();
+#if ENABLE(WEBASSEMBLY_B3JIT)
if (m_omgCallees[calleeIndex])
return *m_omgCallees[calleeIndex].get();
if (m_bbqCallees[calleeIndex])
return *m_bbqCallees[calleeIndex].get();
+#endif
return m_llintCallees->at(calleeIndex).get();
}
+#if ENABLE(WEBASSEMBLY_B3JIT)
BBQCallee& wasmBBQCalleeFromFunctionIndexSpace(unsigned functionIndexSpace)
{
ASSERT(runnable());
@@ -105,6 +109,7 @@
unsigned calleeIndex = functionIndexSpace - functionImportCount();
return *m_bbqCallees[calleeIndex].get();
}
+#endif
MacroAssemblerCodePtr<WasmEntryPtrTag>* entrypointLoadLocationFromFunctionIndexSpace(unsigned functionIndexSpace)
{
@@ -125,16 +130,20 @@
~CodeBlock();
private:
friend class Plan;
+#if ENABLE(WEBASSEMBLY_B3JIT)
friend class BBQPlan;
friend class OMGPlan;
friend class OMGForOSREntryPlan;
+#endif
CodeBlock(Context*, MemoryMode, ModuleInformation&, RefPtr<LLIntCallees>);
void setCompilationFinished();
unsigned m_calleeCount;
MemoryMode m_mode;
+#if ENABLE(WEBASSEMBLY_B3JIT)
Vector<RefPtr<OMGCallee>> m_omgCallees;
Vector<RefPtr<BBQCallee>> m_bbqCallees;
+#endif
RefPtr<LLIntCallees> m_llintCallees;
HashMap<uint32_t, RefPtr<EmbedderEntrypointCallee>, DefaultHash<uint32_t>, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> m_embedderCallees;
Vector<MacroAssemblerCodePtr<WasmEntryPtrTag>> m_wasmIndirectCallEntryPoints;
Modified: trunk/Source/_javascript_Core/wasm/WasmFormat.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmFormat.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmFormat.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -27,7 +27,6 @@
#if ENABLE(WEBASSEMBLY)
-#include "B3Type.h"
#include "CodeLocation.h"
#include "Identifier.h"
#include "MacroAssemblerCodeRef.h"
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -27,11 +27,14 @@
#if ENABLE(WEBASSEMBLY)
-#include "WasmB3IRGenerator.h"
+#include <wtf/Expected.h>
+#include <wtf/text/WTFString.h>
namespace JSC { namespace Wasm {
class FunctionCodeBlock;
+class Signature;
+struct ModuleInformation;
Expected<std::unique_ptr<FunctionCodeBlock>, String> parseAndCompileBytecode(const uint8_t*, size_t, const Signature&, const ModuleInformation&, uint32_t functionIndex);
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -29,6 +29,7 @@
#if ENABLE(WEBASSEMBLY)
#include "BytecodeDumper.h"
+#include "CCallHelpers.h"
#include "CalleeBits.h"
#include "JITCompilation.h"
#include "JSToWasm.h"
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmOMGForOSREntryPlan.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "JITCompilation.h"
#include "LinkBuffer.h"
@@ -142,4 +142,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "WasmCallee.h"
#include "WasmContext.h"
@@ -71,4 +71,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmOMGPlan.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "JITCompilation.h"
#include "LinkBuffer.h"
@@ -141,4 +141,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "WasmContext.h"
#include "WasmModule.h"
@@ -67,4 +67,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmOSREntryData.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOSREntryData.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOSREntryData.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "B3ValueRep.h"
#include "WasmFormat.h"
@@ -69,4 +69,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -58,6 +58,7 @@
namespace JSC { namespace Wasm {
+#if ENABLE(WEBASSEMBLY_B3JIT)
static bool shouldTriggerOMGCompile(TierUpCount& tierUp, OMGCallee* replacement, uint32_t functionIndex)
{
if (!replacement && !tierUp.checkIfOptimizationThresholdReached()) {
@@ -453,6 +454,7 @@
}
}
}
+#endif
JSC_DEFINE_JIT_OPERATION(operationWasmUnwind, void, (CallFrame* callFrame))
{
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -45,8 +45,10 @@
class Instance;
class Signature;
+#if ENABLE(WEBASSEMBLY_B3JIT)
JSC_DECLARE_JIT_OPERATION(operationWasmTriggerOSREntryNow, void, (Probe::Context&));
JSC_DECLARE_JIT_OPERATION(operationWasmTriggerTierUpNow, void, (Instance*, uint32_t functionIndex));
+#endif
JSC_DECLARE_JIT_OPERATION(operationWasmUnwind, void, (CallFrame*));
JSC_DECLARE_JIT_OPERATION(operationConvertToI64, int64_t, (CallFrame*, JSValue));
Modified: trunk/Source/_javascript_Core/wasm/WasmPlan.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmPlan.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmPlan.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -123,6 +123,7 @@
complete(locker);
}
+#if ENABLE(WEBASSEMBLY_B3JIT)
void Plan::updateCallSitesToCallUs(CodeBlock& codeBlock, CodeLocationLabel<WasmEntryPtrTag> entrypoint, uint32_t functionIndex, uint32_t functionIndexSpace)
{
HashMap<void*, CodeLocationLabel<WasmEntryPtrTag>> stagedCalls;
@@ -187,6 +188,7 @@
}
}
+#endif
Plan::~Plan() { }
Modified: trunk/Source/_javascript_Core/wasm/WasmPlan.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmPlan.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmPlan.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -84,7 +84,9 @@
virtual bool isComplete() const = 0;
virtual void complete(const AbstractLocker&) = 0;
+#if ENABLE(WEBASSEMBLY_B3JIT)
static void updateCallSitesToCallUs(CodeBlock&, CodeLocationLabel<WasmEntryPtrTag> entrypoint, uint32_t functionIndex, uint32_t functionIndexSpace);
+#endif
Ref<ModuleInformation> m_moduleInformation;
Modified: trunk/Source/_javascript_Core/wasm/WasmSlowPaths.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmSlowPaths.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmSlowPaths.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -75,6 +75,7 @@
? JSValue::decode(CODE_BLOCK()->getConstant(virtualRegister)) \
: callFrame->r(virtualRegister))
+#if ENABLE(WEBASSEMBLY_B3JIT)
enum class RequiredWasmJIT { Any, OMG };
inline bool shouldJIT(Wasm::FunctionCodeBlock* codeBlock, RequiredWasmJIT requiredJIT = RequiredWasmJIT::Any)
@@ -254,8 +255,8 @@
jitCompileAndSetHeuristics(callee, codeBlock, instance);
WASM_END_IMPL();
}
+#endif
-
WASM_SLOW_PATH_DECL(trace)
{
UNUSED_PARAM(instance);
Modified: trunk/Source/_javascript_Core/wasm/WasmSlowPaths.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmSlowPaths.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmSlowPaths.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -49,9 +49,11 @@
#define WASM_SLOW_PATH_HIDDEN_DECL(name) \
WASM_SLOW_PATH_DECL(name) WTF_INTERNAL
+#if ENABLE(WEBASSEMBLY_B3JIT)
WASM_SLOW_PATH_HIDDEN_DECL(prologue_osr);
WASM_SLOW_PATH_HIDDEN_DECL(loop_osr);
WASM_SLOW_PATH_HIDDEN_DECL(epilogue_osr);
+#endif
WASM_SLOW_PATH_HIDDEN_DECL(trace);
WASM_SLOW_PATH_HIDDEN_DECL(out_of_line_jump_target);
Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -72,6 +72,7 @@
return FINALIZE_WASM_CODE(linkBuffer, JITThunkPtrTag, "Throw stack overflow from Wasm");
}
+#if ENABLE(WEBASSEMBLY_B3JIT)
MacroAssemblerCodeRef<JITThunkPtrTag> triggerOMGEntryTierUpThunkGenerator(const AbstractLocker&)
{
// We expect that the user has already put the function index into GPRInfo::argumentGPR1
@@ -95,6 +96,7 @@
LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
return FINALIZE_WASM_CODE(linkBuffer, JITThunkPtrTag, "Trigger OMG entry tier up");
}
+#endif
static Thunks* thunks;
void Thunks::initialize()
Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmThunks.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -34,7 +34,9 @@
MacroAssemblerCodeRef<JITThunkPtrTag> throwExceptionFromWasmThunkGenerator(const AbstractLocker&);
MacroAssemblerCodeRef<JITThunkPtrTag> throwStackOverflowFromWasmThunkGenerator(const AbstractLocker&);
+#if ENABLE(WEBASSEMBLY_B3JIT)
MacroAssemblerCodeRef<JITThunkPtrTag> triggerOMGEntryTierUpThunkGenerator(const AbstractLocker&);
+#endif
typedef MacroAssemblerCodeRef<JITThunkPtrTag> (*ThunkGenerator)(const AbstractLocker&);
Modified: trunk/Source/_javascript_Core/wasm/WasmTierUpCount.cpp (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmTierUpCount.cpp 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmTierUpCount.cpp 2021-01-23 12:32:22 UTC (rev 271775)
@@ -26,7 +26,7 @@
#include "config.h"
#include "WasmTierUpCount.h"
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "WasmOSREntryData.h"
@@ -45,6 +45,6 @@
return *m_osrEntryData.last().get();
}
-} } // namespace JSC::Table
+} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmTierUpCount.h (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/WasmTierUpCount.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/WasmTierUpCount.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -25,7 +25,7 @@
#pragma once
-#if ENABLE(WEBASSEMBLY)
+#if ENABLE(WEBASSEMBLY_B3JIT)
#include "CompilationResult.h"
#include "ExecutionCounter.h"
@@ -135,4 +135,4 @@
} } // namespace JSC::Wasm
-#endif // ENABLE(WEBASSEMBLY)
+#endif // ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py (271774 => 271775)
--- trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/_javascript_Core/wasm/generateWasmOpsHeader.py 2021-01-23 12:32:22 UTC (rev 271775)
@@ -188,6 +188,10 @@
#include <cstdint>
+#if ENABLE(WEBASSEMBLY_B3JIT)
+#include "B3Type.h"
+#endif
+
namespace JSC { namespace Wasm {
static constexpr unsigned expectedVersionNumber = """ + wasm.expectedVersionNumber + """;
@@ -214,6 +218,7 @@
}
#undef CREATE_CASE
+#if ENABLE(WEBASSEMBLY_B3JIT)
#define CREATE_CASE(name, id, b3type, ...) case name: return b3type;
inline B3::Type toB3Type(Type type)
{
@@ -224,6 +229,7 @@
return B3::Void;
}
#undef CREATE_CASE
+#endif
#define CREATE_CASE(name, ...) case name: return #name;
inline const char* makeString(Type type)
Modified: trunk/Source/WTF/ChangeLog (271774 => 271775)
--- trunk/Source/WTF/ChangeLog 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/WTF/ChangeLog 2021-01-23 12:32:22 UTC (rev 271775)
@@ -1,3 +1,13 @@
+2021-01-23 Xan Lopez <[email protected]>
+
+ [JSC] Allow to build WebAssembly without B3
+ https://bugs.webkit.org/show_bug.cgi?id=220365
+
+ Reviewed by Yusuke Suzuki.
+
+ * wtf/PlatformEnable.h: Disable WebAssembly on 32bit platforms,
+ enable WebAssembly B3JIT on PLATFORM(COCOA).
+
2021-01-21 Chris Dumez <[email protected]>
Unreviewed attempt to fix WatchOS build after r271673.
Modified: trunk/Source/WTF/wtf/PlatformEnable.h (271774 => 271775)
--- trunk/Source/WTF/wtf/PlatformEnable.h 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/WTF/wtf/PlatformEnable.h 2021-01-23 12:32:22 UTC (rev 271775)
@@ -570,6 +570,12 @@
#endif
#if USE(JSVALUE32_64)
+/* Disable WebAssembly on all 32bit platforms. Its LLInt tier could
+ * work on them, but still needs some final touches. */
+#undef ENABLE_WEBASSEMBLY
+#define ENABLE_WEBASSEMBLY 0
+#undef ENABLE_WEBASSEMBLY_B3JIT
+#define ENABLE_WEBASSEMBLY_B3JIT 0
#if (CPU(ARM_THUMB2) || CPU(MIPS)) && OS(LINUX)
/* On ARMv7 and MIPS on Linux the JIT is enabled unless explicitly disabled. */
#if !defined(ENABLE_JIT)
@@ -675,6 +681,7 @@
#if !defined(ENABLE_WEBASSEMBLY) && (ENABLE(B3_JIT) && PLATFORM(COCOA) && CPU(ADDRESS64))
#define ENABLE_WEBASSEMBLY 1
+#define ENABLE_WEBASSEMBLY_B3JIT 1
#endif
/* The SamplingProfiler is the probabilistic and low-overhead profiler used by
Modified: trunk/Source/cmake/WebKitFeatures.cmake (271774 => 271775)
--- trunk/Source/cmake/WebKitFeatures.cmake 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Source/cmake/WebKitFeatures.cmake 2021-01-23 12:32:22 UTC (rev 271775)
@@ -241,7 +241,8 @@
WEBKIT_OPTION_DEFINE(ENABLE_VIDEO "Toggle Video support" PRIVATE ON)
WEBKIT_OPTION_DEFINE(ENABLE_VIDEO_PRESENTATION_MODE "Toggle Video presentation mode support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN "Toggle video element fullscreen support" PRIVATE ON)
- WEBKIT_OPTION_DEFINE(ENABLE_WEBASSEMBLY "Toggle WebAssembly support" PRIVATE ${ENABLE_FTL_DEFAULT})
+ WEBKIT_OPTION_DEFINE(ENABLE_WEBASSEMBLY "Toggle WebAssembly support" PRIVATE ${ENABLE_JIT_DEFAULT})
+ WEBKIT_OPTION_DEFINE(ENABLE_WEBASSEMBLY_B3JIT "Toggle WebAssembly B3 JIT support" PRIVATE ${ENABLE_FTL_DEFAULT})
WEBKIT_OPTION_DEFINE(ENABLE_WEBASSEMBLY_STREAMING_API "Toggle WebAssembly streaming api support." PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_WEBDRIVER "Toggle WebDriver service process" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS "Toggle WebDriver keyboard interactions" PRIVATE OFF)
@@ -272,7 +273,8 @@
WEBKIT_OPTION_DEPEND(ENABLE_LEGACY_ENCRYPTED_MEDIA ENABLE_VIDEO)
WEBKIT_OPTION_DEPEND(ENABLE_DFG_JIT ENABLE_JIT)
WEBKIT_OPTION_DEPEND(ENABLE_FTL_JIT ENABLE_DFG_JIT)
- WEBKIT_OPTION_DEPEND(ENABLE_WEBASSEMBLY ENABLE_FTL_JIT)
+ WEBKIT_OPTION_DEPEND(ENABLE_WEBASSEMBLY ENABLE_JIT)
+ WEBKIT_OPTION_DEPEND(ENABLE_WEBASSEMBLY_B3JIT ENABLE_FTL_JIT)
WEBKIT_OPTION_DEPEND(ENABLE_INDEXED_DATABASE_IN_WORKERS ENABLE_INDEXED_DATABASE)
WEBKIT_OPTION_DEPEND(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS ENABLE_REMOTE_INSPECTOR)
WEBKIT_OPTION_DEPEND(ENABLE_MEDIA_CONTROLS_SCRIPT ENABLE_VIDEO)
Modified: trunk/Tools/ChangeLog (271774 => 271775)
--- trunk/Tools/ChangeLog 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Tools/ChangeLog 2021-01-23 12:32:22 UTC (rev 271775)
@@ -1,3 +1,12 @@
+2021-01-23 Xan Lopez <[email protected]>
+
+ [JSC] Allow to build WebAssembly without B3
+ https://bugs.webkit.org/show_bug.cgi?id=220365
+
+ Reviewed by Yusuke Suzuki.
+
+ * Scripts/webkitperl/FeatureList.pm: add WebAssembly B3 JIT option.
+
2021-01-22 Alex Christensen <[email protected]>
REGRESSION(r266148) Cancelling a navigation in decidePolicyForNavigationAction should not suspend the previous document's font loading timer
Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (271774 => 271775)
--- trunk/Tools/Scripts/webkitperl/FeatureList.pm 2021-01-23 04:58:43 UTC (rev 271774)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm 2021-01-23 12:32:22 UTC (rev 271775)
@@ -173,6 +173,7 @@
$videoUsesElementFullscreenSupport,
$webAPIStatisticsSupport,
$webAssemblySupport,
+ $webAssemblyB3JITSupport,
$webAudioSupport,
$webAuthNSupport,
$webCryptoSupport,
@@ -533,6 +534,9 @@
{ option => "webassembly", desc => "Toggle WebAssembly support",
define => "ENABLE_WEBASSEMBLY", value => \$webAssemblySupport },
+ { option => "webassembly-b3jit", desc => "Toggle WebAssembly B3 JIT support",
+ define => "ENABLE_WEBASSEMBLY_B3JIT", value => \$webAssemblyB3JITSupport },
+
{ option => "webassembly-streaming-api", desc => "Toggle WebAssembly streaming api support.",
define => "ENABLE_WEBASSEMBLY_STREAMING_API", value => \$webassemblyStreamingAPISupport },