Ignore:
Timestamp:
Dec 9, 2011, 12:45:46 AM (13 years ago)
Author:
[email protected]
Message:

Avoid reloading storage pointer for indexed properties unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=74136

Reviewed by Filip Pizlo.

Add a node to represent loading property storage for indexed properties.
This allows us to reduce code generated for sequential access of arrays,
strings, etc. This results in up to 5% improvement in code that is
very heavy on indexed reads, such as matrix operations in typed arrays
and 20% faster on microbenchmarks.

Currently this is only supported by GetByVal and other similar indexed reads.

  • bytecode/PredictedType.h:

(JSC::isFixedIndexedStorageObjectPrediction):

  • dfg/DFGAbstractState.cpp:

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

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsic):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGNode.h:
  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNodePredictions):
(JSC::DFG::Propagator::fixupNode):
(JSC::DFG::Propagator::getIndexedPropertyStorageLoadElimination):
(JSC::DFG::Propagator::performNodeCSE):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):
(JSC::DFG::SpeculativeJIT::compileGetByValOnByteArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):

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

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

File:
1 edited

Legend:

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

    r102167 r102442  
    12081208        if (firstArg + 1 != lastArg)
    12091209            return false;
    1210 
    1211         NodeIndex charCode = addToGraph(StringCharCodeAt, get(firstArg), getToInt32(firstArg + 1));
     1210        if (!(m_graph[get(firstArg)].prediction() & PredictString))
     1211            return false;
     1212       
     1213        NodeIndex storage = addToGraph(GetIndexedPropertyStorage, get(firstArg), getToInt32(firstArg + 1));
     1214        NodeIndex charCode = addToGraph(StringCharCodeAt, get(firstArg), getToInt32(firstArg + 1), storage);
    12121215        if (usesResult)
    12131216            set(resultOperand, charCode);
     
    12181221        if (firstArg + 1 != lastArg)
    12191222            return false;
    1220        
    1221         NodeIndex charCode = addToGraph(StringCharAt, get(firstArg), getToInt32(firstArg + 1));
     1223        if (!(m_graph[get(firstArg)].prediction() & PredictString))
     1224            return false;
     1225
     1226        NodeIndex storage = addToGraph(GetIndexedPropertyStorage, get(firstArg), getToInt32(firstArg + 1));
     1227        NodeIndex charCode = addToGraph(StringCharAt, get(firstArg), getToInt32(firstArg + 1), storage);
    12221228        if (usesResult)
    12231229            set(resultOperand, charCode);
     
    16121618            NodeIndex base = get(currentInstruction[2].u.operand);
    16131619            NodeIndex property = get(currentInstruction[3].u.operand);
    1614 
    1615             NodeIndex getByVal = addToGraph(GetByVal, OpInfo(0), OpInfo(prediction), base, property);
     1620            NodeIndex propertyStorage = addToGraph(GetIndexedPropertyStorage, base, property);
     1621            NodeIndex getByVal = addToGraph(GetByVal, OpInfo(0), OpInfo(prediction), base, property, propertyStorage);
    16161622            set(currentInstruction[1].u.operand, getByVal);
    16171623
Note: See TracChangeset for help on using the changeset viewer.