Commit 475ebe22 authored by weinig@apple.com's avatar weinig@apple.com

2009-04-18 Sam Weinig <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Fix for <rdar://problem/6801555> Tag JavaScript memory on SnowLeopard

        * interpreter/RegisterFile.h:
        (JSC::RegisterFile::RegisterFile):
        * jit/ExecutableAllocatorFixedVMPool.cpp:
        (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
        * jit/ExecutableAllocatorPosix.cpp:
        (JSC::ExecutablePool::systemAlloc):
        * runtime/Collector.cpp:
        (JSC::allocateBlock):



git-svn-id: svn://svn.chromium.org/blink/trunk@42649 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent efd5bd44
2009-04-18 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for <rdar://problem/6801555> Tag JavaScript memory on SnowLeopard
* interpreter/RegisterFile.h:
(JSC::RegisterFile::RegisterFile):
* jit/ExecutableAllocatorFixedVMPool.cpp:
(JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
* jit/ExecutableAllocatorPosix.cpp:
(JSC::ExecutablePool::systemAlloc):
* runtime/Collector.cpp:
(JSC::allocateBlock):
2009-04-18 Drew Wilson <amw@apple.com> 2009-04-18 Drew Wilson <amw@apple.com>
<rdar://problem/6781407> VisiblePosition.characterAfter should return UChar32 <rdar://problem/6781407> VisiblePosition.characterAfter should return UChar32
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#if PLATFORM(DARWIN)
#include <mach/vm_statistics.h>
#endif
namespace JSC { namespace JSC {
/* /*
...@@ -161,7 +165,12 @@ namespace JSC { ...@@ -161,7 +165,12 @@ namespace JSC {
{ {
size_t bufferLength = (capacity + maxGlobals) * sizeof(Register); size_t bufferLength = (capacity + maxGlobals) * sizeof(Register);
#if HAVE(MMAP) #if HAVE(MMAP)
m_buffer = static_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)); #if PLATFORM(DARWIN) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
#define OPTIONAL_TAG VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
#else
#define OPTIONAL_TAG -1
#endif
m_buffer = static_cast<Register*>(mmap(0, bufferLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, OPTIONAL_TAG, 0));
if (m_buffer == MAP_FAILED) { if (m_buffer == MAP_FAILED) {
fprintf(stderr, "Could not allocate register file: %d\n", errno); fprintf(stderr, "Could not allocate register file: %d\n", errno);
CRASH(); CRASH();
......
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
#if ENABLE(ASSEMBLER) && PLATFORM(MAC) && PLATFORM(X86_64) #if ENABLE(ASSEMBLER) && PLATFORM(MAC) && PLATFORM(X86_64)
#include "TCSpinLock.h"
#include <mach/mach_init.h> #include <mach/mach_init.h>
#include <mach/vm_map.h> #include <mach/vm_map.h>
#include <mach/vm_statistics.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include <wtf/AVLTree.h> #include <wtf/AVLTree.h>
#include "TCSpinLock.h"
using namespace WTF; using namespace WTF;
...@@ -280,8 +281,15 @@ public: ...@@ -280,8 +281,15 @@ public:
: commonSize(commonSize) : commonSize(commonSize)
, countFreedSinceLastCoalesce(0) , countFreedSinceLastCoalesce(0)
{ {
#if defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#define OPTIONAL_TAG VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#else
#define OPTIONAL_TAG -1
#endif
// Allocate two gigabytes of memory. // Allocate two gigabytes of memory.
void* base = mmap(NULL, totalHeapSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0); void* base = mmap(NULL, totalHeapSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, OPTIONAL_TAG, 0);
if (!base) if (!base)
CRASH(); CRASH();
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#if PLATFORM(DARWIN)
#include <mach/vm_statistics.h>
#endif
namespace JSC { namespace JSC {
void ExecutableAllocator::intializePageSize() void ExecutableAllocator::intializePageSize()
...@@ -41,7 +45,13 @@ void ExecutableAllocator::intializePageSize() ...@@ -41,7 +45,13 @@ void ExecutableAllocator::intializePageSize()
ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n) ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
{ {
ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(mmap(NULL, n, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0)), n}; #if PLATFORM(DARWIN) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#define OPTIONAL_TAG VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#else
#define OPTIONAL_TAG -1
#endif
ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(mmap(NULL, n, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, OPTIONAL_TAG, 0)), n };
return alloc; return alloc;
} }
......
...@@ -40,11 +40,12 @@ ...@@ -40,11 +40,12 @@
#if PLATFORM(DARWIN) #if PLATFORM(DARWIN)
#include <mach/mach_port.h>
#include <mach/mach_init.h> #include <mach/mach_init.h>
#include <mach/mach_port.h>
#include <mach/task.h> #include <mach/task.h>
#include <mach/thread_act.h> #include <mach/thread_act.h>
#include <mach/vm_map.h> #include <mach/vm_map.h>
#include <mach/vm_statistics.h>
#elif PLATFORM(WIN_OS) #elif PLATFORM(WIN_OS)
...@@ -181,9 +182,14 @@ template <HeapType heapType> ...@@ -181,9 +182,14 @@ template <HeapType heapType>
static NEVER_INLINE CollectorBlock* allocateBlock() static NEVER_INLINE CollectorBlock* allocateBlock()
{ {
#if PLATFORM(DARWIN) #if PLATFORM(DARWIN)
#if defined(VM_MEMORY_JAVASCRIPT_CORE)
#define TAG VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
#else
#define TAG 0
#endif
vm_address_t address = 0; vm_address_t address = 0;
// FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: <rdar://problem/6054788>. // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: <rdar://problem/6054788>.
vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE|TAG, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT);
#elif PLATFORM(SYMBIAN) #elif PLATFORM(SYMBIAN)
// no memory map in symbian, need to hack with fastMalloc // no memory map in symbian, need to hack with fastMalloc
void* address = fastMalloc(BLOCK_SIZE); void* address = fastMalloc(BLOCK_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment