mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 986673: Disable JIT signal tricks on demand, rather than all signaling; r=jandem
This commit is contained in:
parent
fc589d2307
commit
9c48310188
@ -6971,7 +6971,7 @@ EstablishPreconditions(ExclusiveContext *cx, AsmJSParser &parser)
|
||||
if (!cx->jitSupportsFloatingPoint())
|
||||
return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by lack of floating point support");
|
||||
|
||||
if (!cx->signalHandlersInstalled())
|
||||
if (!cx->canUseSignalHandlers())
|
||||
return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Platform missing signal handler support");
|
||||
|
||||
if (cx->gcSystemPageSize() != AsmJSPageSize)
|
||||
@ -7043,7 +7043,7 @@ js::IsAsmJSCompilationAvailable(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
||||
// See EstablishPreconditions.
|
||||
bool available = cx->jitSupportsFloatingPoint() &&
|
||||
cx->signalHandlersInstalled() &&
|
||||
cx->canUseSignalHandlers() &&
|
||||
cx->gcSystemPageSize() == AsmJSPageSize &&
|
||||
!cx->compartment()->debugMode() &&
|
||||
cx->runtime()->options().asmJS();
|
||||
|
@ -105,9 +105,9 @@ CompileRuntime::spsProfiler()
|
||||
}
|
||||
|
||||
bool
|
||||
CompileRuntime::signalHandlersInstalled()
|
||||
CompileRuntime::canUseSignalHandlers()
|
||||
{
|
||||
return runtime()->signalHandlersInstalled();
|
||||
return runtime()->canUseSignalHandlers();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -65,7 +65,7 @@ class CompileRuntime
|
||||
// Compilation does not occur off thread when the SPS profiler is enabled.
|
||||
SPSProfiler &spsProfiler();
|
||||
|
||||
bool signalHandlersInstalled();
|
||||
bool canUseSignalHandlers();
|
||||
bool jitSupportsFloatingPoint();
|
||||
bool hadOutOfMemory();
|
||||
bool profilingScripts();
|
||||
|
@ -2214,7 +2214,7 @@ bool
|
||||
LIRGenerator::visitInterruptCheck(MInterruptCheck *ins)
|
||||
{
|
||||
// Implicit interrupt checks require asm.js signal handlers to be installed.
|
||||
if (GetIonContext()->runtime->signalHandlersInstalled()) {
|
||||
if (GetIonContext()->runtime->canUseSignalHandlers()) {
|
||||
LInterruptCheckImplicit *lir = new(alloc()) LInterruptCheckImplicit();
|
||||
return add(lir, ins) && assignSafepoint(lir, ins);
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ struct ThreadSafeContext : ContextFriendFields,
|
||||
void *stackLimitAddress(StackKind kind) { return &runtime_->mainThread.nativeStackLimit[kind]; }
|
||||
void *stackLimitAddressForJitCode(StackKind kind);
|
||||
size_t gcSystemPageSize() { return gc::SystemPageSize(); }
|
||||
bool signalHandlersInstalled() const { return runtime_->signalHandlersInstalled(); }
|
||||
bool canUseSignalHandlers() const { return runtime_->canUseSignalHandlers(); }
|
||||
bool jitSupportsFloatingPoint() const { return runtime_->jitSupportsFloatingPoint; }
|
||||
|
||||
// Thread local data that may be accessed freely.
|
||||
|
@ -189,6 +189,7 @@ JSRuntime::JSRuntime(JSRuntime *parentRuntime)
|
||||
haveCreatedContext(false),
|
||||
data(nullptr),
|
||||
signalHandlersInstalled_(false),
|
||||
canUseSignalHandlers_(false),
|
||||
defaultFreeOp_(thisFromCtor(), false),
|
||||
debuggerMutations(0),
|
||||
securityCallbacks(const_cast<JSSecurityCallbacks *>(&NullSecurityCallbacks)),
|
||||
@ -257,6 +258,14 @@ JitSupportsFloatingPoint()
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
SignalBasedTriggersDisabled()
|
||||
{
|
||||
// Don't bother trying to cache the getenv lookup; this should be called
|
||||
// infrequently.
|
||||
return !!getenv("JS_DISABLE_SLOW_SCRIPT_SIGNALS") || !!getenv("JS_NO_SIGNALS");
|
||||
}
|
||||
|
||||
bool
|
||||
JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
|
||||
{
|
||||
@ -338,6 +347,7 @@ JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
|
||||
|
||||
#ifdef JS_ION
|
||||
signalHandlersInstalled_ = EnsureAsmJSSignalHandlersInstalled(this);
|
||||
canUseSignalHandlers_ = signalHandlersInstalled_ && !SignalBasedTriggersDisabled();
|
||||
#endif
|
||||
|
||||
if (!spsProfiler.init())
|
||||
@ -546,14 +556,6 @@ JSRuntime::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::Runtim
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
SignalBasedTriggersDisabled()
|
||||
{
|
||||
// Don't bother trying to cache the getenv lookup; this should be called
|
||||
// infrequently.
|
||||
return !!getenv("JS_DISABLE_SLOW_SCRIPT_SIGNALS");
|
||||
}
|
||||
|
||||
void
|
||||
JSRuntime::requestInterrupt(InterruptMode mode)
|
||||
{
|
||||
@ -578,10 +580,8 @@ JSRuntime::requestInterrupt(InterruptMode mode)
|
||||
* asm.js and, optionally, normal Ion code use memory protection and signal
|
||||
* handlers to halt running code.
|
||||
*/
|
||||
if (!SignalBasedTriggersDisabled()) {
|
||||
RequestInterruptForAsmJSCode(this, mode);
|
||||
jit::RequestInterruptForIonCode(this, mode);
|
||||
}
|
||||
RequestInterruptForAsmJSCode(this, mode);
|
||||
jit::RequestInterruptForIonCode(this, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1072,14 +1072,20 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
js::AsmJSMachExceptionHandler asmJSMachExceptionHandler;
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Whether asm.js signal handlers have been installed and can be used for
|
||||
// performing interrupt checks in loops.
|
||||
private:
|
||||
bool signalHandlersInstalled_;
|
||||
// Whether we should use them or they have been disabled for making
|
||||
// debugging easier. If signal handlers aren't installed, it is set to false.
|
||||
bool canUseSignalHandlers_;
|
||||
public:
|
||||
bool signalHandlersInstalled() const {
|
||||
return signalHandlersInstalled_;
|
||||
}
|
||||
bool canUseSignalHandlers() const {
|
||||
return canUseSignalHandlers_;
|
||||
}
|
||||
|
||||
private:
|
||||
js::FreeOp defaultFreeOp_;
|
||||
|
Loading…
Reference in New Issue
Block a user