⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 197654 in webkit


Ignore:
Timestamp:
Mar 6, 2016, 6:43:09 PM (11 years ago)
Author:
benjamin@webkit.org
Message:

[JSC] Remove a superfluous Move in front of every double unboxing
https://bugs.webkit.org/show_bug.cgi?id=155064

Reviewed by Saam Barati.

Double unboxing was always doing:

Move source, scratch
Add64 tag, scratch
IntToDouble scratch, fp

We do not need to "Move" to copy the source.
Both x86 and ARM64 have an efficient 3 operands Add instruction.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileValueToInt32):
(JSC::DFG::SpeculativeJIT::compileDoubleRep):
(JSC::DFG::SpeculativeJIT::speculateRealNumber):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::unboxDouble):

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::unboxDoubleWithoutAssertions):
(JSC::AssemblyHelpers::unboxDouble):
(JSC::AssemblyHelpers::unboxDoubleNonDestructive):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r197653 r197654  
     12016-03-06  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        [JSC] Remove a superfluous Move in front of every double unboxing
     4        https://bugs.webkit.org/show_bug.cgi?id=155064
     5
     6        Reviewed by Saam Barati.
     7
     8        Double unboxing was always doing:
     9            Move source, scratch
     10            Add64 tag, scratch
     11            IntToDouble scratch, fp
     12
     13        We do not need to "Move" to copy the source.
     14        Both x86 and ARM64 have an efficient 3 operands Add instruction.
     15
     16        * dfg/DFGSpeculativeJIT.cpp:
     17        (JSC::DFG::SpeculativeJIT::compileValueToInt32):
     18        (JSC::DFG::SpeculativeJIT::compileDoubleRep):
     19        (JSC::DFG::SpeculativeJIT::speculateRealNumber):
     20        * dfg/DFGSpeculativeJIT.h:
     21        (JSC::DFG::SpeculativeJIT::unboxDouble):
     22        * jit/AssemblyHelpers.h:
     23        (JSC::AssemblyHelpers::unboxDoubleWithoutAssertions):
     24        (JSC::AssemblyHelpers::unboxDouble):
     25        (JSC::AssemblyHelpers::unboxDoubleNonDestructive):
     26
    1272016-03-06  Benjamin Poulain  <benjamin@webkit.org>
    228
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r197653 r197654  
    20142014
    20152015            // First, if we get here we have a double encoded as a JSValue
    2016             m_jit.move(gpr, resultGpr);
    2017             unboxDouble(resultGpr, fpr);
     2016            unboxDouble(gpr, resultGpr, fpr);
    20182017
    20192018            silentSpillAllRegisters(resultGpr);
     
    21722171        GPRTemporary temp(this);
    21732172        GPRReg tempGPR = temp.gpr();
    2174         m_jit.move(op1Regs.gpr(), tempGPR);
    2175         m_jit.unboxDoubleWithoutAssertions(tempGPR, resultFPR);
     2173        m_jit.unboxDoubleWithoutAssertions(op1Regs.gpr(), tempGPR, resultFPR);
    21762174#else
    21772175        FPRTemporary temp(this);
     
    22502248                m_jit.branchTest64(MacroAssembler::Zero, op1GPR, GPRInfo::tagTypeNumberRegister));
    22512249        }
    2252    
    2253         m_jit.move(op1GPR, tempGPR);
    2254         unboxDouble(tempGPR, resultFPR);
     2250
     2251        unboxDouble(op1GPR, tempGPR, resultFPR);
    22552252        done.append(m_jit.jump());
    22562253   
     
    65846581    GPRTemporary temp(this);
    65856582    GPRReg tempGPR = temp.gpr();
    6586     m_jit.move(op1Regs.gpr(), tempGPR);
    6587     m_jit.unboxDoubleWithoutAssertions(tempGPR, resultFPR);
     6583    m_jit.unboxDoubleWithoutAssertions(op1Regs.gpr(), tempGPR, resultFPR);
    65886584#else
    65896585    FPRTemporary temp(this);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r197649 r197654  
    453453        return m_jit.boxDouble(fpr, gpr);
    454454    }
    455     FPRReg unboxDouble(GPRReg gpr, FPRReg fpr)
    456     {
    457         return m_jit.unboxDouble(gpr, fpr);
     455    FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
     456    {
     457        return m_jit.unboxDouble(gpr, resultGPR, fpr);
    458458    }
    459459    GPRReg boxDouble(FPRReg fpr)
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h

    r196513 r197654  
    10381038        return gpr;
    10391039    }
    1040     FPRReg unboxDoubleWithoutAssertions(GPRReg gpr, FPRReg fpr)
    1041     {
    1042         add64(GPRInfo::tagTypeNumberRegister, gpr);
    1043         move64ToDouble(gpr, fpr);
     1040    FPRReg unboxDoubleWithoutAssertions(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
     1041    {
     1042        add64(GPRInfo::tagTypeNumberRegister, gpr, resultGPR);
     1043        move64ToDouble(resultGPR, fpr);
    10441044        return fpr;
    10451045    }
    1046     FPRReg unboxDouble(GPRReg gpr, FPRReg fpr)
     1046    FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
    10471047    {
    10481048        jitAssertIsJSDouble(gpr);
    1049         return unboxDoubleWithoutAssertions(gpr, fpr);
     1049        return unboxDoubleWithoutAssertions(gpr, resultGPR, fpr);
    10501050    }
    10511051   
     
    10551055    }
    10561056
    1057     void unboxDoubleNonDestructive(JSValueRegs regs, FPRReg destFPR, GPRReg scratchGPR, FPRReg)
    1058     {
    1059         move(regs.payloadGPR(), scratchGPR);
    1060         unboxDouble(scratchGPR, destFPR);
     1057    void unboxDoubleNonDestructive(JSValueRegs regs, FPRReg destFPR, GPRReg resultGPR, FPRReg)
     1058    {
     1059        unboxDouble(regs.payloadGPR(), resultGPR, destFPR);
    10611060    }
    10621061
Note: See TracChangeset for help on using the changeset viewer.