Ignore:
Timestamp:
Dec 4, 2015, 2:28:11 PM (10 years ago)
Author:
[email protected]
Message:

Snippefy bitwise operators for the baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=151680

Reviewed by Geoffrey Garen.

This patch has passed the JSC tests on x86 and x86_64. It has also passed the
layout tests on x86_64.

With the DFG enabled, perf is neutral on x86_64 and x86.
With the DFG disabled on x86_64, some AsmBench tests are showing progressions e.g.

gcc-loops.cpp 1.0269x faster
stepanov_container.cpp 1.0180x faster

With the DFG disabled on x86, perf is neutral.

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::moveValueRegs):
(JSC::AssemblyHelpers::branchIfNotInt32):

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

(JSC::JIT::emitBitwiseBinaryOpFastPath):

  • Template for the bitwise operations.

(JSC::JIT::emit_op_bitand):
(JSC::JIT::emit_op_bitor):
(JSC::JIT::emit_op_bitxor):

  • Specializes emitBitwiseBinaryOpFastPath() with the respective snippet generators.

(JSC::JIT::emitSlow_op_bitand):
(JSC::JIT::emitSlow_op_bitor):
(JSC::JIT::emitSlow_op_bitxor):

  • Implement respective slow paths.
  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emit_op_bitand): Deleted.
(JSC::JIT::emitSlow_op_bitand): Deleted.
(JSC::JIT::emit_op_bitor): Deleted.
(JSC::JIT::emitSlow_op_bitor): Deleted.
(JSC::JIT::emit_op_bitxor): Deleted.
(JSC::JIT::emitSlow_op_bitxor): Deleted.

  • Now unified with the 64-bit version using snippets.
  • jit/JITBitAndGenerator.cpp: Added.

(JSC::JITBitAndGenerator::generateFastPath):

  • jit/JITBitAndGenerator.h: Added.

(JSC::JITBitAndGenerator::JITBitAndGenerator):

  • jit/JITBitOrGenerator.cpp: Added.

(JSC::JITBitOrGenerator::generateFastPath):

  • jit/JITBitOrGenerator.h: Added.

(JSC::JITBitOrGenerator::JITBitOrGenerator):

  • jit/JITBitXorGenerator.cpp: Added.

(JSC::JITBitXorGenerator::generateFastPath):

  • jit/JITBitXorGenerator.h: Added.

(JSC::JITBitXorGenerator::JITBitXorGenerator):

  • jit/JITBitwiseBinaryOpGenerator.h: Added.

(JSC::JITBitwiseBinaryOpGenerator::JITBitwiseBinaryOpGenerator):
(JSC::JITBitwiseBinaryOpGenerator::didEmitFastPath):
(JSC::JITBitwiseBinaryOpGenerator::endJumpList):
(JSC::JITBitwiseBinaryOpGenerator::slowPathJumpList):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_bitxor): Deleted.
(JSC::JIT::emit_op_bitor): Deleted.
(JSC::JIT::emitSlow_op_bitxor): Deleted.
(JSC::JIT::emitSlow_op_bitor): Deleted.

  • jit/SnippetOperand.h:

(JSC::SnippetOperand::SnippetOperand):

  • tests/stress/op_bitand.js:
  • tests/stress/op_bitor.js:
  • tests/stress/op_bitxor.js:
  • Fix a test value typo: it's supposed to be 0x7fffffff, not 0x7ffffff.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r192937 r193471  
    402402}
    403403
    404 void JIT::emit_op_bitxor(Instruction* currentInstruction)
    405 {
    406     emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
    407     emitJumpSlowCaseIfNotInt(regT0, regT1, regT2);
    408     xor64(regT1, regT0);
    409     emitTagInt(regT0, regT0);
    410     emitPutVirtualRegister(currentInstruction[1].u.operand);
    411 }
    412 
    413 void JIT::emit_op_bitor(Instruction* currentInstruction)
    414 {
    415     emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
    416     emitJumpSlowCaseIfNotInt(regT0, regT1, regT2);
    417     or64(regT1, regT0);
    418     emitPutVirtualRegister(currentInstruction[1].u.operand);
    419 }
    420 
    421404void JIT::emit_op_throw(Instruction* currentInstruction)
    422405{
     
    818801    callOperation(operationConvertJSValueToBoolean, regT0);
    819802    emitJumpSlowToHot(branchTest32(NonZero, returnValueGPR), currentInstruction[2].u.operand);
    820 }
    821 
    822 void JIT::emitSlow_op_bitxor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    823 {
    824     linkSlowCase(iter);
    825     JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_bitxor);
    826     slowPathCall.call();
    827 }
    828 
    829 void JIT::emitSlow_op_bitor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    830 {
    831     linkSlowCase(iter);
    832     JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_bitor);
    833     slowPathCall.call();
    834803}
    835804
Note: See TracChangeset for help on using the changeset viewer.