问题
Our web site has a fairly complex JS app that fails with the latest Firefox 10 release. This is due to what appears to be a bug in the JS interpretor, making variables return NULL when they clearly aren't. This bug only occurs when the JIT compiler is active, not when it's disabled. We will report the bug to Mozilla and try to find a workaround.
Is there a way to disable the JIT in Firefox for a specific script, from inside the script?
Thank you.
回答1:
The answer comes from Brian Hackett (:bhackett) at mozilla.org:
Using
with
in a script will disable the JIT for that script, e.g. adding awith({}) {}
to the top.
See it here https://bugzilla.mozilla.org/show_bug.cgi?id=730004#c11
Great news. This does indeed work around the issue.
Thanks everyone! Mozilla rocks!
回答2:
Gabriel, there is no reliable way to do it. You may be able to disable the JIT for particular functions by using some sort of features that the JIT doesn't support yet, but obviously the JIT folks try to minimize the set of circumstances that can trigger this... There is no official "turn off the JIT" command.
On the other hand, once you file the bug the JS engine folks may be able to suggest a workaround on your end, depending on what's going on.
Please cc me (":bz") on the bug you file?
来源:https://stackoverflow.com/questions/9410533/can-the-firefox-javascript-jit-be-disabled-from-a-script