Ignore:
Timestamp:
May 2, 2015, 11:36:24 AM (10 years ago)
Author:
[email protected]
Message:

Unreviewed, add a FIXME referencing https://bugs.webkit.org/show_bug.cgi?id=144527.

  • dfg/DFGLICMPhase.cpp:

(JSC::DFG::LICMPhase::attemptHoist):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGLICMPhase.cpp

    r183718 r183719  
    218218        // https://bugs.webkit.org/show_bug.cgi?id=144525
    219219       
     220        // FIXME: If a node has a type check - even something like a CheckStructure - then we should
     221        // only hoist the node if we know that it will execute on every loop iteration or if we know
     222        // that the type check will always succeed at the loop pre-header through some other means
     223        // (like looking at prediction propagation results). Otherwise, we might make a mistake like
     224        // this:
     225        //
     226        // var o = ...; // sometimes null and sometimes an object with structure S1.
     227        // for (...) {
     228        //     if (o)
     229        //         ... = o.f; // CheckStructure and GetByOffset, which we will currently hoist.
     230        // }
     231        //
     232        // When we encounter such code, we'll hoist the CheckStructure and GetByOffset and then we
     233        // will have a recompile. We'll then end up thinking that the get_by_id needs to be
     234        // polymorphic, which is false.
     235        //
     236        // We can counter this by either having a control flow equivalence check, or by consulting
     237        // prediction propagation to see if the check would always succeed. Prediction propagation
     238        // would not be enough for things like:
     239        //
     240        // var p = ...; // some boolean predicate
     241        // var o = {};
     242        // if (p)
     243        //     o.f = 42;
     244        // for (...) {
     245        //     if (p)
     246        //         ... = o.f;
     247        // }
     248        //
     249        // Prediction propagation can't tell us anything about the structure, and the CheckStructure
     250        // will appear to be hoistable because the loop doesn't clobber structures. The cell check
     251        // in the CheckStructure will be hoistable though, since prediction propagation can tell us
     252        // that o is always SpecFinalObject. In cases like this, control flow equivalence is the
     253        // only effective guard.
     254        //
     255        // https://bugs.webkit.org/show_bug.cgi?id=144527
     256       
    220257        if (readsOverlap(m_graph, node, data.writes)) {
    221258            if (verbose) {
Note: See TracChangeset for help on using the changeset viewer.