Ignore:
Timestamp:
Sep 28, 2021, 8:32:53 AM (4 years ago)
Author:
[email protected]
Message:

Make byte codes with arithmetic profiles switch to using an index instead of a pointer in metadata
https://bugs.webkit.org/show_bug.cgi?id=230798

Reviewed by Yusuke Suzuki.

This patch makes each bytecode that uses a BinaryArithProfile/UnaryArithProfile
have an index into a table instead of storing a pointer to the profile in its metadata.
Then, we can just load the profile using the index in the bytecode, which saves memory.

  • bytecode/BytecodeList.rb:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::binaryArithProfileForPC):
(JSC::CodeBlock::unaryArithProfileForPC):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::allocateSharedProfiles):

  • bytecode/UnlinkedCodeBlock.h:
  • bytecode/UnlinkedCodeBlockGenerator.cpp:

(JSC::UnlinkedCodeBlockGenerator::finalize):

  • bytecode/UnlinkedCodeBlockGenerator.h:

(JSC::UnlinkedCodeBlockGenerator::addBinaryArithProfile):
(JSC::UnlinkedCodeBlockGenerator::addUnaryArithProfile):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitUnaryOp):
(JSC::BytecodeGenerator::emitInc):
(JSC::BytecodeGenerator::emitDec):

  • bytecompiler/BytecodeGenerator.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_negate):
(JSC::JIT::emit_op_add):
(JSC::JIT::emit_op_div):
(JSC::JIT::emit_op_mul):
(JSC::JIT::emit_op_sub):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.cpp:

(JSC::updateArithProfileForUnaryArithOp):
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):

Location:
trunk/Source/JavaScriptCore/bytecompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r283101 r283168  
    16101610        break;
    16111611    case op_negate:
    1612         OpNegate::emit(this, dst, src, type);
     1612        OpNegate::emit(this, dst, src, m_codeBlock->addUnaryArithProfile(), type);
    16131613        break;
    16141614    case op_bitnot:
     
    17081708RegisterID* BytecodeGenerator::emitInc(RegisterID* srcDst)
    17091709{
    1710     OpInc::emit(this, srcDst);
     1710    OpInc::emit(this, srcDst, m_codeBlock->addUnaryArithProfile());
    17111711    return srcDst;
    17121712}
     
    17141714RegisterID* BytecodeGenerator::emitDec(RegisterID* srcDst)
    17151715{
    1716     OpDec::emit(this, srcDst);
     1716    OpDec::emit(this, srcDst, m_codeBlock->addUnaryArithProfile());
    17171717    return srcDst;
    17181718}
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r283101 r283168  
    683683        emitBinaryOp(RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types)
    684684        {
    685             BinaryOp::emit(this, dst, src1, src2, types);
     685            BinaryOp::emit(this, dst, src1, src2, m_codeBlock->addBinaryArithProfile(), types);
    686686            return dst;
    687687        }
Note: See TracChangeset for help on using the changeset viewer.