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/DFGCCallHelpers.h

    r120244 r121280  
    161161    }
    162162
     163    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2)
     164    {
     165        resetCallArguments();
     166        addCallArgument(GPRInfo::callFrameRegister);
     167        addCallArgument(arg1);
     168        addCallArgument(arg2);
     169    }
     170
    163171    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2)
    164172    {
     
    196204
    197205    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3)
     206    {
     207        resetCallArguments();
     208        addCallArgument(GPRInfo::callFrameRegister);
     209        addCallArgument(arg1);
     210        addCallArgument(arg2);
     211        addCallArgument(arg3);
     212    }
     213
     214    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImmPtr arg3)
    198215    {
    199216        resetCallArguments();
     
    598615    }
    599616
     617    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImmPtr arg3)
     618    {
     619        move(arg1, GPRInfo::argumentGPR1);
     620        move(arg2, GPRInfo::argumentGPR2);
     621        move(arg3, GPRInfo::argumentGPR3);
     622        move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     623    }
     624
    600625    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3)
    601626    {
Note: See TracChangeset for help on using the changeset viewer.