Changeset 90586 in webkit


Ignore:
Timestamp:
Jul 7, 2011 1:26:19 PM (13 years ago)
Author:
oliver@apple.com
Message:

Encode jump and link sizes into the appropriate enums
https://bugs.webkit.org/show_bug.cgi?id=64123

Reviewed by Sam Weinig.

Finally kill off the out of line jump and link size arrays,
so we can avoid icky loads and constant fold the linking arithmetic.

  • assembler/ARMv7Assembler.cpp:
  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::jumpSizeDelta):
(JSC::ARMv7Assembler::computeJumpType):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r90535 r90586  
     12011-07-07  Oliver Hunt  <oliver@apple.com>
     2
     3        Encode jump and link sizes into the appropriate enums
     4        https://bugs.webkit.org/show_bug.cgi?id=64123
     5
     6        Reviewed by Sam Weinig.
     7
     8        Finally kill off the out of line jump and link size arrays,
     9        so we can avoid icky loads and constant fold the linking arithmetic.
     10
     11        * assembler/ARMv7Assembler.cpp:
     12        * assembler/ARMv7Assembler.h:
     13        (JSC::ARMv7Assembler::jumpSizeDelta):
     14        (JSC::ARMv7Assembler::computeJumpType):
     15
    1162011-07-06  Juan C. Montemayor  <jmont@apple.com>
    217
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp

    r69743 r90586  
    3232namespace JSC {
    3333
    34 const int ARMv7Assembler::JumpSizes[] = { 0xffffffff, sizeof(uint16_t), sizeof(uint16_t),
    35     2 * sizeof(uint16_t), 2 * sizeof(uint16_t), 3 * sizeof(uint16_t), 5 * sizeof(uint16_t), 6 * sizeof(uint16_t) };
    36 const int ARMv7Assembler::JumpPaddingSizes[] = { 0, 5 * sizeof(uint16_t), 6 * sizeof(uint16_t),
    37     5 * sizeof(uint16_t), 6 * sizeof(uint16_t) };
    38 
    3934}
    4035
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r90426 r90586  
    446446    } Condition;
    447447
    448     enum JumpType { JumpFixed, JumpNoCondition, JumpCondition, JumpNoConditionFixedSize, JumpConditionFixedSize, JumpTypeCount };
    449     enum JumpLinkType { LinkInvalid, LinkJumpT1, LinkJumpT2, LinkJumpT3,
    450         LinkJumpT4, LinkConditionalJumpT4, LinkBX, LinkConditionalBX, JumpLinkTypeCount };
    451     static const int JumpSizes[JumpLinkTypeCount];
    452     static const int JumpPaddingSizes[JumpTypeCount];
     448#define JUMP_ENUM_WITH_SIZE(index, value) (((value) << 3) | (index))
     449#define JUMP_ENUM_SIZE(jump) ((jump) >> 3)
     450    enum JumpType { JumpFixed = JUMP_ENUM_WITH_SIZE(0, 0),
     451                    JumpNoCondition = JUMP_ENUM_WITH_SIZE(1, 5 * sizeof(uint16_t)),
     452                    JumpCondition = JUMP_ENUM_WITH_SIZE(2, 6 * sizeof(uint16_t)),
     453                    JumpNoConditionFixedSize = JUMP_ENUM_WITH_SIZE(3, 5 * sizeof(uint16_t)),
     454                    JumpConditionFixedSize = JUMP_ENUM_WITH_SIZE(4, 6 * sizeof(uint16_t))
     455    };
     456    enum JumpLinkType {
     457        LinkInvalid = JUMP_ENUM_WITH_SIZE(0, 0),
     458        LinkJumpT1 = JUMP_ENUM_WITH_SIZE(1, sizeof(uint16_t)),
     459        LinkJumpT2 = JUMP_ENUM_WITH_SIZE(2, sizeof(uint16_t)),
     460        LinkJumpT3 = JUMP_ENUM_WITH_SIZE(3, 2 * sizeof(uint16_t)),
     461        LinkJumpT4 = JUMP_ENUM_WITH_SIZE(4, 2 * sizeof(uint16_t)),
     462        LinkConditionalJumpT4 = JUMP_ENUM_WITH_SIZE(5, 3 * sizeof(uint16_t)),
     463        LinkBX = JUMP_ENUM_WITH_SIZE(6, 5 * sizeof(uint16_t)),
     464        LinkConditionalBX = JUMP_ENUM_WITH_SIZE(7, 6 * sizeof(uint16_t))
     465    };
     466
    453467    class LinkRecord {
    454468    public:
     
    471485        intptr_t m_from : 31;
    472486        intptr_t m_to : 31;
    473         JumpType m_type : 3;
    474         JumpLinkType m_linkType : 4;
     487        JumpType m_type : 8;
     488        JumpLinkType m_linkType : 8;
    475489        Condition m_condition : 16;
    476490    };
     
    15731587    }
    15741588   
    1575     int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return JumpPaddingSizes[jumpType] - JumpSizes[jumpLinkType]; }
     1589    int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return JUMP_ENUM_SIZE(jumpType) - JUMP_ENUM_SIZE(jumpLinkType); }
    15761590   
    15771591    // Assembler admin methods:
     
    16021616            return LinkConditionalBX;
    16031617       
    1604         const int paddingSize = JumpPaddingSizes[jumpType];
     1618        const int paddingSize = JUMP_ENUM_SIZE(jumpType);
    16051619        bool mayTriggerErrata = false;
    16061620       
    16071621        if (jumpType == JumpCondition) {
    16081622            // 2-byte conditional T1
    1609             const uint16_t* jumpT1Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT1]));
     1623            const uint16_t* jumpT1Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT1)));
    16101624            if (canBeJumpT1(jumpT1Location, to))
    16111625                return LinkJumpT1;
    16121626            // 4-byte conditional T3
    1613             const uint16_t* jumpT3Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT3]));
     1627            const uint16_t* jumpT3Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT3)));
    16141628            if (canBeJumpT3(jumpT3Location, to, mayTriggerErrata)) {
    16151629                if (!mayTriggerErrata)
     
    16181632            // 4-byte conditional T4 with IT
    16191633            const uint16_t* conditionalJumpT4Location =
    1620             reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkConditionalJumpT4]));
     1634            reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkConditionalJumpT4)));
    16211635            if (canBeJumpT4(conditionalJumpT4Location, to, mayTriggerErrata)) {
    16221636                if (!mayTriggerErrata)
     
    16251639        } else {
    16261640            // 2-byte unconditional T2
    1627             const uint16_t* jumpT2Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT2]));
     1641            const uint16_t* jumpT2Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT2)));
    16281642            if (canBeJumpT2(jumpT2Location, to))
    16291643                return LinkJumpT2;
    16301644            // 4-byte unconditional T4
    1631             const uint16_t* jumpT4Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT4]));
     1645            const uint16_t* jumpT4Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JUMP_ENUM_SIZE(LinkJumpT4)));
    16321646            if (canBeJumpT4(jumpT4Location, to, mayTriggerErrata)) {
    16331647                if (!mayTriggerErrata)
Note: See TracChangeset for help on using the changeset viewer.