Ignore:
Timestamp:
Mar 20, 2017, 11:58:59 AM (8 years ago)
Author:
[email protected]
Message:

Graph coloring should use coalescable moves when spilling
https://bugs.webkit.org/show_bug.cgi?id=169820

Reviewed by Michael Saboff.

This makes our graph coloring register allocator use a new family of move instructions when
spilling both operands of the move. It's a three-operand move:

Move (src), (dst), %scratch

Previously, if both operands got spilled, we would emit a new instruction to load or store that
spill slot. But this made it hard for allocateStack to see that the two spill locations are
coalescable. This new kind of instruction makes it obvious that it's a coalescable move.

This change implements the coalescing of spill slots inside allocateStack.

This is an outrageous speed-up on the tsf_ir_speed benchmark from http://filpizlo.com/tsf/. This
is an interesting benchmark because it has a super ugly interpreter loop with ~20 live variables
carried around the loop back edge. This change makes that interpreter run 5x faster.

This isn't a speed-up on any other benchmarks. It also doesn't regress anything. Compile time is
neither progressed or regressed, since the coalescing is super cheap, and this does not add any
significant new machinery to the register allocator (it's just a small change to spill codegen).
Overall on our wasm benchmarks, this is a 16% throughput progression.

  • assembler/MacroAssembler.h:

(JSC::MacroAssembler::move):
(JSC::MacroAssembler::move32):
(JSC::MacroAssembler::moveFloat):
(JSC::MacroAssembler::moveDouble):

  • b3/air/AirAllocateRegistersByGraphColoring.cpp:

(JSC::B3::Air::allocateRegistersByGraphColoring):

  • b3/air/AirAllocateStack.cpp:

(JSC::B3::Air::allocateStack):

  • b3/air/AirInst.cpp:

(JSC::B3::Air::Inst::hasEarlyDef):
(JSC::B3::Air::Inst::hasLateUseOrDef):
(JSC::B3::Air::Inst::needsPadding):

  • b3/air/AirInst.h:
  • b3/air/AirOpcode.opcodes:
  • b3/air/AirPadInterference.cpp:

(JSC::B3::Air::padInterference):

  • runtime/Options.h:
File:
1 edited

Legend:

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

    r213753 r214187  
    112112    using MacroAssemblerBase::compare32;
    113113    using MacroAssemblerBase::move;
     114    using MacroAssemblerBase::moveDouble;
    114115    using MacroAssemblerBase::add32;
    115116    using MacroAssemblerBase::mul32;
     
    488489    }
    489490
     491    void move(Address src, Address dest, RegisterID scratch)
     492    {
     493        loadPtr(src, scratch);
     494        storePtr(scratch, dest);
     495    }
     496   
     497    void move32(Address src, Address dest, RegisterID scratch)
     498    {
     499        load32(src, scratch);
     500        store32(scratch, dest);
     501    }
     502   
     503    void moveFloat(Address src, Address dest, FPRegisterID scratch)
     504    {
     505        loadFloat(src, scratch);
     506        storeFloat(scratch, dest);
     507    }
     508   
     509    void moveDouble(Address src, Address dest, FPRegisterID scratch)
     510    {
     511        loadDouble(src, scratch);
     512        storeDouble(scratch, dest);
     513    }
     514
    490515    // Ptr methods
    491516    // On 32-bit platforms (i.e. x86), these methods directly map onto their 32-bit equivalents.
     
    649674        move(Imm32(imm.asTrustedImmPtr()), dest);
    650675    }
    651 
     676   
    652677    void comparePtr(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
    653678    {
Note: See TracChangeset for help on using the changeset viewer.