Changeset 64938 in webkit for trunk/JavaScriptCore/assembler


Ignore:
Timestamp:
Aug 7, 2010, 11:04:59 PM (15 years ago)
Author:
[email protected]
Message:

2010-08-07 Nathan Lawrence <[email protected]>

Reviewed by Geoffrey Garen.

The JIT code contains a number of direct references to GC'd objects.
When we have movable objects, these references will need to be
updated.

  • Android.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • JavaScriptCore.gypi:
  • JavaScriptCore.pro:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::int32AtLocation): (JSC::AbstractMacroAssembler::pointerAtLocation): (JSC::AbstractMacroAssembler::jumpTarget):
  • assembler/MacroAssembler.h: (JSC::MacroAssembler::loadPtrWithPatch):

Normally, loadPtr will optimize when the register is eax. Since
the slightly smaller instruction changes the offsets, it messes up
our ability to repatch the code. We added this new instruction
that garuntees a constant size.

  • assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::load32WithPatch):

Changed load32 in the same way described above.

(JSC::MacroAssemblerX86::load32):

Moved the logic to optimize laod32 from movl_mr to load32

(JSC::MacroAssemblerX86::store32):

Moved the logic to optimize store32 from movl_rm to store32

  • assembler/X86Assembler.h: (JSC::X86Assembler::movl_rm): (JSC::X86Assembler::movl_mr): (JSC::X86Assembler::int32AtLocation): (JSC::X86Assembler::pointerAtLocation): (JSC::X86Assembler::jumpTarget):
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::markAggregate):
  • bytecode/Instruction.h:

As described in StructureStubInfo.h, we needed to add additional
fields to both StructureStubInfo and
PolymorphicAccessStructureList so that we can determine the
structure of the JITed code at patch time.

(JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
(JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):

  • bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::markAggregate):

Added this function to mark the JITed code that correosponds to
this structure stub info.

  • bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::initGetByIdProto): (JSC::StructureStubInfo::initGetByIdChain): (JSC::StructureStubInfo::):
  • jit/JIT.h:
  • jit/JITMarkObjects.cpp: Added. (JSC::JIT::patchPrototypeStructureAddress): (JSC::JIT::patchGetDirectOffset): (JSC::JIT::markGetByIdProto): (JSC::JIT::markGetByIdChain): (JSC::JIT::markGetByIdProtoList): (JSC::JIT::markPutByIdTransition): (JSC::JIT::markGlobalObjectReference):
  • jit/JITPropertyAccess.cpp:

Added asserts for the patch offsets.

(JSC::JIT::compileGetDirectOffset):
(JSC::JIT::testPrototype):
(JSC::JIT::privateCompilePutByIdTransition):
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):

  • jit/JITPropertyAccess32_64.cpp: (JSC::JIT::compileGetDirectOffset): (JSC::JIT::testPrototype): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain):
  • jit/JITStubs.cpp: (JSC::setupPolymorphicProtoList):
  • wtf/Platform.h:

Added ENABLE_MOVABLE_GC_OBJECTS flag

Location:
trunk/JavaScriptCore/assembler
Files:
4 edited

Legend:

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

    r62306 r64938  
    522522    }
    523523
     524    static int32_t int32AtLocation(CodeLocationDataLabel32 dataLabel32)
     525    {
     526        return AssemblerType::int32AtLocation(dataLabel32.dataLocation());
     527    }
     528
     529    static void* pointerAtLocation(CodeLocationDataLabelPtr dataLabelPtr)
     530    {
     531        return AssemblerType::pointerAtLocation(dataLabelPtr.dataLocation());
     532    }
     533
     534    static void* jumpTarget(CodeLocationJump jump)
     535    {
     536        return AssemblerType::jumpTarget(jump.dataLocation());
     537    }
     538
    524539    static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
    525540    {
  • trunk/JavaScriptCore/assembler/MacroAssembler.h

    r57925 r64938  
    210210    }
    211211
     212    void loadPtrWithPatch(void* address, RegisterID dest)
     213    {
     214        load32WithPatch(address, dest);
     215    }
    212216
    213217    void loadPtr(ImplicitAddress address, RegisterID dest)
  • trunk/JavaScriptCore/assembler/MacroAssemblerX86.h

    r58469 r64938  
    8383    }
    8484
     85    void load32WithPatch(void* address, RegisterID dest)
     86    {
     87        m_assembler.movl_mr(address, dest);
     88    }
     89
    8590    void load32(void* address, RegisterID dest)
    8691    {
    87         m_assembler.movl_mr(address, dest);
     92        if (dest == X86Registers::eax)
     93            m_assembler.movl_mEAX(address);
     94        else
     95            m_assembler.movl_mr(address, dest);
    8896    }
    8997
     
    106114    void store32(RegisterID src, void* address)
    107115    {
    108         m_assembler.movl_rm(src, address);
     116        if (src == X86Registers::eax)
     117            m_assembler.movl_EAXm(address);
     118        else
     119            m_assembler.movl_rm(src, address);
    109120    }
    110121
  • trunk/JavaScriptCore/assembler/X86Assembler.h

    r64608 r64938  
    11551155    void movl_rm(RegisterID src, void* addr)
    11561156    {
    1157         if (src == X86Registers::eax)
    1158             movl_EAXm(addr);
    1159         else
    1160             m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
     1157        m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
    11611158    }
    11621159   
    11631160    void movl_mr(void* addr, RegisterID dst)
    11641161    {
    1165         if (dst == X86Registers::eax)
    1166             movl_mEAX(addr);
    1167         else
    1168             m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
     1162        m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
    11691163    }
    11701164
     
    15581552
    15591553        setPointer(reinterpret_cast<char*>(code) + where.m_offset, value);
     1554    }
     1555
     1556    static int32_t int32AtLocation(void* where)
     1557    {
     1558        return static_cast<int32_t*>(where)[-1];
     1559    }
     1560
     1561    static void* pointerAtLocation(void* where)
     1562    {
     1563        return static_cast<void**>(where)[-1];
     1564    }
     1565
     1566    static void* jumpTarget(void* jump)
     1567    {
     1568        intptr_t src = reinterpret_cast<intptr_t>(jump);
     1569        int32_t offset = static_cast<int32_t*>(jump)[-1];
     1570        return reinterpret_cast<void*>(src + offset);
    15601571    }
    15611572
Note: See TracChangeset for help on using the changeset viewer.