Ignore:
Timestamp:
Oct 22, 2008, 8:36:04 PM (17 years ago)
Author:
[email protected]
Message:

Really "fix" CTI mode on windows 2k3.

Reviewed my Maciej Stachowiak

This adds new methods fastMallocExecutable and fastFreeExecutable
to wrap allocation for cti code. This still just makes fastMalloc
return executable memory all the time, which will be fixed in a
later patch.

However in windows debug builds all executable allocations will be
allocated on separate executable pages, which should resolve any
remaining 2k3 issues. Conveniently the 2k3 bot will now also fail
if there are any fastFree vs. fastFreeExecutable errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r36406 r37804  
    175175#if !PLATFORM(WIN_OS)
    176176    #include <pthread.h>
     177#else
     178    #include "windows.h"
    177179#endif
    178180
    179181namespace WTF {
    180    
     182
    181183void* tryFastMalloc(size_t n)
    182184{
     
    231233
    232234void releaseFastMallocFreeMemory() { }
     235
     236#if HAVE(VIRTUALALLOC)
     237void* fastMallocExecutable(size_t n)
     238{
     239    return VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
     240}
     241
     242void fastFreeExecutable(void* p)
     243{
     244    VirtualFree(p, 0, MEM_RELEASE);
     245}
     246#else
     247void* fastMallocExecutable(size_t n)
     248{
     249    return fastMalloc(n);
     250}
     251
     252void fastFreeExecutable(void* p)
     253{
     254    fastFree(p);
     255}
     256#endif
    233257
    234258} // namespace WTF
     
    33603384    return old_ptr;
    33613385  }
     3386}
     3387
     3388void* fastMallocExecutable(size_t n)
     3389{
     3390    return malloc<false>(n);
     3391}
     3392
     3393void fastFreeExecutable(void* p)
     3394{
     3395    free(p);
    33623396}
    33633397
Note: See TracChangeset for help on using the changeset viewer.