Changeset 169094 in webkit


Ignore:
Timestamp:
May 19, 2014 7:03:47 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

operationOptimize() should defer the GC for a while.
<https://webkit.org/b/133103>

Reviewed by Filip Pizlo.

Currently, operationOptimize() only defers the GC until its end. As a result,
a GC may be triggered just 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() to run the OSR entry on-ramp code.

This issue is now 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.

  • jit/JITOperations.cpp:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r169092 r169094  
     12014-05-19  Mark Lam  <mark.lam@apple.com>
     2
     3        operationOptimize() should defer the GC for a while.
     4        <https://webkit.org/b/133103>
     5
     6        Reviewed by Filip Pizlo.
     7
     8        Currently, operationOptimize() only defers the GC until its end.  As a result,
     9        a GC may be triggered just before we return from operationOptimize(), and it may
     10        jettison the optimize codeBlock that we're planning to OSR enter into when we
     11        return from this function.  This is because the OSR entry on-ramp code hasn't
     12        been executed yet, and hence, there is not yet a reference to this new codeBlock
     13        from the stack, and there won't be until we've had a chance to return out of
     14        operationOptimize() to run the OSR entry on-ramp code.
     15
     16        This issue is now fixed by using DeferGCForAWhile instead of DeferGC.  This
     17        ensures that the GC will be deferred until after the OSR entry on-ramp can be
     18        executed.
     19
     20        * jit/JITOperations.cpp:
     21
    1222014-05-19  Filip Pizlo  <fpizlo@apple.com>
    223
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r168335 r169094  
    10201020    NativeCallFrameTracer tracer(&vm, exec);
    10211021
    1022     // Defer GC so that it doesn't run between when we enter into this slow path and
    1023     // when we figure out the state of our code block. This prevents a number of
    1024     // awkward reentrancy scenarios, including:
     1022    // Defer GC for a while so that it doesn't run between when we enter into this
     1023    // slow path and when we figure out the state of our code block. This prevents
     1024    // a number of awkward reentrancy scenarios, including:
    10251025    //
    10261026    // - The optimized version of our code block being jettisoned by GC right after
    1027     //   we concluded that we wanted to use it.
     1027    //   we concluded that we wanted to use it, but have not planted it into the JS
     1028    //   stack yet.
    10281029    //
    10291030    // - An optimized version of our code block being installed just as we decided
    10301031    //   that it wasn't ready yet.
    10311032    //
    1032     // This still leaves the following: anytime we return from cti_optimize, we may
    1033     // GC, and the GC may either jettison the optimized version of our code block,
    1034     // or it may install the optimized version of our code block even though we
    1035     // concluded that it wasn't ready yet.
    1036     //
    10371033    // Note that jettisoning won't happen if we already initiated OSR, because in
    10381034    // that case we would have already planted the optimized code block into the JS
    10391035    // stack.
    1040     DeferGC deferGC(vm.heap);
     1036    DeferGCForAWhile deferGC(vm.heap);
    10411037   
    10421038    CodeBlock* codeBlock = exec->codeBlock();
Note: See TracChangeset for help on using the changeset viewer.