Currently, operationOptimize() only defers the GC until its end. As a result, a GC may be triggered before we return from operationOptimize(), and it may jettison the optimize codeBlock that we're planning to OSR enter into when we return from this function. This is because the OSR entry on-ramp code hasn't been executed yet, and hence, there is not yet a reference to this new codeBlock from the stack, and there won't be until we've had a chance to return out of operationOptimize() and run the OSR entry on-ramp code.
This issue can be fixed by using DeferGCForAWhile instead of DeferGC. This ensures that the GC will be deferred until after the OSR entry on-ramp can be executed.
Created attachment 231747 [details]
Thanks. Landed in r169094: <http://trac.webkit.org/r169094>