Changeset 154157 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Aug 15, 2013, 7:30:37 PM (12 years ago)
Author:
[email protected]
Message:

Sometimes, the DFG uses a GetById for typed array length accesses despite profiling data that indicates that it's a typed array length access
https://bugs.webkit.org/show_bug.cgi?id=119874

Reviewed by Oliver Hunt and Mark Hahnenberg.

It was a confusion between heuristics in DFG::ArrayMode that are assuming that
you'll use ForceExit if array profiles are empty, the JIT creating empty profiles
sometimes for typed array length accesses, and the FixupPhase assuming that a
ForceExit ArrayMode means that it should continue using a generic GetById.

This fixes the confusion.

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r154156 r154157  
     12013-08-15  Filip Pizlo  <[email protected]>
     2
     3        Sometimes, the DFG uses a GetById for typed array length accesses despite profiling data that indicates that it's a typed array length access
     4        https://bugs.webkit.org/show_bug.cgi?id=119874
     5
     6        Reviewed by Oliver Hunt and Mark Hahnenberg.
     7       
     8        It was a confusion between heuristics in DFG::ArrayMode that are assuming that
     9        you'll use ForceExit if array profiles are empty, the JIT creating empty profiles
     10        sometimes for typed array length accesses, and the FixupPhase assuming that a
     11        ForceExit ArrayMode means that it should continue using a generic GetById.
     12
     13        This fixes the confusion.
     14
     15        * dfg/DFGFixupPhase.cpp:
     16        (JSC::DFG::FixupPhase::fixupNode):
     17
    1182013-08-15  Mark Lam  <[email protected]>
    219
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r154038 r154157  
    726726        }
    727727           
    728         case GetById: {
     728        case GetById:
     729        case GetByIdFlush: {
    729730            if (!node->child1()->shouldSpeculateCell())
    730731                break;
     
    742743                arrayProfile->computeUpdatedPrediction(locker, profiledBlock);
    743744                arrayMode = ArrayMode::fromObserved(locker, arrayProfile, Array::Read, false);
    744                 arrayMode = arrayMode.refine(node->child1()->prediction(), node->prediction());
    745             } else
    746                 arrayMode = arrayMode.refine(node->child1()->prediction(), node->prediction());
     745                if (arrayMode.type() == Array::Unprofiled) {
     746                    // For normal array operations, it makes sense to treat Unprofiled
     747                    // accesses as ForceExit and get more data rather than using
     748                    // predictions and then possibly ending up with a Generic. But here,
     749                    // we treat anything that is Unprofiled as Generic and keep the
     750                    // GetById. I.e. ForceExit = Generic. So, there is no harm - and only
     751                    // profit - from treating the Unprofiled case as
     752                    // SelectUsingPredictions.
     753                    arrayMode = ArrayMode(Array::SelectUsingPredictions);
     754                }
     755            }
     756           
     757            arrayMode = arrayMode.refine(node->child1()->prediction(), node->prediction());
    747758           
    748759            if (arrayMode.type() == Array::Generic) {
     
    769780           
    770781            node->child2() = Edge(storage);
    771             break;
    772         }
    773            
    774         case GetByIdFlush: {
    775             if (node->child1()->shouldSpeculateCell())
    776                 setUseKindAndUnboxIfProfitable<CellUse>(node->child1());
    777782            break;
    778783        }
Note: See TracChangeset for help on using the changeset viewer.