Changeset 182745 in webkit


Ignore:
Timestamp:
Apr 13, 2015, 11:08:33 AM (10 years ago)
Author:
mark.lam@apple.com
Message:

DFG inlining of op_call_varargs should keep the callee alive in case of OSR exit.
https://bugs.webkit.org/show_bug.cgi?id=143407

Reviewed by Filip Pizlo.

DFG inlining of a varargs call / construct needs to keep the local
containing the callee alive with a Phantom node because the LoadVarargs
node may OSR exit. After the OSR exit, the baseline JIT executes the
op_call_varargs with that callee in the local.

Previously, because that callee local was not explicitly kept alive,
the op_call_varargs case can OSR exit a DFG function and leave an
undefined value in that local. As a result, the baseline observes the
side effect of an op_call_varargs on an undefined value instead of the
function it expected.

Note: this issue does not manifest with op_construct_varargs because
the inlined constructor will have an op_create_this which operates on
the incoming callee value, thereby keeping it alive.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleInlining):

  • tests/stress/call-varargs-with-different-arguments-length-after-warmup.js: Added.

(foo):
(Foo):
(doTest):

Location:
trunk/Source/JavaScriptCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r182668 r182745  
     12015-04-13  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG inlining of op_call_varargs should keep the callee alive in case of OSR exit.
     4        https://bugs.webkit.org/show_bug.cgi?id=143407
     5
     6        Reviewed by Filip Pizlo.
     7
     8        DFG inlining of a varargs call / construct needs to keep the local
     9        containing the callee alive with a Phantom node because the LoadVarargs
     10        node may OSR exit.  After the OSR exit, the baseline JIT executes the
     11        op_call_varargs with that callee in the local.
     12
     13        Previously, because that callee local was not explicitly kept alive,
     14        the op_call_varargs case can OSR exit a DFG function and leave an
     15        undefined value in that local.  As a result, the baseline observes the
     16        side effect of an op_call_varargs on an undefined value instead of the
     17        function it expected.
     18
     19        Note: this issue does not manifest with op_construct_varargs because
     20        the inlined constructor will have an op_create_this which operates on
     21        the incoming callee value, thereby keeping it alive.
     22
     23        * dfg/DFGByteCodeParser.cpp:
     24        (JSC::DFG::ByteCodeParser::handleInlining):
     25        * tests/stress/call-varargs-with-different-arguments-length-after-warmup.js: Added.
     26        (foo):
     27        (Foo):
     28        (doTest):
     29
    1302015-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
    231
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r182433 r182745  
    15711571           
    15721572                    addToGraph(LoadVarargs, OpInfo(data), get(argumentsArgument));
    1573            
     1573
     1574                    // LoadVarargs may OSR exit. Hence, we need to keep alive callTargetNode, thisArgument
     1575                    // and argumentsArgument for the baseline JIT. However, we only need a Phantom for
     1576                    // callTargetNode because the other 2 are still in use and alive at this point.
     1577                    addToGraph(Phantom, callTargetNode);
     1578
    15741579                    // In DFG IR before SSA, we cannot insert control flow between after the
    15751580                    // LoadVarargs and the last SetArgument. This isn't a problem once we get to DFG
Note: See TracChangeset for help on using the changeset viewer.