Ignore:
Timestamp:
Oct 13, 2010, 11:45:26 PM (15 years ago)
Author:
[email protected]
Message:

2010-10-13 David Goodwin <[email protected]>

Reviewed by Oliver Hunt.

ARMv7 JIT should generated conditional branches when possible
https://bugs.webkit.org/show_bug.cgi?id=47384

Use different jump padding sizes for conditional and unconditional
jumps (12 bytes and 10 bytes respectively). This allows the JIT to
include the IT instruction as part of the conditional jump sequence
which in turn allows it to optimize away the IT using an ARMv7
conditional branch instruction. Use 2-byte B(T1) and 4-byte B(T3) for
conditional branches when displacement is in range. Also use IT/B(T4)
for conditional branch when displacement does not fit in B(T3).

For unconditional jump, instruction selection options are:
B(T2), B(T4), MOVW/MOVT/BX. For conditional jump, instruction selection
options are: B(T1), B(T3), IT/B(T4), ITTT/MOVW/MOVT/BX.

  • assembler/ARMv7Assembler.cpp:
  • assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::JmpSrc::JmpSrc): (JSC::ARMv7Assembler::ifThenElse): (JSC::ARMv7Assembler::jumpSizeDelta): (JSC::ARMv7Assembler::canCompact): (JSC::ARMv7Assembler::computeJumpType): (JSC::ARMv7Assembler::link): (JSC::ARMv7Assembler::canBeJumpT1): (JSC::ARMv7Assembler::canBeJumpT3): (JSC::ARMv7Assembler::canBeJumpT4): (JSC::ARMv7Assembler::linkJumpT1): (JSC::ARMv7Assembler::linkJumpT3): (JSC::ARMv7Assembler::linkJumpT4): (JSC::ARMv7Assembler::linkConditionalJumpT4): (JSC::ARMv7Assembler::linkBX): (JSC::ARMv7Assembler::linkConditionalBX): (JSC::ARMv7Assembler::linkJumpAbsolute):
  • assembler/LinkBuffer.h: (JSC::LinkBuffer::linkCode):
  • assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::canCompact): (JSC::MacroAssemblerARMv7::computeJumpType): (JSC::MacroAssemblerARMv7::jumpSizeDelta): (JSC::MacroAssemblerARMv7::jump): (JSC::MacroAssemblerARMv7::nearCall): (JSC::MacroAssemblerARMv7::call): (JSC::MacroAssemblerARMv7::ret): (JSC::MacroAssemblerARMv7::tailRecursiveCall): (JSC::MacroAssemblerARMv7::makeJump): (JSC::MacroAssemblerARMv7::makeBranch):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/LinkBuffer.h

    r66150 r69743  
    11/*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    236236           
    237237            JumpLinkType jumpLinkType = m_assembler->computeJumpType(jumpsToLink[i], linkBase + writePtr, target);
    238 
    239             // Step back in the write stream
    240             int32_t delta = m_assembler->jumpSizeDelta(jumpLinkType);
    241             if (delta) {
    242                 writePtr -= delta;
    243                 m_assembler->recordLinkOffsets(jumpsToLink[i].from() - delta, readPtr, readPtr - writePtr);
     238            // Compact branch if we can...
     239            if (m_assembler->canCompact(jumpsToLink[i].type())) {
     240                // Step back in the write stream
     241                int32_t delta = m_assembler->jumpSizeDelta(jumpsToLink[i].type(), jumpLinkType);
     242                if (delta) {
     243                    writePtr -= delta;
     244                    m_assembler->recordLinkOffsets(jumpsToLink[i].from() - delta, readPtr, readPtr - writePtr);
     245                }
    244246            }
    245247            jumpsToLink[i].setFrom(writePtr);
Note: See TracChangeset for help on using the changeset viewer.