Ignore:
Timestamp:
Sep 22, 2016, 8:50:22 PM (9 years ago)
Author:
[email protected]
Message:

[JSC] Use an inline cache to generate op_negate
https://bugs.webkit.org/show_bug.cgi?id=162371

Patch by Benjamin Poulain <[email protected]> on 2016-09-22
Reviewed by Saam Barati.

JSTests:

  • stress/op-negate-inline-cache.js: Added.

Source/JavaScriptCore:

Use an inline cache to reduce the amount of code
required to implement op_negate.

For pure integer negate, the generated asm shrinks
from 147 bytes to 125 bytes (14%).
For double negate, the generated asm shrinks
to 130 bytes (11%).
The average size on Sunspider is 100bytes, this is due
to the op_negates that are never executed and do not
generate much.

  • bytecode/ArithProfile.h:

(JSC::ArithProfile::ArithProfile):
(JSC::ArithProfile::observeLHS):
(JSC::ArithProfile::observeLHSAndRHS):

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

(JSC::CodeBlock::addJITNegIC):

  • bytecode/CodeBlock.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitUnaryOp):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::UnaryOpNode::emitBytecode):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileMathIC):

  • dfg/DFGSpeculativeJIT.h:
  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileMathIC):

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::setupArgumentsWithExecState):

  • jit/JIT.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_negate):
(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):

  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITMathIC.h:

(JSC::JITMathIC::generateInline):
(JSC::canGenerateWithBinaryProfile):
(JSC::canGenerateWithUnaryProfile):

  • jit/JITMathICForwards.h:
  • jit/JITNegGenerator.cpp:

(JSC::JITNegGenerator::generateInline):
(JSC::JITNegGenerator::generateFastPath):

  • jit/JITNegGenerator.h:

(JSC::JITNegGenerator::JITNegGenerator):
(JSC::JITNegGenerator::arithProfile):
(JSC::JITNegGenerator::didEmitFastPath): Deleted.
(JSC::JITNegGenerator::endJumpList): Deleted.
(JSC::JITNegGenerator::slowPathJumpList): Deleted.

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

(JSC::updateArithProfileForUnaryArithOp):
(JSC::SLOW_PATH_DECL):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r206267 r206289  
    246246    JITAddIC* addJITAddIC();
    247247    JITMulIC* addJITMulIC();
     248    JITNegIC* addJITNegIC();
    248249    JITSubIC* addJITSubIC();
    249250    Bag<StructureStubInfo>::iterator stubInfoBegin() { return m_stubInfos.begin(); }
     
    448449
    449450    ArithProfile* arithProfileForBytecodeOffset(int bytecodeOffset);
    450     ArithProfile& arithProfileForPC(Instruction*);
     451    ArithProfile* arithProfileForPC(Instruction*);
    451452
    452453    bool couldTakeSpecialFastCase(int bytecodeOffset);
     
    998999    Bag<JITAddIC> m_addICs;
    9991000    Bag<JITMulIC> m_mulICs;
     1001    Bag<JITNegIC> m_negICs;
    10001002    Bag<JITSubIC> m_subICs;
    10011003    Bag<ByValInfo> m_byValInfos;
Note: See TracChangeset for help on using the changeset viewer.