From 16541ad2049005742da11c29d802311e1796f6c2 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 18 Nov 2013 12:56:32 -0600 Subject: [PATCH] Bug 933807 - Allow easily disabling TriggerOperationCallbackFor(Ion|AsmJS)Code (r=bhackett) --HG-- extra : rebase_source : bcf49d894252af53a24aa08a0db25c99dedd26d9 --- js/src/vm/Runtime.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index d1c4774f155..0d5c6e6a44b 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -591,6 +591,14 @@ JSRuntime::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::Runtim rtSizes->scriptData += mallocSizeOf(r.front()); } +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::triggerOperationCallback(OperationCallbackTrigger trigger) { @@ -611,8 +619,10 @@ JSRuntime::triggerOperationCallback(OperationCallbackTrigger trigger) * asm.js and, optionally, normal Ion code use memory protection and signal * handlers to halt running code. */ - TriggerOperationCallbackForAsmJSCode(this); - jit::TriggerOperationCallbackForIonCode(this, trigger); + if (!SignalBasedTriggersDisabled()) { + TriggerOperationCallbackForAsmJSCode(this); + jit::TriggerOperationCallbackForIonCode(this, trigger); + } #endif }