Ignore:
Timestamp:
Feb 20, 2018, 10:56:11 PM (7 years ago)
Author:
[email protected]
Message:

DFG::VarargsForwardingPhase should eliminate getting argument length
https://bugs.webkit.org/show_bug.cgi?id=182959

Reviewed by Keith Miller.

JSTests:

  • microbenchmarks/forward-arguments-dont-escape-on-arguments-length.js: Added.

Source/JavaScriptCore:

This patch teaches the DFG VarargsForwardingPhase to not treat
length accesses on Cloned/Direct Arguments objects as escapes.
It teaches this phase to materialize the length in the same
way the ArgumentsEliminationPhase does.

This is around a 0.5-1% speedup on ARES6 on my iMac. It speeds
up the ML subtest by 2-4%.

This patch also extends compileGetArgumentCountIncludingThis to take
a parameter that is the inline call frame to load from (in the case
where the inline call frame is a varargs frame). This allows the
the emitCodeToGetArgumentsArrayLength helper function to just emit
a GetArgumentCountIncludingThis node instead of a GetLocal. If we
emitted a GetLocal, we'd need to rerun CPS rethreading.

  • dfg/DFGArgumentsEliminationPhase.cpp:
  • dfg/DFGArgumentsUtilities.cpp:

(JSC::DFG::emitCodeToGetArgumentsArrayLength):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getArgumentCount):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGNode.h:

(JSC::DFG::Node::argumentsInlineCallFrame):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetArgumentCountIncludingThis):

  • dfg/DFGVarargsForwardingPhase.cpp:
  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileGetArgumentCountIncludingThis):

File:
1 edited

Legend:

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

    r228401 r228860  
    9292    }
    9393   
    94     Node* argumentCount;
    95     if (!inlineCallFrame)
    96         argumentCount = insertionSet.insertNode(nodeIndex, SpecInt32Only, GetArgumentCountIncludingThis, origin);
    97     else {
    98         VirtualRegister argumentCountRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCount);
    99        
    100         argumentCount = insertionSet.insertNode(
    101             nodeIndex, SpecInt32Only, GetStack, origin,
    102             OpInfo(graph.m_stackAccessData.add(argumentCountRegister, FlushedInt32)));
    103     }
     94    Node* argumentCount = insertionSet.insertNode(nodeIndex,
     95        SpecInt32Only, GetArgumentCountIncludingThis, origin, OpInfo(inlineCallFrame));
    10496
    10597    Node* result = insertionSet.insertNode(
Note: See TracChangeset for help on using the changeset viewer.