• mhahnenberg@apple.com's avatar
    Implement fast path for op_new_array in the baseline JIT · d249ef82
    mhahnenberg@apple.com authored
    Reviewed by Filip Pizlo.
    * heap/CopiedAllocator.h:
    (CopiedAllocator): Friended the JIT to allow access to m_currentOffset.
    * heap/CopiedSpace.h:
    (CopiedSpace): Friended the JIT to allow access to
    * heap/Heap.h:
    (JSC::Heap::storageAllocator): Added a getter for the CopiedAllocator class so the JIT
    can use it for simple allocation i.e. when we can just bump the offset without having to
    do anything else.
    * jit/JIT.cpp:
    (JSC::JIT::privateCompileSlowCases): Added new slow case for op_new_array for when
    we have to bail out because the fast allocation path fails for whatever reason.
    * jit/JIT.h:
    * jit/JITInlineMethods.h:
    (JSC::JIT::emitAllocateBasicStorage): Added utility function that allows objects to
    allocate generic backing stores. This function is used by emitAllocateJSArray.
    (JSC::JIT::emitAllocateJSArray): Added utility function that allows the client to
    more easily allocate JSArrays. This function is used by emit_op_new_array and I expect
    it will also be used for emit_op_new_array_buffer.
    * jit/JITOpcodes.cpp:
    (JSC::JIT::emit_op_new_array): Changed to do inline allocation of JSArrays. Still does
    a stub call for oversize arrays.
    (JSC::JIT::emitSlow_op_new_array): Just bails out to a stub call if we fail in any way on
    the fast path.
    * runtime/JSArray.cpp:
    * runtime/JSArray.h: Added lots of offset functions for all the fields that we need to
    initialize in the JIT.
    (JSC::JSArray::storageSize): Moved this function from being a static function in the cpp file
    to being a static function in the JSArray class. This move allows the JIT to call it to
    see what size it should allocate.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSArray.cpp 71.2 KB