Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (243311 => 243312)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2019-03-21 19:14:12 UTC (rev 243312)
@@ -977,6 +977,7 @@
runtime/WriteBarrier.h
runtime/WriteBarrierInlines.h
+ wasm/WasmCapabilities.h
wasm/WasmCodeBlock.h
wasm/WasmContext.h
wasm/WasmEmbedder.h
Modified: trunk/Source/_javascript_Core/ChangeLog (243311 => 243312)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-21 19:14:12 UTC (rev 243312)
@@ -1,5 +1,82 @@
2019-03-21 Yusuke Suzuki <[email protected]>
+ [JSC] Do not create JIT related data under non-JIT mode
+ https://bugs.webkit.org/show_bug.cgi?id=195982
+
+ Reviewed by Mark Lam.
+
+ We avoid creations of JIT related data structures under non-JIT mode.
+ This patch removes the following allocations.
+
+ 1. JITThunks
+ 2. FTLThunks
+ 3. FixedVMPoolExecutableAllocator
+ 4. noJITValueProfileSingleton since it is no longer used
+ 5. ARM disassembler should be initialized when it is used
+ 6. Wasm related data structures are accidentally allocated if VM::canUseJIT() == false &&
+ Options::useWebAssembly() == true. Add Wasm::isSupported() function to check the both conditions.
+
+ * CMakeLists.txt:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * heap/Heap.cpp:
+ (JSC::Heap::runEndPhase):
+ * jit/ExecutableAllocator.cpp:
+ (JSC::FixedVMPoolExecutableAllocator::~FixedVMPoolExecutableAllocator):
+ (JSC::ExecutableAllocator::initializeUnderlyingAllocator):
+ (JSC::ExecutableAllocator::isValid const):
+ (JSC::ExecutableAllocator::underMemoryPressure):
+ (JSC::ExecutableAllocator::memoryPressureMultiplier):
+ (JSC::ExecutableAllocator::allocate):
+ (JSC::ExecutableAllocator::isValidExecutableMemory):
+ (JSC::ExecutableAllocator::getLock const):
+ (JSC::ExecutableAllocator::committedByteCount):
+ (JSC::ExecutableAllocator::dumpProfile):
+ (JSC::startOfFixedExecutableMemoryPoolImpl):
+ (JSC::endOfFixedExecutableMemoryPoolImpl):
+ (JSC::ExecutableAllocator::initialize):
+ (JSC::ExecutableAllocator::initializeAllocator): Deleted.
+ (JSC::ExecutableAllocator::ExecutableAllocator): Deleted.
+ (JSC::ExecutableAllocator::~ExecutableAllocator): Deleted.
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocatorBase::isValid const):
+ (JSC::ExecutableAllocatorBase::underMemoryPressure):
+ (JSC::ExecutableAllocatorBase::memoryPressureMultiplier):
+ (JSC::ExecutableAllocatorBase::dumpProfile):
+ (JSC::ExecutableAllocatorBase::allocate):
+ (JSC::ExecutableAllocatorBase::setJITEnabled):
+ (JSC::ExecutableAllocatorBase::isValidExecutableMemory):
+ (JSC::ExecutableAllocatorBase::committedByteCount):
+ (JSC::ExecutableAllocatorBase::getLock const):
+ (JSC::ExecutableAllocator::isValid const): Deleted.
+ (JSC::ExecutableAllocator::underMemoryPressure): Deleted.
+ (JSC::ExecutableAllocator::memoryPressureMultiplier): Deleted.
+ (JSC::ExecutableAllocator::allocate): Deleted.
+ (JSC::ExecutableAllocator::setJITEnabled): Deleted.
+ (JSC::ExecutableAllocator::isValidExecutableMemory): Deleted.
+ (JSC::ExecutableAllocator::committedByteCount): Deleted.
+ (JSC::ExecutableAllocator::getLock const): Deleted.
+ * jsc.cpp:
+ (functionWebAssemblyMemoryMode):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreading):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::didAcquireLock):
+ * runtime/Options.cpp:
+ (JSC::recomputeDependentOptions):
+ * runtime/VM.cpp:
+ (JSC::enableAssembler):
+ (JSC::VM::canUseAssembler):
+ (JSC::VM::VM):
+ * runtime/VM.h:
+ * wasm/WasmCapabilities.h: Added.
+ (JSC::Wasm::isSupported):
+ * wasm/WasmFaultSignalHandler.cpp:
+ (JSC::Wasm::enableFastMemory):
+
+2019-03-21 Yusuke Suzuki <[email protected]>
+
[JSC] Fix JSC build with newer ICU
https://bugs.webkit.org/show_bug.cgi?id=196098
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (243311 => 243312)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2019-03-21 19:14:12 UTC (rev 243312)
@@ -1752,6 +1752,7 @@
E32AB2441DCD75F400D7533A /* MacroAssemblerHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = E380A76B1DCD7195000F89E6 /* MacroAssemblerHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
E334CBB521FD96A9000EB178 /* RegExpGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E334CBB321FD96A9000EB178 /* RegExpGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; };
E33637A61B63220200EE0840 /* ReflectObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E33637A41B63220200EE0840 /* ReflectObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E337B967224324EA0093A820 /* WasmCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E337B966224324E50093A820 /* WasmCapabilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
E33B3E261B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = E33B3E251B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h */; };
E33E8D1D1B9013C300346B52 /* JSNativeStdFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = E33E8D1B1B9013C300346B52 /* JSNativeStdFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
E33E8D211B9013DE00346B52 /* NativeStdFunctionCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E33E8D1F1B9013DE00346B52 /* NativeStdFunctionCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4693,6 +4694,7 @@
E334CBB321FD96A9000EB178 /* RegExpGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpGlobalData.h; sourceTree = "<group>"; };
E33637A31B63220200EE0840 /* ReflectObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReflectObject.cpp; sourceTree = "<group>"; };
E33637A41B63220200EE0840 /* ReflectObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectObject.h; sourceTree = "<group>"; };
+ E337B966224324E50093A820 /* WasmCapabilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WasmCapabilities.h; sourceTree = "<group>"; };
E33B3E251B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentationObject.lut.h; sourceTree = "<group>"; };
E33E8D1A1B9013C300346B52 /* JSNativeStdFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNativeStdFunction.cpp; sourceTree = "<group>"; };
E33E8D1B1B9013C300346B52 /* JSNativeStdFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNativeStdFunction.h; sourceTree = "<group>"; };
@@ -5083,11 +5085,11 @@
0F6183431C45F62A0072450B /* testair */,
14BD59BF0A3E8F9000BAF59C /* testapi */,
0FEC85AD1BDB5CF10080FF74 /* testb3 */,
+ 52CD0F642242F569004A18A5 /* testdfg */,
FE533CAC1F217DB40016A1FE /* testmasm */,
79281BDC20B62B3E002E2A60 /* testmem */,
6511230514046A4C002B101D /* testRegExp */,
932F5BD90822A1C700736975 /* _javascript_Core.framework */,
- 52CD0F642242F569004A18A5 /* testdfg */,
);
name = Products;
sourceTree = "<group>";
@@ -6493,6 +6495,7 @@
525C0DD81E935847002184CD /* WasmCallee.h */,
53FD04D11D7AB187003287D3 /* WasmCallingConvention.cpp */,
53FD04D21D7AB187003287D3 /* WasmCallingConvention.h */,
+ E337B966224324E50093A820 /* WasmCapabilities.h */,
526AC4B41E977C5D003500E1 /* WasmCodeBlock.cpp */,
526AC4B51E977C5D003500E1 /* WasmCodeBlock.h */,
AD412B321E7B2E8A008AF157 /* WasmContext.h */,
@@ -9824,6 +9827,7 @@
AD4B1DFA1DF244E20071AE32 /* WasmBinding.h in Headers */,
525C0DDA1E935847002184CD /* WasmCallee.h in Headers */,
53FD04D41D7AB291003287D3 /* WasmCallingConvention.h in Headers */,
+ E337B967224324EA0093A820 /* WasmCapabilities.h in Headers */,
526AC4B71E977C5D003500E1 /* WasmCodeBlock.h in Headers */,
AD412B341E7B2E9E008AF157 /* WasmContext.h in Headers */,
7593C898BE714A64BE93A6E7 /* WasmContextInlines.h in Headers */,
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -1496,9 +1496,6 @@
if (vm()->typeProfiler())
vm()->typeProfiler()->invalidateTypeSetCache();
- if (ValueProfile* profile = ""
- *profile = ""
-
reapWeakHandles();
pruneStaleEntriesFromWeakGCMaps();
sweepArrayBuffers();
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -115,7 +115,6 @@
class FixedVMPoolExecutableAllocator;
static FixedVMPoolExecutableAllocator* allocator = nullptr;
-static ExecutableAllocator* executableAllocator = nullptr;
static bool s_isJITEnabled = true;
static bool isJITEnabled()
@@ -404,43 +403,29 @@
MacroAssemblerCodePtr<ExecutableMemoryPtrTag> m_memoryEnd;
};
-void ExecutableAllocator::initializeAllocator()
+FixedVMPoolExecutableAllocator::~FixedVMPoolExecutableAllocator()
{
+ m_reservation.deallocate();
+}
+
+void ExecutableAllocator::initializeUnderlyingAllocator()
+{
ASSERT(!allocator);
allocator = new FixedVMPoolExecutableAllocator();
CodeProfiling::notifyAllocator(allocator);
-
- executableAllocator = new ExecutableAllocator;
}
-ExecutableAllocator& ExecutableAllocator::singleton()
-{
- ASSERT(allocator);
- ASSERT(executableAllocator);
- return *executableAllocator;
-}
-
-ExecutableAllocator::ExecutableAllocator()
-{
- ASSERT(allocator);
-}
-
-ExecutableAllocator::~ExecutableAllocator()
-{
-}
-
-FixedVMPoolExecutableAllocator::~FixedVMPoolExecutableAllocator()
-{
- m_reservation.deallocate();
-}
-
bool ExecutableAllocator::isValid() const
{
+ if (!allocator)
+ return Base::isValid();
return !!allocator->bytesReserved();
}
bool ExecutableAllocator::underMemoryPressure()
{
+ if (!allocator)
+ return Base::underMemoryPressure();
MetaAllocator::Statistics statistics = allocator->currentStatistics();
return statistics.bytesAllocated > statistics.bytesReserved / 2;
}
@@ -447,6 +432,8 @@
double ExecutableAllocator::memoryPressureMultiplier(size_t addedMemoryUsage)
{
+ if (!allocator)
+ return Base::memoryPressureMultiplier(addedMemoryUsage);
MetaAllocator::Statistics statistics = allocator->currentStatistics();
ASSERT(statistics.bytesAllocated <= statistics.bytesReserved);
size_t bytesAllocated = statistics.bytesAllocated + addedMemoryUsage;
@@ -465,6 +452,8 @@
RefPtr<ExecutableMemoryHandle> ExecutableAllocator::allocate(size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
{
+ if (!allocator)
+ return Base::allocate(sizeInBytes, ownerUID, effort);
if (Options::logExecutableAllocation()) {
MetaAllocator::Statistics stats = allocator->currentStatistics();
dataLog("Allocating ", sizeInBytes, " bytes of executable memory with ", stats.bytesAllocated, " bytes allocated, ", stats.bytesReserved, " bytes reserved, and ", stats.bytesCommitted, " committed.\n");
@@ -514,16 +503,22 @@
bool ExecutableAllocator::isValidExecutableMemory(const AbstractLocker& locker, void* address)
{
+ if (!allocator)
+ return Base::isValidExecutableMemory(locker, address);
return allocator->isInAllocatedMemory(locker, address);
}
Lock& ExecutableAllocator::getLock() const
{
+ if (!allocator)
+ return Base::getLock();
return allocator->getLock();
}
size_t ExecutableAllocator::committedByteCount()
{
+ if (!allocator)
+ return Base::committedByteCount();
return allocator->bytesCommitted();
}
@@ -530,6 +525,8 @@
#if ENABLE(META_ALLOCATOR_PROFILE)
void ExecutableAllocator::dumpProfile()
{
+ if (!allocator)
+ return;
allocator->dumpProfile();
}
#endif
@@ -536,11 +533,15 @@
void* startOfFixedExecutableMemoryPoolImpl()
{
+ if (!allocator)
+ return nullptr;
return allocator->memoryStart();
}
void* endOfFixedExecutableMemoryPoolImpl()
{
+ if (!allocator)
+ return nullptr;
return allocator->memoryEnd();
}
@@ -551,13 +552,13 @@
} // namespace JSC
-#else // !ENABLE(JIT)
+#endif // ENABLE(JIT)
namespace JSC {
static ExecutableAllocator* executableAllocator;
-void ExecutableAllocator::initializeAllocator()
+void ExecutableAllocator::initialize()
{
executableAllocator = new ExecutableAllocator;
}
@@ -569,5 +570,3 @@
}
} // namespace JSC
-
-#endif // ENABLE(JIT)
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (243311 => 243312)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2019-03-21 19:14:12 UTC (rev 243312)
@@ -59,6 +59,39 @@
typedef WTF::MetaAllocatorHandle ExecutableMemoryHandle;
+class ExecutableAllocatorBase {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(ExecutableAllocatorBase);
+public:
+ bool isValid() const { return false; }
+
+ static bool underMemoryPressure() { return false; }
+
+ static double memoryPressureMultiplier(size_t) { return 1.0; }
+
+ static void dumpProfile() { }
+
+ RefPtr<ExecutableMemoryHandle> allocate(size_t, void*, JITCompilationEffort) { return nullptr; }
+
+ static void setJITEnabled(bool) { };
+
+ bool isValidExecutableMemory(const AbstractLocker&, void*) { return false; }
+
+ static size_t committedByteCount() { return 0; }
+
+ Lock& getLock() const
+ {
+ return m_lock;
+ }
+
+protected:
+ ExecutableAllocatorBase() = default;
+ ~ExecutableAllocatorBase() = default;
+
+private:
+ mutable Lock m_lock;
+};
+
#if ENABLE(JIT)
JS_EXPORT_PRIVATE void* startOfFixedExecutableMemoryPoolImpl();
@@ -122,14 +155,13 @@
return memcpy(dst, src, n);
}
-class ExecutableAllocator {
- WTF_MAKE_FAST_ALLOCATED;
- WTF_MAKE_NONCOPYABLE(ExecutableAllocator);
- enum ProtectionSetting { Writable, Executable };
+class ExecutableAllocator : private ExecutableAllocatorBase {
+public:
+ using Base = ExecutableAllocatorBase;
-public:
static ExecutableAllocator& singleton();
- static void initializeAllocator();
+ static void initialize();
+ static void initializeUnderlyingAllocator();
bool isValid() const;
@@ -152,44 +184,22 @@
static size_t committedByteCount();
Lock& getLock() const;
+
private:
-
- ExecutableAllocator();
- ~ExecutableAllocator();
+ ExecutableAllocator() = default;
+ ~ExecutableAllocator() = default;
};
#else
-class ExecutableAllocator {
- enum ProtectionSetting { Writable, Executable };
-
+class ExecutableAllocator : public ExecutableAllocatorBase {
public:
static ExecutableAllocator& singleton();
- static void initializeAllocator();
+ static void initialize();
- bool isValid() const { return false; }
-
- static bool underMemoryPressure() { return false; }
-
- static double memoryPressureMultiplier(size_t) { return 1.0; }
-
- static void dumpProfile() { }
-
- RefPtr<ExecutableMemoryHandle> allocate(size_t, void*, JITCompilationEffort) { return nullptr; }
-
- static void setJITEnabled(bool) { };
-
- bool isValidExecutableMemory(const AbstractLocker&, void*) { return false; }
-
- static size_t committedByteCount() { return 0; }
-
- Lock& getLock() const
- {
- return m_lock;
- }
-
private:
- mutable Lock m_lock;
+ ExecutableAllocator() = default;
+ ~ExecutableAllocator() = default;
};
static inline void* performJITMemcpy(void *dst, const void *src, size_t n)
Modified: trunk/Source/_javascript_Core/jsc.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/jsc.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/jsc.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -69,6 +69,7 @@
#include "SuperSampler.h"
#include "TestRunnerUtils.h"
#include "TypedArrayInlines.h"
+#include "WasmCapabilities.h"
#include "WasmContext.h"
#include "WasmFaultSignalHandler.h"
#include "WasmMemory.h"
@@ -2307,7 +2308,7 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- if (!Options::useWebAssembly())
+ if (!Wasm::isSupported())
return throwVMTypeError(exec, scope, "WebAssemblyMemoryMode should only be called if the useWebAssembly option is set"_s);
if (JSObject* object = exec->argument(0).getObject()) {
Modified: trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -40,8 +40,10 @@
#include "LLIntData.h"
#include "MacroAssemblerCodeRef.h"
#include "Options.h"
+#include "SigillCrashAnalyzer.h"
#include "StructureIDTable.h"
#include "SuperSampler.h"
+#include "WasmCapabilities.h"
#include "WasmThunks.h"
#include "WriteBarrier.h"
#include <mutex>
@@ -68,11 +70,12 @@
WriteBarrierCounters::initialize();
#endif
-#if ENABLE(ASSEMBLER)
- ExecutableAllocator::initializeAllocator();
-#endif
+ ExecutableAllocator::initialize();
VM::computeCanUseJIT();
+ if (VM::canUseJIT() && Options::useSigillCrashAnalyzer())
+ enableSigillCrashAnalyzer();
+
LLInt::initialize();
#ifndef NDEBUG
DisallowGC::initialize();
@@ -83,7 +86,7 @@
thread.setSavedLastStackTop(thread.stack().origin());
#if ENABLE(WEBASSEMBLY)
- if (Options::useWebAssembly())
+ if (Wasm::isSupported())
Wasm::Thunks::initialize();
#endif
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -168,6 +168,7 @@
#include "SymbolObject.h"
#include "SymbolPrototype.h"
#include "VariableWriteFireDetail.h"
+#include "WasmCapabilities.h"
#include "WeakGCMapInlines.h"
#include "WeakMapConstructor.h"
#include "WeakMapPrototype.h"
@@ -1042,7 +1043,7 @@
exposeDollarVM(vm);
#if ENABLE(WEBASSEMBLY)
- if (Options::useWebAssembly()) {
+ if (Wasm::isSupported()) {
auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));
m_webAssemblyModuleRecordStructure.initLater(
[] (const Initializer<Structure>& init) {
Modified: trunk/Source/_javascript_Core/runtime/JSLock.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/JSLock.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/JSLock.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -28,6 +28,7 @@
#include "JSCInlines.h"
#include "MachineStackMarker.h"
#include "SamplingProfiler.h"
+#include "WasmCapabilities.h"
#include "WasmMachineThreads.h"
#include <thread>
#include <wtf/StackPointer.h>
@@ -149,7 +150,7 @@
m_vm->heap.machineThreads().addCurrentThread();
#if ENABLE(WEBASSEMBLY)
- if (Options::useWebAssembly())
+ if (Wasm::isSupported())
Wasm::startTrackingCurrentThread();
#endif
Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/Options.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -420,8 +420,10 @@
Options::useJIT() = false;
#endif
- if (!Options::useJIT())
+ if (!Options::useJIT()) {
+ Options::useSigillCrashAnalyzer() = false;
Options::useWebAssembly() = false;
+ }
if (!Options::useWebAssembly())
Options::useFastTLSForWasmContext() = false;
@@ -510,9 +512,6 @@
Options::scribbleFreeCells() = true;
}
- if (Options::useSigillCrashAnalyzer())
- enableSigillCrashAnalyzer();
-
if (Options::reservedZoneSize() < minimumReservedZoneSize)
Options::reservedZoneSize() = minimumReservedZoneSize;
if (Options::softReservedZoneSize() < Options::reservedZoneSize() + minimumReservedZoneSize)
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -185,19 +185,23 @@
// just checks for ENABLE(JIT) or ENABLE(YARR_JIT) with this premise in mind.
#if ENABLE(ASSEMBLER)
-static bool enableAssembler(ExecutableAllocator& executableAllocator)
+static bool enableAssembler()
{
if (!Options::useJIT() && !Options::useRegExpJIT())
return false;
- if (!executableAllocator.isValid()) {
+ char* canUseJITString = getenv("_javascript_CoreUseJIT");
+ if (canUseJITString && !atoi(canUseJITString))
+ return false;
+
+ ExecutableAllocator::initializeUnderlyingAllocator();
+ if (!ExecutableAllocator::singleton().isValid()) {
if (Options::crashIfCantAllocateJITMemory())
CRASH();
return false;
}
- char* canUseJITString = getenv("_javascript_CoreUseJIT");
- return !canUseJITString || atoi(canUseJITString);
+ return true;
}
#endif // ENABLE(!ASSEMBLER)
@@ -207,7 +211,7 @@
static std::once_flag onceKey;
static bool enabled = false;
std::call_once(onceKey, [] {
- enabled = enableAssembler(ExecutableAllocator::singleton());
+ enabled = enableAssembler();
});
return enabled;
#else
@@ -407,14 +411,6 @@
}
Thread::current().setCurrentAtomicStringTable(existingEntryAtomicStringTable);
-
-#if ENABLE(JIT)
- jitStubs = std::make_unique<JITThunks>();
-#endif
-
-#if ENABLE(FTL_JIT)
- ftlThunks = std::make_unique<FTL::Thunks>();
-#endif // ENABLE(FTL_JIT)
#if !ENABLE(C_LOOP)
initializeHostCallReturnValue(); // This is needed to convince the linker not to drop host call return support.
@@ -472,14 +468,15 @@
#if ENABLE(JIT)
// Make sure that any stubs that the JIT is going to use are initialized in non-compilation threads.
if (canUseJIT()) {
+ jitStubs = std::make_unique<JITThunks>();
+#if ENABLE(FTL_JIT)
+ ftlThunks = std::make_unique<FTL::Thunks>();
+#endif // ENABLE(FTL_JIT)
getCTIInternalFunctionTrampolineFor(CodeForCall);
getCTIInternalFunctionTrampolineFor(CodeForConstruct);
}
#endif
- if (!canUseJIT())
- noJITValueProfileSingleton = std::make_unique<ValueProfile>(0);
-
if (Options::forceDebuggerBytecodeGeneration() || Options::alwaysUseShadowChicken())
ensureShadowChicken();
Modified: trunk/Source/_javascript_Core/runtime/VM.h (243311 => 243312)
--- trunk/Source/_javascript_Core/runtime/VM.h 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2019-03-21 19:14:12 UTC (rev 243312)
@@ -804,8 +804,6 @@
RTTraceList* m_rtTraceList;
#endif
- std::unique_ptr<ValueProfile> noJITValueProfileSingleton;
-
JS_EXPORT_PRIVATE void resetDateCache();
RegExpCache* regExpCache() { return m_regExpCache; }
Added: trunk/Source/_javascript_Core/wasm/WasmCapabilities.h (0 => 243312)
--- trunk/Source/_javascript_Core/wasm/WasmCapabilities.h (rev 0)
+++ trunk/Source/_javascript_Core/wasm/WasmCapabilities.h 2019-03-21 19:14:12 UTC (rev 243312)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Options.h"
+#include "VM.h"
+
+namespace JSC {
+namespace Wasm {
+
+inline bool isSupported()
+{
+ return VM::canUseJIT() && Options::useWebAssembly();
+}
+
+} } // namespace JSC::Wasm
Modified: trunk/Source/_javascript_Core/wasm/WasmFaultSignalHandler.cpp (243311 => 243312)
--- trunk/Source/_javascript_Core/wasm/WasmFaultSignalHandler.cpp 2019-03-21 19:09:10 UTC (rev 243311)
+++ trunk/Source/_javascript_Core/wasm/WasmFaultSignalHandler.cpp 2019-03-21 19:14:12 UTC (rev 243312)
@@ -30,6 +30,7 @@
#include "ExecutableAllocator.h"
#include "MachineContext.h"
+#include "WasmCapabilities.h"
#include "WasmExceptionType.h"
#include "WasmMemory.h"
#include "WasmThunks.h"
@@ -126,6 +127,9 @@
#if ENABLE(WEBASSEMBLY_FAST_MEMORY)
static std::once_flag once;
std::call_once(once, [] {
+ if (!Wasm::isSupported())
+ return;
+
if (!Options::useWebAssemblyFastMemory())
return;