Ignore:
Timestamp:
May 19, 2010, 5:30:35 PM (15 years ago)
Author:
[email protected]
Message:

2010-05-19 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

emitJumpIfNotJSCell should special case constant immediate values
https://bugs.webkit.org/show_bug.cgi?id=39392
<rdar://problem/8001324>

Make emitJumpSlowCaseIfNotJSCell special case constant immediate
values, in addition to the immediate JSCell optimisation.

Also add assertions to make sure no one else produces code that
attempts to load constants from the register file.

  • jit/JITInlineMethods.h: (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
  • jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::emitJumpIfNotJSCell): (JSC::JSInterfaceJIT::emitLoadInt32): (JSC::JSInterfaceJIT::tagFor): (JSC::JSInterfaceJIT::payloadFor): (JSC::JSInterfaceJIT::emitLoadDouble): (JSC::JSInterfaceJIT::addressFor):
  • jit/ThunkGenerators.cpp:

2010-05-19 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

emitJumpIfNotJSCell should special case constant immediate values
https://bugs.webkit.org/show_bug.cgi?id=39392

Add tests for immediate constants being used where cells are expected.

  • fast/js/immediate-constant-instead-of-cell-expected.txt: Added.
  • fast/js/immediate-constant-instead-of-cell.html: Added.
  • fast/js/script-tests/immediate-constant-instead-of-cell.js: Added. ():
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JSInterfaceJIT.h

    r59527 r59798  
    192192    inline JSInterfaceJIT::Jump JSInterfaceJIT::emitJumpIfNotJSCell(unsigned virtualRegisterIndex)
    193193    {
     194        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
    194195        return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::CellTag));
    195196    }
     
    197198    inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst)
    198199    {
     200        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
    199201        loadPtr(payloadFor(virtualRegisterIndex), dst);
    200202        return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::Int32Tag));
    201203    }
    202204   
    203     inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(unsigned index, RegisterID base)
    204     {
    205         return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
    206     }
    207    
    208     inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned index, RegisterID base)
    209     {
    210         return Address(base, (index * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
     205    inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(unsigned virtualRegisterIndex, RegisterID base)
     206    {
     207        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     208        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
     209    }
     210   
     211    inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
     212    {
     213        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     214        return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
    211215    }
    212216
    213217    inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch)
    214218    {
     219        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
    215220        loadPtr(tagFor(virtualRegisterIndex), scratch);
    216221        Jump isDouble = branch32(Below, scratch, Imm32(JSValue::LowestTag));
     
    298303
    299304#if !USE(JSVALUE32_64)
    300     inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned index, RegisterID base)
    301     {
    302         return addressFor(index, base);
    303     }
    304 #endif
    305 
    306     inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(unsigned index, RegisterID base)
    307     {
    308         return Address(base, (index * sizeof(Register)));
     305    inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
     306    {
     307        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     308        return addressFor(virtualRegisterIndex, base);
     309    }
     310#endif
     311
     312    inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(unsigned virtualRegisterIndex, RegisterID base)
     313    {
     314        ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
     315        return Address(base, (virtualRegisterIndex * sizeof(Register)));
    309316    }
    310317
Note: See TracChangeset for help on using the changeset viewer.