Ignore:
Timestamp:
Sep 22, 2011, 3:42:54 PM (14 years ago)
Author:
[email protected]
Message:

DFG JIT does not support to_primitive or strcat
https://bugs.webkit.org/show_bug.cgi?id=68582

Reviewed by Darin Adler.

This adds functional support for to_primitive and strcat. It focuses
on minimizing the amount of code emitted on to_primitive (if we know
that it is a primitive or can speculate cheaply, then we omit the
slow path) and on keeping the implementation of strcat simple while
leveraging whatever optimizations we have already. In particular,
unlike the Call and Construct nodes which require extending the size
of the DFG's callee registers, StrCat takes advantage of the fact
that no JS code can run while StrCat is in progress and uses a
scratch buffer, rather than the register file, to store the list of
values to concatenate. This was done mainly to keep the code simple,
but there are probably other benefits to keeping call frame sizes
down. Essentially, this patch ensures that the presence of an
op_strcat does not mess up any other optimizations we might do while
ensuring that if you do execute it, it'll work about as well as you'd
expect.

When combined with the previous patch for integer division, this is a
14% speed-up on Kraken. Without it, it would have been a 2% loss.

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::TrustedImmPtr::TrustedImmPtr):

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):

  • dfg/DFGJITCodeGenerator.h:

(JSC::DFG::JITCodeGenerator::callOperation):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::exitSpeculativeWithOSR):

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

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

  • dfg/DFGSpeculativeJIT.cpp:

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

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h:

(JSC::JSGlobalData::scratchBufferForSize):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r95751 r95758  
    234234#endif
    235235#if ENABLE(DFG_JIT)
    236         Vector<void*> osrScratchBuffers;
    237         size_t sizeOfLastOSRScratchBuffer;
    238        
    239         void* osrScratchBufferForSize(size_t size)
     236        Vector<void*> scratchBuffers;
     237        size_t sizeOfLastScratchBuffer;
     238       
     239        void* scratchBufferForSize(size_t size)
    240240        {
    241241            if (!size)
    242242                return 0;
    243243           
    244             if (size > sizeOfLastOSRScratchBuffer) {
     244            if (size > sizeOfLastScratchBuffer) {
    245245                // Protect against a N^2 memory usage pathology by ensuring
    246246                // that at worst, we get a geometric series, meaning that the
    247247                // total memory usage is somewhere around
    248248                // max(scratch buffer size) * 4.
    249                 sizeOfLastOSRScratchBuffer = size * 2;
     249                sizeOfLastScratchBuffer = size * 2;
    250250               
    251                 osrScratchBuffers.append(fastMalloc(sizeOfLastOSRScratchBuffer));
     251                scratchBuffers.append(fastMalloc(sizeOfLastScratchBuffer));
    252252            }
    253253           
    254             return osrScratchBuffers.last();
     254            return scratchBuffers.last();
    255255        }
    256256#endif
Note: See TracChangeset for help on using the changeset viewer.