Can the Firefox JavaScript JIT be disabled from a script?

风流意气都作罢 提交于 2020-01-15 01:25:05

问题


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 a with({}) {} 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!