Changeset 73091 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Dec 1, 2010, 6:13:59 PM (14 years ago)
Author:
[email protected]
Message:

Baby step toward a cross-platform virtual memory abstraction: created
an all-static OSAllocator class and changed MarkStack to use it.

Reviewed by Sam Weinig.

  • JavaScriptCore.xcodeproj/project.pbxproj: Added OSAllocatorPosix.cpp.
  • runtime/MarkStack.h:

(JSC::MarkStack::allocateStack):
(JSC::MarkStack::releaseStack): Use OSAllocator instead of rolling our
own platform-specific code.

  • runtime/MarkStackNone.cpp: Removed. Nothing used this.
  • runtime/MarkStackPosix.cpp:
  • runtime/MarkStackSymbian.cpp:
  • runtime/MarkStackWin.cpp: Removed custom platform-specific code, since

we use the OSAllocator abstraction now.

  • wtf/OSAllocator.h: Added.
  • wtf/OSAllocatorPosix.cpp: Added.

(WTF::OSAllocator::reserve):
(WTF::OSAllocator::reserveAndCommit):
(WTF::OSAllocator::commit):
(WTF::OSAllocator::decommit):
(WTF::OSAllocator::release):

  • wtf/OSAllocatorSymbian.cpp: Added.

(WTF::OSAllocator::reserve):
(WTF::OSAllocator::reserveAndCommit):
(WTF::OSAllocator::commit):
(WTF::OSAllocator::decommit):
(WTF::OSAllocator::release):

  • wtf/OSAllocatorWin.cpp: Added.

(WTF::OSAllocator::reserve):
(WTF::OSAllocator::reserveAndCommit):
(WTF::OSAllocator::commit):
(WTF::OSAllocator::decommit):
(WTF::OSAllocator::release): The new OSAllocator abstraction.

  • wtf/wtf.pri: Added OSAllocatorSymbian.cpp.
Location:
trunk/JavaScriptCore/runtime
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/MarkStack.h

    r64684 r73091  
    2929#include "JSValue.h"
    3030#include <wtf/Noncopyable.h>
     31#include <wtf/OSAllocator.h>
    3132
    3233namespace JSC {
     
    8687        };
    8788
    88         static void* allocateStack(size_t size);
    89         static void releaseStack(void* addr, size_t size);
     89        static void* allocateStack(size_t size) { return OSAllocator::reserveAndCommit(size); }
     90        static void releaseStack(void* addr, size_t size) { OSAllocator::release(addr, size); }
    9091
    9192        static void initializePagesize();
  • trunk/JavaScriptCore/runtime/MarkStackPosix.cpp

    r52791 r73091  
    3939}
    4040
    41 void* MarkStack::allocateStack(size_t size)
    42 {
    43     return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
    44 }
    45 void MarkStack::releaseStack(void* addr, size_t size)
    46 {
    47     munmap(addr, size);
    48 }
    49 
    5041}
    5142
  • trunk/JavaScriptCore/runtime/MarkStackSymbian.cpp

    r52791 r73091  
    3434}
    3535
    36 void* MarkStack::allocateStack(size_t size)
    37 {
    38     return fastMalloc(size);
    39 }
    40 
    41 void MarkStack::releaseStack(void* addr, size_t size)
    42 {
    43     return fastFree(addr);
    44 }
    45 
    4636}
    4737
  • trunk/JavaScriptCore/runtime/MarkStackWin.cpp

    r52791 r73091  
    4040}
    4141
    42 void* MarkStack::allocateStack(size_t size)
    43 {
    44     return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    45 }
    46 void MarkStack::releaseStack(void* addr, size_t)
    47 {
    48     // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
    49     // dwSize must be 0 if dwFreeType is MEM_RELEASE.
    50     VirtualFree(addr, 0, MEM_RELEASE);
    51 }
    52 
    5342}
    5443
Note: See TracChangeset for help on using the changeset viewer.