Ignore:
Timestamp:
Aug 3, 2010, 5:15:47 PM (15 years ago)
Author:
[email protected]
Message:

Bug 43390 - Do not CRASH if we run out of room for jit code.

Reviewed by Oliver Hunt.

Change the ExecutableAllocator implementations not to crash, and to return 0 if memory cannot be allocated.
The assemblers should pass this through without trying to use it in executableCopy.
Change the LinkBuffer to handle this, and to provide an allocationSuccessful() method to test for this.

Change the JIT to throw an exception if allocation fails.
Make JIT optimizations fail gracefully if memory cannot be allocated (use non-optimized path).
Change YARR JIT to fallback to PCRE

  • assembler/ARMAssembler.cpp:

(JSC::ARMAssembler::executableCopy):

  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::executableCopy):

  • assembler/LinkBuffer.h:

(JSC::LinkBuffer::allocationSuccessful):

  • assembler/MIPSAssembler.h:

(JSC::MIPSAssembler::executableCopy):

  • assembler/X86Assembler.h:

(JSC::X86Assembler::executableCopy):

  • bytecode/StructureStubInfo.h:

(JSC::StructureStubInfo::initGetByIdProto):
(JSC::StructureStubInfo::initGetByIdChain):
(JSC::StructureStubInfo::initGetByIdSelfList):
(JSC::StructureStubInfo::initGetByIdProtoList):
(JSC::StructureStubInfo::initPutByIdTransition):

  • jit/ExecutableAllocator.cpp:

(JSC::ExecutablePool::systemAlloc):

  • jit/ExecutableAllocatorFixedVMPool.cpp:

(JSC::FixedVMPoolAllocator::allocInternal):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JIT.h:

(JSC::JIT::compileGetByIdProto):
(JSC::JIT::compileGetByIdSelfList):
(JSC::JIT::compileGetByIdProtoList):
(JSC::JIT::compileGetByIdChainList):
(JSC::JIT::compileGetByIdChain):
(JSC::JIT::compilePutByIdTransition):
(JSC::JIT::compilePatchGetArrayLength):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC::JIT::privateCompileCTINativeCall):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::privateCompilePutByIdTransition):
(JSC::JIT::privateCompilePatchGetArrayLength):
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::privateCompilePutByIdTransition):
(JSC::JIT::privateCompilePatchGetArrayLength):
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):

  • jit/JITStubs.cpp:

(JSC::JITThunks::tryCachePutByID):
(JSC::JITThunks::tryCacheGetByID):
(JSC::DEFINE_STUB_FUNCTION):
(JSC::setupPolymorphicProtoList):

  • jit/JITStubs.h:
  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::finalize):

  • runtime/ExceptionHelpers.cpp:

(JSC::createOutOfMemoryError):

  • runtime/ExceptionHelpers.h:
  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):
(JSC::FunctionExecutable::reparseExceptionInfo):
(JSC::EvalExecutable::reparseExceptionInfo):

  • yarr/RegexJIT.cpp:

(JSC::Yarr::RegexGenerator::compile):

File:
1 edited

Legend:

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

    r46879 r64608  
    6767        }
    6868
    69         void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure)
     69        void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure, CodeLocationLabel routine)
    7070        {
    7171            accessType = access_get_by_id_proto;
     
    7676            u.getByIdProto.prototypeStructure = prototypeStructure;
    7777            prototypeStructure->ref();
     78
     79            stubRoutine = routine;
    7880        }
    7981
    80         void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain)
     82        void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain, CodeLocationLabel routine)
    8183        {
    8284            accessType = access_get_by_id_chain;
     
    8789            u.getByIdChain.chain = chain;
    8890            chain->ref();
     91
     92            stubRoutine = routine;
    8993        }
    9094
    91         void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize)
     95        void initGetByIdSelfList(PolymorphicAccessStructureList* structureList)
    9296        {
    9397            accessType = access_get_by_id_self_list;
    9498
    9599            u.getByIdProtoList.structureList = structureList;
    96             u.getByIdProtoList.listSize = listSize;
     100            u.getByIdProtoList.listSize = 1;
     101
     102            stubRoutine = CodeLocationLabel();
    97103        }
    98104
    99         void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize)
     105        void initGetByIdProtoList(PolymorphicAccessStructureList* structureList)
    100106        {
    101107            accessType = access_get_by_id_proto_list;
    102108
    103109            u.getByIdProtoList.structureList = structureList;
    104             u.getByIdProtoList.listSize = listSize;
     110            u.getByIdProtoList.listSize = 1;
     111
     112            stubRoutine = CodeLocationLabel();
    105113        }
    106114
    107115        // PutById*
    108116
    109         void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain)
     117        void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain, CodeLocationLabel routine)
    110118        {
    111119            accessType = access_put_by_id_transition;
     
    119127            u.putByIdTransition.chain = chain;
    120128            chain->ref();
     129
     130            stubRoutine = routine;
    121131        }
    122132
Note: See TracChangeset for help on using the changeset viewer.