top | item 45379227

(no title)

IainIreland | 5 months ago

I don't know how JSC handles it, but in SM `eval` has significant negative effects on surrounding code. (We also decline to optimize functions containing `with` statements, but that's less because it's impossible and more because nobody uses them.)

discuss

order

cogman10|5 months ago

Last I saw (and I admit this is pretty dated) V8 was doing the same thing. try/catch at one point in V8 would cause the surrounding method to be deoptimized.

IainIreland|5 months ago

Yeah, SM will compile functions with try/catch/finally, but we don't support unwinding directly into optimized code, so the catch block itself will not be optimized.

pizlonator|5 months ago

JSC will still JIT optimize functions that use eval.

It’s true that there are some necessary pessimizations but nothing as severe as failing to optimize the code at all