Changeset 37804 in webkit for trunk/JavaScriptCore


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.

Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37799 r37804  
     12008-10-22  Oliver Hunt  <[email protected]>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Really "fix" CTI mode on windows 2k3.
     6
     7        This adds new methods fastMallocExecutable and fastFreeExecutable
     8        to wrap allocation for cti code.  This still just makes fastMalloc
     9        return executable memory all the time, which will be fixed in a
     10        later patch.
     11
     12        However in windows debug builds all executable allocations will be
     13        allocated on separate executable pages, which should resolve any
     14        remaining 2k3 issues.  Conveniently the 2k3 bot will now also fail
     15        if there are any fastFree vs. fastFreeExecutable errors.
     16
     17        * ChangeLog:
     18        * VM/CodeBlock.cpp:
     19        (JSC::CodeBlock::~CodeBlock):
     20        * kjs/regexp.cpp:
     21        (JSC::RegExp::~RegExp):
     22        * masm/X86Assembler.h:
     23        (JSC::JITCodeBuffer::copy):
     24        * wtf/FastMalloc.cpp:
     25        (WTF::fastMallocExecutable):
     26        (WTF::fastFreeExecutable):
     27        (WTF::TCMallocStats::fastMallocExecutable):
     28        (WTF::TCMallocStats::fastFreeExecutable):
     29        * wtf/FastMalloc.h:
     30
    1312008-10-22  Darin Adler  <[email protected]>
    232
  • trunk/JavaScriptCore/VM/CodeBlock.cpp

    r37789 r37804  
    946946        derefStructureIDs(&instructions[structureIDInstructions[i].opcodeIndex]);
    947947        if (structureIDInstructions[i].stubRoutine)
    948             fastFree(structureIDInstructions[i].stubRoutine);
     948            WTF::fastFreeExecutable(structureIDInstructions[i].stubRoutine);
    949949        if (CallLinkInfo* callLinkInfo = structureIDInstructions[i].linkInfoPtr) {
    950950            callLinkInfo->callee->removeCaller(callLinkInfo);
     
    957957
    958958    if (ctiCode)
    959         fastFree(ctiCode);
     959        WTF::fastFreeExecutable(ctiCode);
    960960#endif
    961961}
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r37457 r37804  
    106106#if ENABLE(WREC)
    107107    if (m_wrecFunction)
    108         fastFree(m_wrecFunction);
     108        WTF::fastFreeExecutable(m_wrecFunction);
    109109#endif
    110110}
  • trunk/JavaScriptCore/masm/X86Assembler.h

    r37670 r37804  
    3131#include <wtf/Assertions.h>
    3232#include <wtf/AlwaysInline.h>
     33#include <wtf/FastMalloc.h>
     34
    3335#if HAVE(MMAN)
    3436#include <sys/mman.h>
     
    124126            return 0;
    125127
    126         void* result = fastMalloc(m_index);
     128        void* result = WTF::fastMallocExecutable(m_index);
    127129
    128130        if (!result)
  • 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
  • trunk/JavaScriptCore/wtf/FastMalloc.h

    r35691 r37804  
    4141
    4242    void fastFree(void* p);
     43
     44    void* fastMallocExecutable(size_t n);
     45    void fastFreeExecutable(void* p);
    4346
    4447#ifndef NDEBUG   
Note: See TracChangeset for help on using the changeset viewer.