Ignore:
Timestamp:
Dec 16, 2008, 4:03:34 PM (16 years ago)
Author:
[email protected]
Message:

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

Reviewed by Cameron Zwarich.

Make the JIT compile on x86-64.
This largely involves populting the missing calls in MacroAssembler.h.
In addition some reinterpret_casts need removing from the JIT, and the
repatching property access code will need to be fully compiled out for
now. The changes in interpret.cpp are to reorder the functions so that
the _generic forms come before all other property access methods, and
then to place all property access methods other than the generic forms
under control of the ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS macro.

No performance impact.

  • assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::putInt64Unchecked):
  • assembler/MacroAssembler.h: (JSC::MacroAssembler::loadPtr): (JSC::MacroAssembler::load32): (JSC::MacroAssembler::storePtr): (JSC::MacroAssembler::storePtrWithRepatch): (JSC::MacroAssembler::store32): (JSC::MacroAssembler::poke): (JSC::MacroAssembler::move): (JSC::MacroAssembler::testImm64): (JSC::MacroAssembler::jePtr): (JSC::MacroAssembler::jnePtr): (JSC::MacroAssembler::jnzPtr): (JSC::MacroAssembler::jzPtr):
  • assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::cmpq_rr): (JSC::X86Assembler::cmpq_rm): (JSC::X86Assembler::cmpq_im): (JSC::X86Assembler::testq_i32m): (JSC::X86Assembler::movl_mEAX): (JSC::X86Assembler::movl_i32r): (JSC::X86Assembler::movl_EAXm): (JSC::X86Assembler::movq_rm): (JSC::X86Assembler::movq_mEAX): (JSC::X86Assembler::movq_mr): (JSC::X86Assembler::movq_i64r): (JSC::X86Assembler::movl_mr): (JSC::X86Assembler::X86InstructionFormatter::oneByteOp64): (JSC::X86Assembler::X86InstructionFormatter::immediate64):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::cti_op_put_by_id_generic): (JSC::Interpreter::cti_op_get_by_id_generic): (JSC::Interpreter::cti_op_put_by_id): (JSC::Interpreter::cti_op_put_by_id_second):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JITCall.cpp: (JSC::JIT::compileOpCallSetupArgs): (JSC::JIT::compileOpCall):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compilePutByIdHotPath):
  • runtime/JSImmediate.h: (JSC::JSImmediate::makeInt):
File:
1 edited

Legend:

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

    r39319 r39342  
    111111        OP_GROUP1A_Ev                   = 0x8F,
    112112        OP_CDQ                          = 0x99,
     113        OP_MOV_EAXOv                    = 0xA1,
     114        OP_MOV_OvEAX                    = 0xA3,
     115        OP_MOV_EAXIv                    = 0xB8,
    113116        OP_GROUP2_EvIb                  = 0xC1,
    114117        OP_RET                          = 0xC3,
     
    499502    }
    500503
    501 #if !PLATFORM(X86_64)
     504#if PLATFORM(X86_64)
     505    void cmpq_rr(RegisterID src, RegisterID dst)
     506    {
     507        m_formatter.oneByteOp64(OP_CMP_EvGv, src, dst);
     508    }
     509
     510    void cmpq_rm(RegisterID src, int offset, RegisterID base)
     511    {
     512        m_formatter.oneByteOp64(OP_CMP_EvGv, src, base, offset);
     513    }
     514
     515    void cmpq_im(int imm, int offset, RegisterID base)
     516    {
     517        if (CAN_SIGN_EXTEND_8_32(imm)) {
     518            m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, offset);
     519            m_formatter.immediate8(imm);
     520        } else {
     521            m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, offset);
     522            m_formatter.immediate32(imm);
     523        }
     524    }
     525
     526    void cmpq_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
     527    {
     528        if (CAN_SIGN_EXTEND_8_32(imm)) {
     529            m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
     530            m_formatter.immediate8(imm);
     531        } else {
     532            m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
     533            m_formatter.immediate32(imm);
     534        }
     535    }
     536#else
    502537    void cmpl_im(int imm, void* addr)
    503538    {
     
    552587        m_formatter.immediate32(imm);
    553588    }
     589
     590    void testq_i32m(int imm, int offset, RegisterID base)
     591    {
     592        m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, offset);
     593        m_formatter.immediate32(imm);
     594    }
     595
     596    void testq_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale)
     597    {
     598        m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, index, scale, offset);
     599        m_formatter.immediate32(imm);
     600    }
    554601#endif
    555602
     
    614661    }
    615662   
     663    void movl_mEAX(void* addr)
     664    {
     665        m_formatter.oneByteOp(OP_MOV_EAXOv);
     666#if PLATFORM(X86_64)
     667        m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
     668#else
     669        m_formatter.immediate32(reinterpret_cast<int>(addr));
     670#endif
     671    }
     672
    616673    void movl_mr(int offset, RegisterID base, RegisterID dst)
    617674    {
     
    626683    void movl_i32r(int imm, RegisterID dst)
    627684    {
    628         m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, dst);
     685        m_formatter.oneByteOp(OP_MOV_EAXIv, dst);
    629686        m_formatter.immediate32(imm);
    630687    }
     
    636693    }
    637694
     695    void movl_EAXm(void* addr)
     696    {
     697        m_formatter.oneByteOp(OP_MOV_OvEAX);
     698#if PLATFORM(X86_64)
     699        m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
     700#else
     701        m_formatter.immediate32(reinterpret_cast<int>(addr));
     702#endif
     703    }
     704
    638705#if PLATFORM(X86_64)
    639706    void movq_rr(RegisterID src, RegisterID dst)
     
    647714    }
    648715
     716    void movq_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
     717    {
     718        m_formatter.oneByteOp64(OP_MOV_EvGv, src, base, index, scale, offset);
     719    }
     720
     721    void movq_mEAX(void* addr)
     722    {
     723        m_formatter.oneByteOp64(OP_MOV_EAXOv);
     724        m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
     725    }
     726
    649727    void movq_mr(int offset, RegisterID base, RegisterID dst)
    650728    {
    651729        m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, offset);
     730    }
     731
     732    void movq_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
     733    {
     734        m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, index, scale, offset);
     735    }
     736
     737    void movq_i64r(int64_t imm, RegisterID dst)
     738    {
     739        m_formatter.oneByteOp64(OP_MOV_EAXIv, dst);
     740        m_formatter.immediate64(imm);
    652741    }
    653742#else
    654743    void movl_mr(void* addr, RegisterID dst)
    655744    {
    656         m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
     745        if (dst == X86::eax)
     746            movl_mEAX(addr);
     747        else
     748            m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
    657749    }
    658750
     
    11031195        // When planting d64 or f64 instructions, not requiring a REX.w prefix,
    11041196        // the normal (non-'64'-postfixed) formatters should be used.
     1197
     1198        void oneByteOp64(OneByteOpcodeID opcode)
     1199        {
     1200            m_buffer.ensureSpace(maxInstructionSize);
     1201            emitRexW(0, 0, 0);
     1202            m_buffer.putByteUnchecked(opcode);
     1203        }
     1204
     1205        void oneByteOp64(OneByteOpcodeID opcode, RegisterID reg)
     1206        {
     1207            m_buffer.ensureSpace(maxInstructionSize);
     1208            emitRexW(reg, 0, 0);
     1209            m_buffer.putByteUnchecked(opcode + reg);
     1210        }
    11051211
    11061212        void oneByteOp64(OneByteOpcodeID opcode, int reg, RegisterID rm)
     
    11951301        }
    11961302
     1303        void immediate64(int64_t imm)
     1304        {
     1305            m_buffer.putInt64Unchecked(imm);
     1306        }
     1307
    11971308        JmpSrc immediateRel32()
    11981309        {
Note: See TracChangeset for help on using the changeset viewer.