Changeset 206047 in webkit


Ignore:
Timestamp:
Sep 16, 2016 2:17:33 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

[DFG] Introduce ArrayUse
https://bugs.webkit.org/show_bug.cgi?id=162063

Reviewed by Keith Miller.

ArrayUse is particularly useful: for IsJSArray.
We can drop IsJSArray in fixup phase by setting ArrayUse edge filter.

Since @isJSArray user is limited (Array.prototype.concat), the effect of this patch is small.
But later, I'll update {@isArray, Array.isArray} to use @isJSArray[1]. In that patch, we are planning
to implement more aggressive optimization like, setting CellUse edge filter to avoid cell check in
SpeculativeJIT::compileIsJSArray.

In the benchmark using Array.prototype.concat, we can see perf improvement since we can drop IsJSArray in fixup phase.

baseline patched

lazy-array-species-watchpoints 25.0911+-0.0516 24.7687+-0.0767 definitely 1.0130x faster

[1]: https://bugs.webkit.org/show_bug.cgi?id=162000

  • dfg/DFGFixupPhase.cpp:

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

  • dfg/DFGSafeToExecute.h:

(JSC::DFG::SafeToExecuteEdge::operator()):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::speculateArray):
(JSC::DFG::SpeculativeJIT::speculate):

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGUseKind.cpp:

(WTF::printInternal):

  • dfg/DFGUseKind.h:

(JSC::DFG::typeFilterFor):
(JSC::DFG::isCell):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::speculateArray):
(JSC::FTL::DFG::LowerDFGToB3::speculateObject): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r206018 r206047  
     12016-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [DFG] Introduce ArrayUse
     4        https://bugs.webkit.org/show_bug.cgi?id=162063
     5
     6        Reviewed by Keith Miller.
     7
     8        ArrayUse is particularly useful: for IsJSArray.
     9        We can drop IsJSArray in fixup phase by setting ArrayUse edge filter.
     10
     11        Since @isJSArray user is limited (Array.prototype.concat), the effect of this patch is small.
     12        But later, I'll update {@isArray, Array.isArray} to use @isJSArray[1]. In that patch, we are planning
     13        to implement more aggressive optimization like, setting CellUse edge filter to avoid cell check in
     14        SpeculativeJIT::compileIsJSArray.
     15
     16        In the benchmark using Array.prototype.concat, we can see perf improvement since we can drop IsJSArray in fixup phase.
     17
     18                                                     baseline                  patched
     19
     20            lazy-array-species-watchpoints       25.0911+-0.0516     ^     24.7687+-0.0767        ^ definitely 1.0130x faster
     21
     22        [1]: https://bugs.webkit.org/show_bug.cgi?id=162000
     23
     24        * dfg/DFGFixupPhase.cpp:
     25        (JSC::DFG::FixupPhase::fixupNode):
     26        * dfg/DFGSafeToExecute.h:
     27        (JSC::DFG::SafeToExecuteEdge::operator()):
     28        * dfg/DFGSpeculativeJIT.cpp:
     29        (JSC::DFG::SpeculativeJIT::speculateArray):
     30        (JSC::DFG::SpeculativeJIT::speculate):
     31        * dfg/DFGSpeculativeJIT.h:
     32        * dfg/DFGUseKind.cpp:
     33        (WTF::printInternal):
     34        * dfg/DFGUseKind.h:
     35        (JSC::DFG::typeFilterFor):
     36        (JSC::DFG::isCell):
     37        * ftl/FTLCapabilities.cpp:
     38        (JSC::FTL::canCompile):
     39        * ftl/FTLLowerDFGToB3.cpp:
     40        (JSC::FTL::DFG::LowerDFGToB3::speculate):
     41        (JSC::FTL::DFG::LowerDFGToB3::speculateArray):
     42        (JSC::FTL::DFG::LowerDFGToB3::speculateObject): Deleted.
     43
    1442016-09-16  Joseph Pecoraro  <pecoraro@apple.com>
    245
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r205974 r206047  
    14181418            break;
    14191419
     1420        case IsJSArray:
     1421            if (node->child1()->shouldSpeculateArray()) {
     1422                m_insertionSet.insertNode(
     1423                    m_indexInBlock, SpecNone, Check, node->origin,
     1424                    Edge(node->child1().node(), ArrayUse));
     1425                m_graph.convertToConstant(node, jsBoolean(true));
     1426                observeUseKindOnNode<ArrayUse>(node);
     1427            }
     1428            break;
     1429
    14201430        case GetEnumerableLength: {
    14211431            fixEdge<CellUse>(node->child1());
     
    16231633        case DeleteById:
    16241634        case DeleteByVal:
    1625         case IsJSArray:
    16261635        case IsTypedArrayView:
    16271636        case IsEmpty:
  • trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h

    r205828 r206047  
    5656        case CellOrOtherUse:
    5757        case ObjectUse:
     58        case ArrayUse:
    5859        case FunctionUse:
    5960        case FinalObjectUse:
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r205974 r206047  
    73957395}
    73967396
     7397void SpeculativeJIT::speculateArray(Edge edge, GPRReg cell)
     7398{
     7399    speculateCellType(edge, cell, SpecArray, ArrayType);
     7400}
     7401
     7402void SpeculativeJIT::speculateArray(Edge edge)
     7403{
     7404    if (!needsTypeCheck(edge, SpecArray))
     7405        return;
     7406
     7407    SpeculateCellOperand operand(this, edge);
     7408    speculateArray(edge, operand.gpr());
     7409}
     7410
    73977411void SpeculativeJIT::speculateMapObject(Edge edge, GPRReg cell)
    73987412{
     
    77037717    case FunctionUse:
    77047718        speculateFunction(edge);
     7719        break;
     7720    case ArrayUse:
     7721        speculateArray(edge);
    77057722        break;
    77067723    case FinalObjectUse:
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r205828 r206047  
    26752675    void speculateCellOrOther(Edge);
    26762676    void speculateObject(Edge);
     2677    void speculateArray(Edge, GPRReg cell);
     2678    void speculateArray(Edge);
    26772679    void speculateFunction(Edge);
    26782680    void speculateFinalObject(Edge);
  • trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp

    r205520 r206047  
    8686        out.print("Object");
    8787        return;
     88    case ArrayUse:
     89        out.print("Array");
     90        return;
    8891    case FunctionUse:
    8992        out.print("Function");
  • trunk/Source/JavaScriptCore/dfg/DFGUseKind.h

    r205520 r206047  
    5454    CellOrOtherUse,
    5555    ObjectUse,
     56    ArrayUse,
    5657    FunctionUse,
    5758    FinalObjectUse,
     
    118119    case ObjectUse:
    119120        return SpecObject;
     121    case ArrayUse:
     122        return SpecArray;
    120123    case FunctionUse:
    121124        return SpecFunction;
     
    219222    case KnownCellUse:
    220223    case ObjectUse:
     224    case ArrayUse:
    221225    case FunctionUse:
    222226    case FinalObjectUse:
  • trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r205830 r206047  
    423423                case CellOrOtherUse:
    424424                case ObjectUse:
     425                case ArrayUse:
    425426                case FunctionUse:
    426427                case ObjectOrOtherUse:
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r205974 r206047  
    1067710677            speculateObject(edge);
    1067810678            break;
     10679        case ArrayUse:
     10680            speculateArray(edge);
     10681            break;
    1067910682        case FunctionUse:
    1068010683            speculateFunction(edge);
     
    1096110964        speculateObject(edge, lowCell(edge));
    1096210965    }
     10966
     10967    void speculateArray(Edge edge, LValue cell)
     10968    {
     10969        FTL_TYPE_CHECK(
     10970            jsValueValue(cell), edge, SpecArray, isNotType(cell, ArrayType));
     10971    }
     10972
     10973    void speculateArray(Edge edge)
     10974    {
     10975        speculateArray(edge, lowCell(edge));
     10976    }
    1096310977   
    1096410978    void speculateFunction(Edge edge, LValue cell)
Note: See TracChangeset for help on using the changeset viewer.