Ignore:
Timestamp:
Nov 8, 2011, 7:02:14 PM (14 years ago)
Author:
[email protected]
Message:

Better abstract 'abs' operation through the MacroAssembler.
https://bugs.webkit.org/show_bug.cgi?id=71873

Reviewed by Geoff Garen.

Currently the x86 specific instruction sequence to perform a double abs
is duplicated throughout the JITs / thunk generators.

  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::supportsFloatingPoint):
(JSC::MacroAssemblerARM::supportsFloatingPointTruncate):
(JSC::MacroAssemblerARM::supportsFloatingPointSqrt):
(JSC::MacroAssemblerARM::supportsFloatingPointAbs):
(JSC::MacroAssemblerARM::absDouble):

  • Renamed supportsFloatingPointAbs, make these methods static so that we can check the JIT's capabilites before we begin compilation.
  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::supportsFloatingPoint):
(JSC::MacroAssemblerARMv7::supportsFloatingPointTruncate):
(JSC::MacroAssemblerARMv7::supportsFloatingPointSqrt):
(JSC::MacroAssemblerARMv7::supportsFloatingPointAbs):

  • Renamed supportsFloatingPointAbs, make these methods static so that we can check the JIT's capabilites before we begin compilation.
  • assembler/MacroAssemblerMIPS.h:

(JSC::MacroAssemblerMIPS::absDouble):
(JSC::MacroAssemblerMIPS::supportsFloatingPoint):
(JSC::MacroAssemblerMIPS::supportsFloatingPointTruncate):
(JSC::MacroAssemblerMIPS::supportsFloatingPointSqrt):
(JSC::MacroAssemblerMIPS::supportsFloatingPointAbs):

  • Renamed supportsFloatingPointAbs, make these methods static so that we can check the JIT's capabilites before we begin compilation.
  • assembler/MacroAssemblerSH4.h:

(JSC::MacroAssemblerSH4::supportsFloatingPoint):
(JSC::MacroAssemblerSH4::supportsFloatingPointTruncate):
(JSC::MacroAssemblerSH4::supportsFloatingPointSqrt):
(JSC::MacroAssemblerSH4::supportsFloatingPointAbs):
(JSC::MacroAssemblerSH4::absDouble):

  • Renamed supportsFloatingPointAbs, make these methods static so that we can check the JIT's capabilites before we begin compilation.
  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::absDouble):
(JSC::MacroAssemblerX86::supportsFloatingPoint):
(JSC::MacroAssemblerX86::supportsFloatingPointTruncate):
(JSC::MacroAssemblerX86::supportsFloatingPointSqrt):
(JSC::MacroAssemblerX86::supportsFloatingPointAbs):

  • Made supports* methods static so that we can check the JIT's capabilites before we begin compilation. Added absDouble.
  • assembler/MacroAssemblerX86Common.h:
    • Removed andnotDouble, added s_maskSignBit.
  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::absDouble):
(JSC::MacroAssemblerX86_64::supportsFloatingPoint):
(JSC::MacroAssemblerX86_64::supportsFloatingPointTruncate):
(JSC::MacroAssemblerX86_64::supportsFloatingPointSqrt):
(JSC::MacroAssemblerX86_64::supportsFloatingPointAbs):

  • Made supports* methods static so that we can check the JIT's capabilites before we begin compilation. Added absDouble.
  • assembler/X86Assembler.h:

(JSC::X86Assembler::andpd_rr):
(JSC::X86Assembler::andpd_mr):

  • Added support for andpd instruction.
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsic):

  • Added checks for supportsFloatingPointAbs, supportsFloatingPointSqrt.
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • Switched to use doubleAbs, we can now also reuse the operand register for the result.
  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • Switched to use doubleAbs, we can now also reuse the operand register for the result.
  • jit/ThunkGenerators.cpp:
    • Switched to use doubleAbs.

(JSC::absThunkGenerator):

  • runtime/JSGlobalData.cpp:
    • Declared MacroAssemblerX86Common::s_maskSignBit here. This is a little ugly, but it doesn't seem worth adding a whole extra .cpp to the compile for just one constant.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r99333 r99647  
    565565    // Floating-point operations:
    566566
    567     bool supportsFloatingPoint() const { return true; }
     567    static bool supportsFloatingPoint() { return true; }
    568568    // On x86(_64) the MacroAssembler provides an interface to truncate a double to an integer.
    569569    // If a value is not representable as an integer, and possibly for some values that are,
     
    577577    // operations, and make clients go directly to the m_assembler to plant truncation instructions.
    578578    // In short, FIXME:.
    579     bool supportsFloatingPointTruncate() const { return false; }
    580 
    581     bool supportsFloatingPointSqrt() const
     579    static bool supportsFloatingPointTruncate() { return false; }
     580
     581    static bool supportsFloatingPointSqrt()
    582582    {
    583583        return false;
    584584    }
    585     bool supportsDoubleBitops() const { return false; }
     585    static bool supportsFloatingPointAbs() { return false; }
    586586
    587587    void loadDouble(ImplicitAddress address, FPRegisterID dest)
     
    664664    }
    665665   
    666     void andnotDouble(FPRegisterID, FPRegisterID) NO_RETURN_DUE_TO_ASSERT
     666    void absDouble(FPRegisterID, FPRegisterID) NO_RETURN_DUE_TO_ASSERT
    667667    {
    668668        ASSERT_NOT_REACHED();
Note: See TracChangeset for help on using the changeset viewer.