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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/StructureStubInfo.h

    r64608 r64938  
    3131#include "Instruction.h"
    3232#include "MacroAssembler.h"
     33#include "PropertySlot.h"
    3334#include "Opcode.h"
    3435#include "Structure.h"
     
    6768        }
    6869
     70#if ENABLE(MOVABLE_GC_OBJECTS)
     71        void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure, CodeLocationLabel routine, PropertySlot::CachedPropertyType propertyType)
     72#else
    6973        void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure, CodeLocationLabel routine)
     74#endif
    7075        {
    7176            accessType = access_get_by_id_proto;
     
    7883
    7984            stubRoutine = routine;
    80         }
    81 
     85
     86#if ENABLE(MOVABLE_GC_OBJECTS)
     87            u.getByIdProto.propertyType = propertyType;
     88#endif
     89        }
     90
     91#if ENABLE(MOVABLE_GC_OBJECTS)
     92        void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain, CodeLocationLabel routine, int count, PropertySlot::CachedPropertyType propertyType)
     93#else
    8294        void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain, CodeLocationLabel routine)
     95#endif
    8396        {
    8497            accessType = access_get_by_id_chain;
     
    91104
    92105            stubRoutine = routine;
     106
     107#if ENABLE(MOVABLE_GC_OBJECTS)
     108            u.getByIdChain.count = count;
     109            u.getByIdChain.propertyType = propertyType;
     110#endif
    93111        }
    94112
     
    140158
    141159        void deref();
     160#if ENABLE(MOVABLE_GC_OBJECTS)
     161        void markAggregate(MarkStack&, CodeBlock*);
     162#endif
    142163
    143164        bool seenOnce()
     
    161182                Structure* baseObjectStructure;
    162183                Structure* prototypeStructure;
     184#if ENABLE(MOVABLE_GC_OBJECTS)
     185                // The propertyType is required to properly determine the
     186                // structure of the underlying code so that we may patch it
     187                // correctly.  Different code is generated for different
     188                // property types, and therefore, the offsets that we need to
     189                // patch at will change.
     190                PropertySlot::CachedPropertyType propertyType;
     191#endif
    163192            } getByIdProto;
    164193            struct {
    165194                Structure* baseObjectStructure;
    166195                StructureChain* chain;
     196#if ENABLE(MOVABLE_GC_OBJECTS)
     197                // We need the count so that we can iterate over the prototype
     198                // chain, marking all of the references to objects.
     199                int count;
     200                PropertySlot::CachedPropertyType propertyType;
     201#endif
    167202            } getByIdChain;
    168203            struct {
Note: See TracChangeset for help on using the changeset viewer.