Changeset 95201 in webkit


Ignore:
Timestamp:
Sep 15, 2011 10:58:27 AM (13 years ago)
Author:
ggaren@apple.com
Message:

Value chaining for JSValue32_64 bitops.

Reviewed by Sam Weinig.

SunSpider says 2.3% faster, v8 ~1% faster (mostly due to crypto).

  • jit/JIT.h:
  • jit/JITInlineMethods.h:

(JSC::JIT::emitStoreAndMapInt32): New int32 helper function for stores
that can chain their results, which is the common case.

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emit_op_lshift):
(JSC::JIT::emitRightShift):
(JSC::JIT::emit_op_bitand):
(JSC::JIT::emit_op_bitor):
(JSC::JIT::emit_op_bitxor):
(JSC::JIT::emit_op_bitnot):
(JSC::JIT::emit_op_pre_inc):
(JSC::JIT::emit_op_pre_dec): Deployed new function.
(JSC::JIT::emit_op_post_inc):
(JSC::JIT::emit_op_post_dec): Had to reorder these functions so they
computed their result values last, to make them elligible for chaining.

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r95194 r95201  
     12011-09-15  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Value chaining for JSValue32_64 bitops.
     4
     5        Reviewed by Sam Weinig.
     6       
     7        SunSpider says 2.3% faster, v8 ~1% faster (mostly due to crypto).
     8
     9        * jit/JIT.h:
     10        * jit/JITInlineMethods.h:
     11        (JSC::JIT::emitStoreAndMapInt32): New int32 helper function for stores
     12        that can chain their results, which is the common case.
     13
     14        * jit/JITArithmetic32_64.cpp:
     15        (JSC::JIT::emit_op_lshift):
     16        (JSC::JIT::emitRightShift):
     17        (JSC::JIT::emit_op_bitand):
     18        (JSC::JIT::emit_op_bitor):
     19        (JSC::JIT::emit_op_bitxor):
     20        (JSC::JIT::emit_op_bitnot):
     21        (JSC::JIT::emit_op_pre_inc):
     22        (JSC::JIT::emit_op_pre_dec): Deployed new function.
     23        (JSC::JIT::emit_op_post_inc):
     24        (JSC::JIT::emit_op_post_dec): Had to reorder these functions so they
     25        computed their result values last, to make them elligible for chaining.
     26
    1272011-09-15  Adam Roben  <aroben@apple.com>
    228
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r95016 r95201  
    334334        void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false);
    335335        void emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32 = false);
     336        void emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength);
    336337        void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
    337338        void emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool = false);
  • trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp

    r90371 r95201  
    176176        addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    177177        lshift32(Imm32(getConstantOperand(op2).asInt32()), regT0);
    178         emitStoreInt32(dst, regT0, dst == op1);
     178        emitStoreAndMapInt32(dst, regT1, regT0, dst == op1, OPCODE_LENGTH(op_lshift));
    179179        return;
    180180    }
     
    185185    addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
    186186    lshift32(regT2, regT0);
    187     emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
     187    emitStoreAndMapInt32(dst, regT1, regT0, dst == op1 || dst == op2, OPCODE_LENGTH(op_lshift));
    188188}
    189189
     
    229229            rshift32(Imm32(shift & 0x1f), regT0);
    230230        }
    231         emitStoreInt32(dst, regT0, dst == op1);
     231        emitStoreAndMapInt32(dst, regT1, regT0, dst == op1, OPCODE_LENGTH(op_rshift));
    232232        return;
    233233    }
     
    242242    } else
    243243        rshift32(regT2, regT0);
    244     emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
     244    emitStoreAndMapInt32(dst, regT1, regT0, dst == op1, OPCODE_LENGTH(op_rshift));
    245245}
    246246
     
    343343        addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    344344        and32(Imm32(constant), regT0);
    345         emitStoreInt32(dst, regT0, (op == dst));
     345        emitStoreAndMapInt32(dst, regT1, regT0, dst == op, OPCODE_LENGTH(op_bitand));
    346346        return;
    347347    }
     
    351351    addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
    352352    and32(regT2, regT0);
    353     emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
     353    emitStoreAndMapInt32(dst, regT1, regT0, (op1 == dst || op2 == dst), OPCODE_LENGTH(op_bitand));
    354354}
    355355
     
    384384        addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    385385        or32(Imm32(constant), regT0);
    386         emitStoreInt32(dst, regT0, (op == dst));
     386        emitStoreAndMapInt32(dst, regT1, regT0, op == dst, OPCODE_LENGTH(op_bitor));
    387387        return;
    388388    }
     
    392392    addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
    393393    or32(regT2, regT0);
    394     emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
     394    emitStoreAndMapInt32(dst, regT1, regT0, (op1 == dst || op2 == dst), OPCODE_LENGTH(op_bitor));
    395395}
    396396
     
    425425        addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    426426        xor32(Imm32(constant), regT0);
    427         emitStoreInt32(dst, regT0, (op == dst));
     427        emitStoreAndMapInt32(dst, regT1, regT0, op == dst, OPCODE_LENGTH(op_bitxor));
    428428        return;
    429429    }
     
    433433    addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
    434434    xor32(regT2, regT0);
    435     emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
     435    emitStoreAndMapInt32(dst, regT1, regT0, (op1 == dst || op2 == dst), OPCODE_LENGTH(op_bitxor));
    436436}
    437437
     
    463463
    464464    not32(regT0);
    465     emitStoreInt32(dst, regT0, (dst == src));
     465    emitStoreAndMapInt32(dst, regT1, regT0, dst == src, OPCODE_LENGTH(op_bitnot));
    466466}
    467467
     
    490490        return;
    491491
    492     emitStoreInt32(dst, regT0);
    493 
    494     addSlowCase(branchAdd32(Overflow, TrustedImm32(1), regT0));
    495     emitStoreInt32(srcDst, regT0, true);
     492    move(regT0, regT2);
     493    addSlowCase(branchAdd32(Overflow, TrustedImm32(1), regT2));
     494    emitStoreInt32(srcDst, regT2, true);
     495
     496    emitStoreAndMapInt32(dst, regT1, regT0, false, OPCODE_LENGTH(op_post_inc));
    496497}
    497498
     
    524525        return;
    525526
    526     emitStoreInt32(dst, regT0);
    527 
    528     addSlowCase(branchSub32(Overflow, TrustedImm32(1), regT0));
    529     emitStoreInt32(srcDst, regT0, true);
     527    move(regT0, regT2);
     528    addSlowCase(branchSub32(Overflow, TrustedImm32(1), regT2));
     529    emitStoreInt32(srcDst, regT2, true);
     530
     531    emitStoreAndMapInt32(dst, regT1, regT0, false, OPCODE_LENGTH(op_post_dec));
    530532}
    531533
     
    555557    addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    556558    addSlowCase(branchAdd32(Overflow, TrustedImm32(1), regT0));
    557     emitStoreInt32(srcDst, regT0, true);
     559    emitStoreAndMapInt32(srcDst, regT1, regT0, true, OPCODE_LENGTH(op_pre_inc));
    558560}
    559561
     
    580582    addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
    581583    addSlowCase(branchSub32(Overflow, TrustedImm32(1), regT0));
    582     emitStoreInt32(srcDst, regT0, true);
     584    emitStoreAndMapInt32(srcDst, regT1, regT0, true, OPCODE_LENGTH(op_pre_dec));
    583585}
    584586
  • trunk/Source/JavaScriptCore/jit/JITInlineMethods.h

    r95134 r95201  
    572572}
    573573
     574inline void JIT::emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength)
     575{
     576    emitStoreInt32(index, payload, indexIsInt32);
     577    map(m_bytecodeOffset + opcodeLength, index, tag, payload);
     578}
     579
    574580inline void JIT::emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32)
    575581{
Note: See TracChangeset for help on using the changeset viewer.