Disabling JIT in Safari 6 to workaround severe Javascript JIT bugs

后端 未结 3 1626
既然无缘
既然无缘 2021-02-05 06:56

We found a severe problem with the interpretation of our Javascript code that only occurs on iOS 5/Safari 6 (then current iPad release) that we think is due to critical bug in t

3条回答
  •  爱一瞬间的悲伤
    2021-02-05 07:16

    IMO, the correct solution is to report the bug to Apple, then workaround it in your code (surely using a separate a = a + 1; statement will work, unless the JIT is even worse than you thought!). It does indeed suck, though. Here's a list of common things you can also try throwing in to the function to make it de-optimise and not use JIT:

    • Exceptions
    • 'with' statement
    • using arguments object, e.g. arguments.callee
    • eval()

    The problem with those is if the Javascript engine is optimised to JIT them before they fix that bug, in which case you're back to crashing. So, report and workaround!

提交回复
热议问题