Ignore:
Timestamp:
Jun 14, 2011, 4:39:25 PM (14 years ago)
Author:
[email protected]
Message:

2011-06-14 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Constant array literals result in unnecessarily large amounts of code
https://bugs.webkit.org/show_bug.cgi?id=62658

Add a new version of op_new_array that simply copies values from a buffer
we hang off of the CodeBlock, rather than generating code to place each
entry into the registerfile, and then copying it from the registerfile into
the array. This is a slight improvement on some sunspider tests, but no
measurable overall change. That's okay though as our goal was to reduce
code size without hurting performance.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::addImmediateBuffer): (JSC::CodeBlock::immediateBuffer):
  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addImmediateBuffer): (JSC::BytecodeGenerator::emitNewArray):
  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass):
  • jit/JIT.h:
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_buffer):
  • jit/JITOpcodes32_64.cpp:
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r88866 r88873  
    15521552        callFrame->uncheckedR(dst) = JSValue(constructArray(callFrame, args));
    15531553
     1554        vPC += OPCODE_LENGTH(op_new_array);
     1555        NEXT_INSTRUCTION();
     1556    }
     1557    DEFINE_OPCODE(op_new_array_buffer) {
     1558        /* new_array_buffer dst(r) index(n) argCount(n)
     1559         
     1560         Constructs a new Array instance using the original
     1561         constructor, and puts the result in register dst.
     1562         The array be initialized with the values from immediateBuffer[index]
     1563         */
     1564        int dst = vPC[1].u.operand;
     1565        int firstArg = vPC[2].u.operand;
     1566        int argCount = vPC[3].u.operand;
     1567        ArgList args(codeBlock->immediateBuffer(firstArg), argCount);
     1568        callFrame->uncheckedR(dst) = JSValue(constructArray(callFrame, args));
     1569       
    15541570        vPC += OPCODE_LENGTH(op_new_array);
    15551571        NEXT_INSTRUCTION();
Note: See TracChangeset for help on using the changeset viewer.