Ignore:
Timestamp:
Jun 26, 2012, 12:42:05 PM (13 years ago)
Author:
[email protected]
Message:

DFG::operationNewArray is unnecessarily slow, and may use the wrong array
prototype when inlined
https://bugs.webkit.org/show_bug.cgi?id=89821

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Fixes all array allocations to use the right structure, and hence the right prototype. Adds
inlining of new Array(...) with a non-zero number of arguments. Optimizes allocations of
empty arrays.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleConstantInternalFunction):

  • dfg/DFGCCallHelpers.h:

(JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
(CCallHelpers):

  • dfg/DFGNodeType.h:

(DFG):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • runtime/JSArray.h:

(JSC):
(JSC::constructArray):

  • runtime/JSGlobalObject.h:

(JSC):
(JSC::constructArray):

LayoutTests:

Rubber stamped by Geoffrey Garen.

  • fast/js/dfg-cross-global-object-inline-new-array-expected.txt: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-literal-expected.txt: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-literal-with-variables-expected.txt: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-literal-with-variables.html: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-literal.html: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-with-elements-expected.txt: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-with-elements.html: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-with-size-expected.txt: Added.
  • fast/js/dfg-cross-global-object-inline-new-array-with-size.html: Added.
  • fast/js/dfg-cross-global-object-inline-new-array.html: Added.
  • fast/js/script-tests/cross-global-object-inline-global-var.js:

(done):

  • fast/js/script-tests/dfg-cross-global-object-inline-new-array-literal-with-variables.js: Added.

(foo):
(done):
(doit):

  • fast/js/script-tests/dfg-cross-global-object-inline-new-array-literal.js: Added.

(foo):
(done):
(doit):

  • fast/js/script-tests/dfg-cross-global-object-inline-new-array-with-elements.js: Added.

(foo):
(done):
(doit):

  • fast/js/script-tests/dfg-cross-global-object-inline-new-array-with-size.js: Added.

(foo):
(done):
(doit):

  • fast/js/script-tests/dfg-cross-global-object-inline-new-array.js: Added.

(foo):
(done):
(doit):

File:
1 edited

Legend:

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

    r121073 r121280  
    16071607    // is good enough.
    16081608   
    1609     UNUSED_PARAM(registerOffset); // Remove this once we do more things to the arguments.
    16101609    UNUSED_PARAM(prediction); // Remove this once we do more things.
    16111610    UNUSED_PARAM(kind); // Remove this once we do more things.
    16121611   
    16131612    if (function->classInfo() == &ArrayConstructor::s_info) {
    1614         // We could handle this but don't for now.
    1615         if (argumentCountIncludingThis != 1)
    1616             return false;
    1617        
     1613        if (argumentCountIncludingThis == 2) {
     1614            setIntrinsicResult(
     1615                usesResult, resultOperand,
     1616                addToGraph(NewArrayWithSize, get(registerOffset + argumentToOperand(1))));
     1617            return true;
     1618        }
     1619       
     1620        for (int i = 1; i < argumentCountIncludingThis; ++i)
     1621            addVarArgChild(get(registerOffset + argumentToOperand(i)));
    16181622        setIntrinsicResult(
    16191623            usesResult, resultOperand,
Note: See TracChangeset for help on using the changeset viewer.