Changeset 39061 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Dec 5, 2008, 7:25:23 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-05 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Ordering of branch operands in MacroAssembler in unnecessarily inconsistent.

je, jg etc take an immediate operand as the second argument, but for the
equality branches (je, jne) the immediate operand was the first argument. This
was unnecessarily inconsistent. Change je, jne methods to take the immediate
as the second argument.

https://bugs.webkit.org/show_bug.cgi?id=22703

  • assembler/MacroAssembler.h: (JSC::MacroAssembler::je32): (JSC::MacroAssembler::jne32):
  • jit/JIT.cpp: (JSC::JIT::compileOpStrictEq):
  • wrec/WRECGenerator.cpp: (JSC::WREC::Generator::generateEnter): (JSC::WREC::Generator::generateNonGreedyQuantifier): (JSC::WREC::Generator::generateGreedyQuantifier): (JSC::WREC::Generator::generatePatternCharacterPair): (JSC::WREC::Generator::generatePatternCharacter): (JSC::WREC::Generator::generateCharacterClassInvertedRange): (JSC::WREC::Generator::generateCharacterClassInverted): (JSC::WREC::Generator::generateAssertionBOL): (JSC::WREC::Generator::generateAssertionWordBoundary):
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39058 r39061  
     12008-12-05  Gavin Barraclough  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Ordering of branch operands in MacroAssembler in unnecessarily  inconsistent.
     6
     7        je, jg etc take an immediate operand as the second argument, but for the
     8        equality branches (je, jne) the immediate operand was the first argument.  This
     9        was unnecessarily inconsistent.  Change je, jne methods to take the immediate
     10        as the second argument.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=22703
     13
     14        * assembler/MacroAssembler.h:
     15        (JSC::MacroAssembler::je32):
     16        (JSC::MacroAssembler::jne32):
     17        * jit/JIT.cpp:
     18        (JSC::JIT::compileOpStrictEq):
     19        * wrec/WRECGenerator.cpp:
     20        (JSC::WREC::Generator::generateEnter):
     21        (JSC::WREC::Generator::generateNonGreedyQuantifier):
     22        (JSC::WREC::Generator::generateGreedyQuantifier):
     23        (JSC::WREC::Generator::generatePatternCharacterPair):
     24        (JSC::WREC::Generator::generatePatternCharacter):
     25        (JSC::WREC::Generator::generateCharacterClassInvertedRange):
     26        (JSC::WREC::Generator::generateCharacterClassInverted):
     27        (JSC::WREC::Generator::generateAssertionBOL):
     28        (JSC::WREC::Generator::generateAssertionWordBoundary):
     29
    1302008-12-05  Gavin Barraclough  <[email protected]>
    231
  • trunk/JavaScriptCore/assembler/MacroAssembler.h

    r39058 r39061  
    579579    }
    580580   
    581     Jump je32(Imm32 imm, RegisterID reg)
     581    Jump je32(RegisterID reg, Imm32 imm)
    582582    {
    583583        compareImm32ForBranchEquality(reg, imm.m_value);
     
    651651    }
    652652
    653     Jump jne32(Imm32 imm, RegisterID reg)
     653    Jump jne32(RegisterID reg, Imm32 imm)
    654654    {
    655655        compareImm32ForBranchEquality(reg, imm.m_value);
     
    703703    //     jne32(reg1, reg2).linkTo(topOfLoop);
    704704
    705     void je32(Imm32 imm, RegisterID op2, Label target)
    706     {
    707         je32(imm, op2).linkTo(target, this);
     705    void je32(RegisterID op1, Imm32 imm, Label target)
     706    {
     707        je32(op1, imm).linkTo(target, this);
    708708    }
    709709
     
    728728    }
    729729
    730     void jne32(Imm32 imm, RegisterID op2, Label target)
    731     {
    732         jne32(imm, op2).linkTo(target, this);
     730    void jne32(RegisterID op1, Imm32 imm, Label target)
     731    {
     732        jne32(op1, imm).linkTo(target, this);
    733733    }
    734734
  • trunk/JavaScriptCore/jit/JIT.cpp

    r39058 r39061  
    236236    firstNotImmediate.link(this);
    237237    emitJumpSlowCaseIfJSCell(X86::edx, i);
    238     m_slowCases.append(SlowCaseEntry(je32(Imm32(asInteger(JSImmediate::zeroImmediate())), X86::edx), i));
     238    m_slowCases.append(SlowCaseEntry(je32(X86::edx, Imm32(asInteger(JSImmediate::zeroImmediate()))), i));
    239239    Jump firstWasNotImmediate = jump();
    240240
     
    242242    // If eax is 0 jump to a slow case, otherwise these values are not equal.
    243243    secondNotImmediate.link(this);
    244     m_slowCases.append(SlowCaseEntry(je32(Imm32(asInteger(JSImmediate::zeroImmediate())), X86::eax), i));
     244    m_slowCases.append(SlowCaseEntry(je32(X86::eax, Imm32(asInteger(JSImmediate::zeroImmediate()))), i));
    245245
    246246    // We get here if the two values are different immediates, or one is 0 and the other is a JSCell.
  • trunk/JavaScriptCore/wrec/WRECGenerator.cpp

    r39043 r39061  
    7171#ifndef NDEBUG
    7272    // ASSERT that the output register is not null.
    73     Jump outputNotNull = jne32(Imm32(0), output);
     73    Jump outputNotNull = jne32(output, Imm32(0));
    7474    breakpoint();
    7575    outputNotNull.link(this);
     
    182182    // (3.2) if there is a limit, and we have reached it, game over.
    183183    if (max != Quantifier::noMaxSpecified) {
    184         je32(Imm32(max), repeatCount, quantifierFailed);
     184        je32(repeatCount, Imm32(max), quantifierFailed);
    185185    }
    186186
     
    236236        doneReadingAtoms.append(jump());
    237237    else {
    238         jne32(Imm32(max), repeatCount, readAnAtom);
     238        jne32(repeatCount, Imm32(max), readAnAtom);
    239239        doneReadingAtoms.append(jump());
    240240    }
     
    322322    int pair = ch1 | (ch2 << 16);
    323323
    324     failures.append(jne32(Imm32(pair), character));
     324    failures.append(jne32(character, Imm32(pair)));
    325325    return true;
    326326}
     
    344344        } else if (!isASCII(ch) && ((lower = Unicode::toLower(ch)) != (upper = Unicode::toUpper(ch)))) {
    345345            // handle unicode case sentitive characters - branch to success on upper
    346             isUpper = je32(Imm32(upper), character);
     346            isUpper = je32(character, Imm32(upper));
    347347            hasUpper = true;
    348348            ch = lower;
     
    351351   
    352352    // checks for ch, or lower case version of ch, if insensitive
    353     failures.append(jne32(Imm32((unsigned short)ch), character));
     353    failures.append(jne32(character, Imm32((unsigned short)ch)));
    354354
    355355    if (m_parser.ignoreCase() && hasUpper) {
     
    380380           
    381381            do {
    382                 matchDest.append(je32(Imm32((unsigned short)matches[*matchIndex]), character));
     382                matchDest.append(je32(character, Imm32((unsigned short)matches[*matchIndex])));
    383383                ++*matchIndex;
    384384            } while ((*matchIndex < matchCount) && (matches[*matchIndex] < lo));
     
    418418            for (unsigned i = 0; i < charClass.numMatchesUnicode; ++i) {
    419419                UChar ch = charClass.matchesUnicode[i];
    420                 matchDest.append(je32(Imm32(ch), character));
     420                matchDest.append(je32(character, Imm32(ch)));
    421421            }
    422422        }
     
    442442        generateCharacterClassInvertedRange(failures, matchDest, charClass.ranges, charClass.numRanges, &matchIndex, charClass.matches, charClass.numMatches);
    443443        while (matchIndex < charClass.numMatches)
    444             matchDest.append(je32(Imm32((unsigned short)charClass.matches[matchIndex++]), character));
     444            matchDest.append(je32(character, Imm32((unsigned short)charClass.matches[matchIndex++])));
    445445
    446446        failures.link(this);
     
    459459                    continue;
    460460            }
    461             matchDest.append(je32(Imm32((unsigned short)ch), character));
     461            matchDest.append(je32(character, Imm32((unsigned short)ch)));
    462462        }
    463463
     
    465465            or32(Imm32(32), character);
    466466            for (unsigned i = 0; i < countAZaz; ++i)
    467                 matchDest.append(je32(Imm32(matchesAZaz[i]), character));
     467                matchDest.append(je32(character, Imm32(matchesAZaz[i])));
    468468        }
    469469    }
     
    549549
    550550        // begin of input == success
    551         previousIsNewline.append(je32(Imm32(0), index));
     551        previousIsNewline.append(je32(index, Imm32(0)));
    552552
    553553        // now check prev char against newline characters.
     
    559559        previousIsNewline.link(this);
    560560    } else
    561         failures.append(jne32(Imm32(0), index));
     561        failures.append(jne32(index, Imm32(0)));
    562562}
    563563
     
    584584
    585585    // (1.1) check for begin of input
    586     Jump atBegin = je32(Imm32(0), index);
     586    Jump atBegin = je32(index, Imm32(0));
    587587    // (1.2) load the last char, and chck if is word character
    588588    load16(BaseIndex(input, index, TimesTwo, -2), character);
Note: See TracChangeset for help on using the changeset viewer.