Ignore:
Timestamp:
Jun 28, 2021, 10:55:12 AM (4 years ago)
Author:
[email protected]
Message:

Add LLInt fast path for less, lesseq, greater and greatereq
https://bugs.webkit.org/show_bug.cgi?id=226266

Patch by Mikhail R. Gadelha <Mikhail R. Gadelha> on 2021-06-28
Reviewed by Tadeu Zagallo.

The motivation is to add fast path for integers and doubles
in LLInt, so we don't need to go to slow path for those cases.

This patch implements the less, lesseq, greater, greatereq
instruction for ARMv7, MIPS and CLoop.

Microbenchmarking results:

  • x86_64: number-comparison-inline definitely 1.3520x faster
  • ARMv7: number-comparison-inline definitely 1.3520x faster

JetStream2 results:

  • x86_64 jit: 1.015 times better
  • x86_64 no-jit: 1.018 times better
  • ARMv7 no-jit: 1.004 times worse
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • offlineasm/arm.rb:
  • offlineasm/cloop.rb:
  • offlineasm/mips.rb:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/mips.rb

    r269349 r279343  
    805805        raise unless operands.size == 2
    806806        $asm.puts "#{opcode} #{operands[1].mipsOperand}, #{operands[1].mipsOperand}, #{operands[0].mipsOperand}"
     807    end
     808end
     809
     810def emitMIPSDoubleCompare(branchOpcode, neg, operands)
     811    mipsMoveImmediate(1, operands[2])
     812    $asm.puts "c.#{branchOpcode}.d $fcc0, #{mipsOperands(operands[0..1])}"
     813    if (!neg)
     814        $asm.puts "movf #{operands[2].mipsOperand}, $zero, $fcc0"
     815    else
     816        $asm.puts "movt #{operands[2].mipsOperand}, $zero, $fcc0"
    807817    end
    808818end
     
    10121022            $asm.puts "slt #{operands[2].mipsOperand}, #{operands[1].mipsOperand}, #{operands[0].mipsOperand}"
    10131023            $asm.puts "xori #{operands[2].mipsOperand}, 1"
     1024        when "cdgt"
     1025            emitMIPSDoubleCompare("ule", true, operands)
     1026        when "cdgteq"
     1027            emitMIPSDoubleCompare("ult", true, operands)
     1028        when "cdlt"
     1029            emitMIPSDoubleCompare("olt", false, operands)
     1030        when "cdlteq"
     1031            emitMIPSDoubleCompare("ole", false, operands)
    10141032        when "peek"
    10151033            $asm.puts "lw #{operands[1].mipsOperand}, #{operands[0].value * 4}($sp)"
Note: See TracChangeset for help on using the changeset viewer.