Changeset 48000 in webkit for trunk/JavaScriptCore/jit


Ignore:
Timestamp:
Sep 2, 2009, 5:18:52 PM (16 years ago)
Author:
[email protected]
Message:

Should crash if JIT code buffer allocation fails.

Patch by Gavin Barraclough <[email protected]> on 2009-09-02
https://bugs.webkit.org/show_bug.cgi?id=28926
<rdar://problem/7031922>

  • jit/ExecutableAllocatorPosix.cpp:

(JSC::ExecutablePool::systemAlloc):

  • jit/ExecutableAllocatorWin.cpp:

(JSC::ExecutablePool::systemAlloc):

Location:
trunk/JavaScriptCore/jit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp

    r44341 r48000  
    4545ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
    4646{
    47     ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0)), n };
     47    void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);
     48    if (allocation == MAP_FAILED)
     49        CRASH();
     50    ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n };
    4851    return alloc;
    4952}
  • trunk/JavaScriptCore/jit/ExecutableAllocatorWin.cpp

    r44341 r48000  
    4343ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
    4444{
    45     ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE)), n};
     45    void* allocation = VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
     46    if (!allocation)
     47        CRASH();
     48    ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocation), n};
    4649    return alloc;
    4750}
Note: See TracChangeset for help on using the changeset viewer.