Commit 726ad6bd authored by ggaren@apple.com's avatar ggaren@apple.com
Browse files

2011-05-24 Geoffrey Garen <ggaren@apple.com>

        Reviewed by Oliver Hunt.

        Let's just have one way to get the system page size, bokay?
        https://bugs.webkit.org/show_bug.cgi?id=61384

        * CMakeListsEfl.txt:
        * CMakeListsWinCE.txt:
        * GNUmakefile.list.am:
        * JavaScriptCore.exp:
        * JavaScriptCore.gypi:
        * JavaScriptCore.pro:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: MarkStack[Platform].cpp
        is gone completely now, since it only existed to provide a duplicate way
        to access the system page size.

        * heap/MarkStack.cpp:
        (JSC::MarkStack::reset):
        * heap/MarkStack.h:
        (JSC::::MarkStackArray):
        (JSC::::shrinkAllocation): Use WTF::pageSize.

        * heap/MarkStackPosix.cpp:
        * heap/MarkStackSymbian.cpp:
        * heap/MarkStackWin.cpp: Removed now-empty files.

        * jit/ExecutableAllocator.cpp:
        (JSC::ExecutableAllocator::reprotectRegion):
        * jit/ExecutableAllocator.h:
        (JSC::ExecutableAllocator::ExecutableAllocator):
        (JSC::ExecutablePool::ExecutablePool):
        (JSC::ExecutablePool::poolAllocate):
        * jit/ExecutableAllocatorFixedVMPool.cpp: Use WTF::pageSize.

        * wscript: Removed now-empty files.

        * wtf/PageBlock.cpp:
        (WTF::systemPageSize): Integrated questionable Symbian page size rule
        from ExecutableAllocator, because that seems like what the original
        author should have done.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1c22629b
LIST(APPEND JavaScriptCore_SOURCES
jit/ExecutableAllocatorFixedVMPool.cpp
jit/ExecutableAllocator.cpp
heap/MarkStackPosix.cpp
)
LIST(APPEND JavaScriptCore_LIBRARIES
......
LIST(APPEND JavaScriptCore_SOURCES
jit/ExecutableAllocator.cpp
heap/MarkStackWin.cpp
)
IF (ENABLE_JIT AND WTF_CPU_ARM)
......
2011-05-24 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Let's just have one way to get the system page size, bokay?
https://bugs.webkit.org/show_bug.cgi?id=61384
* CMakeListsEfl.txt:
* CMakeListsWinCE.txt:
* GNUmakefile.list.am:
* JavaScriptCore.exp:
* JavaScriptCore.gypi:
* JavaScriptCore.pro:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: MarkStack[Platform].cpp
is gone completely now, since it only existed to provide a duplicate way
to access the system page size.
* heap/MarkStack.cpp:
(JSC::MarkStack::reset):
* heap/MarkStack.h:
(JSC::::MarkStackArray):
(JSC::::shrinkAllocation): Use WTF::pageSize.
* heap/MarkStackPosix.cpp:
* heap/MarkStackSymbian.cpp:
* heap/MarkStackWin.cpp: Removed now-empty files.
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::reprotectRegion):
* jit/ExecutableAllocator.h:
(JSC::ExecutableAllocator::ExecutableAllocator):
(JSC::ExecutablePool::ExecutablePool):
(JSC::ExecutablePool::poolAllocate):
* jit/ExecutableAllocatorFixedVMPool.cpp: Use WTF::pageSize.
* wscript: Removed now-empty files.
* wtf/PageBlock.cpp:
(WTF::systemPageSize): Integrated questionable Symbian page size rule
from ExecutableAllocator, because that seems like what the original
author should have done.
2011-05-24 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
......
......@@ -576,12 +576,10 @@ javascriptcore_sources += \
if TARGET_WIN32
javascriptcore_sources += \
Source/JavaScriptCore/heap/MarkStackWin.cpp \
Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
else
javascriptcore_sources += \
Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \
Source/JavaScriptCore/heap/MarkStackPosix.cpp \
Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
endif
......
......@@ -323,8 +323,6 @@ __ZN3JSC8evaluateEPNS_9ExecStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7JSVa
__ZN3JSC8isZombieEPKNS_6JSCellE
__ZN3JSC9CodeBlockD1Ev
__ZN3JSC9CodeBlockD2Ev
__ZN3JSC9MarkStack10s_pageSizeE
__ZN3JSC9MarkStack18initializePagesizeEv
__ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
__ZN3JSC9Structure22materializePropertyMapERNS_12JSGlobalDataE
__ZN3JSC9Structure25changePrototypeTransitionERNS_12JSGlobalDataEPS0_NS_7JSValueE
......
......@@ -319,9 +319,6 @@
'heap/MachineStackMarker.h',
'heap/MarkStack.cpp',
'heap/MarkStack.h',
'heap/MarkStackPosix.cpp',
'heap/MarkStackSymbian.cpp',
'heap/MarkStackWin.cpp',
'heap/MarkedBlock.cpp',
'heap/MarkedBlock.h',
'heap/MarkedSpace.cpp',
......
......@@ -76,9 +76,6 @@ SOURCES += \
heap/Heap.cpp \
heap/MachineStackMarker.cpp \
heap/MarkStack.cpp \
heap/MarkStackPosix.cpp \
heap/MarkStackSymbian.cpp \
heap/MarkStackWin.cpp \
heap/MarkedBlock.cpp \
heap/MarkedSpace.cpp \
debugger/DebuggerActivation.cpp \
......
......@@ -1913,10 +1913,6 @@
RelativePath="..\..\heap\MarkStack.h"
>
</File>
<File
RelativePath="..\..\heap\MarkStackWin.cpp"
>
</File>
<File
RelativePath="..\..\heap\Heap.cpp"
>
......
......@@ -36,13 +36,10 @@
namespace JSC {
size_t MarkStack::s_pageSize = 0;
void MarkStack::reset()
{
ASSERT(s_pageSize);
m_values.shrinkAllocation(s_pageSize);
m_markSets.shrinkAllocation(s_pageSize);
m_values.shrinkAllocation(pageSize());
m_markSets.shrinkAllocation(pageSize());
m_opaqueRoots.clear();
}
......
......@@ -33,6 +33,7 @@
#include <wtf/Vector.h>
#include <wtf/Noncopyable.h>
#include <wtf/OSAllocator.h>
#include <wtf/PageBlock.h>
namespace JSC {
......@@ -82,8 +83,6 @@ namespace JSC {
friend class HeapRootVisitor; // Allowed to mark a JSValue* or JSCell** directly.
public:
static size_t pageSize();
static void* allocateStack(size_t);
static void releaseStack(void*, size_t);
......@@ -108,8 +107,6 @@ namespace JSC {
static void validateValue(JSValue);
#endif
static void initializePagesize();
void append(JSValue*);
void append(JSValue*, size_t count);
void append(JSCell**);
......@@ -118,8 +115,6 @@ namespace JSC {
void internalAppend(JSValue);
void visitChildren(JSCell*);
static size_t s_pageSize;
void* m_jsArrayVPtr;
MarkStackArray<MarkSet> m_markSets;
MarkStackArray<JSCell*> m_values;
......@@ -180,16 +175,9 @@ namespace JSC {
OSAllocator::decommitAndRelease(addr, size);
}
inline size_t MarkStack::pageSize()
{
if (!s_pageSize)
initializePagesize();
return s_pageSize;
}
template <typename T> inline MarkStackArray<T>::MarkStackArray()
: m_top(0)
, m_allocated(MarkStack::pageSize())
, m_allocated(pageSize())
, m_capacity(m_allocated / sizeof(T))
{
m_data = reinterpret_cast<T*>(MarkStack::allocateStack(m_allocated));
......@@ -243,7 +231,7 @@ namespace JSC {
template <typename T> inline void MarkStackArray<T>::shrinkAllocation(size_t size)
{
ASSERT(size <= m_allocated);
ASSERT(0 == (size % MarkStack::pageSize()));
ASSERT(isPageAligned(size));
if (size == m_allocated)
return;
#if OS(WINDOWS) || OS(SYMBIAN) || PLATFORM(BREWMP)
......
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "MarkStack.h"
#if OS(UNIX) && !OS(SYMBIAN)
#include <unistd.h>
#include <sys/mman.h>
namespace JSC {
void MarkStack::initializePagesize()
{
MarkStack::s_pageSize = getpagesize();
}
}
#endif
/*
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "MarkStack.h"
#if OS(SYMBIAN)
#include <e32hal.h>
namespace JSC {
void MarkStack::initializePagesize()
{
TInt page_size;
UserHal::PageSizeInBytes(page_size);
MarkStack::s_pageSize = page_size;
}
}
#endif
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "MarkStack.h"
#if OS(WINDOWS)
#include "windows.h"
namespace JSC {
void MarkStack::initializePagesize()
{
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
MarkStack::s_pageSize = system_info.dwPageSize;
}
}
#endif
......@@ -31,24 +31,8 @@
namespace JSC {
size_t ExecutableAllocator::pageSize = 0;
#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
void ExecutableAllocator::intializePageSize()
{
#if OS(SYMBIAN) && CPU(ARMV5_OR_LOWER)
// The moving memory model (as used in ARMv5 and earlier platforms)
// on Symbian OS limits the number of chunks for each process to 16.
// To mitigate this limitation increase the pagesize to allocate
// fewer, larger chunks. Set the page size to 256 Kb to compensate
// for moving memory model limitation
ExecutableAllocator::pageSize = 256 * 1024;
#else
ExecutableAllocator::pageSize = WTF::pageSize();
#endif
}
ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
{
PageAllocation allocation = PageAllocation::allocate(size, OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
......@@ -87,8 +71,7 @@ size_t ExecutableAllocator::committedByteCount()
void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSetting setting)
{
if (!pageSize)
intializePageSize();
size_t pageSize = WTF::pageSize();
// Calculate the start of the page containing this region,
// and account for this extra memory within size.
......
......@@ -66,8 +66,7 @@ extern "C" __declspec(dllimport) void CacheRangeFlush(LPVOID pAddr, DWORD dwLeng
#include <wtf/brew/RefPtrBrew.h>
#endif
#define JIT_ALLOCATOR_PAGE_SIZE (ExecutableAllocator::pageSize)
#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (ExecutableAllocator::pageSize * 4)
#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (pageSize() * 4)
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
#define PROTECTION_FLAGS_RW (PROT_READ | PROT_WRITE)
......@@ -177,11 +176,8 @@ class ExecutableAllocator {
enum ProtectionSetting { Writable, Executable };
public:
static size_t pageSize;
ExecutableAllocator()
{
if (!pageSize)
intializePageSize();
if (isValid())
m_smallAllocationPool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
#if !ENABLE(INTERPRETER)
......@@ -338,12 +334,11 @@ private:
#endif
RefPtr<ExecutablePool> m_smallAllocationPool;
static void intializePageSize();
};
inline ExecutablePool::ExecutablePool(size_t n)
{
size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
size_t allocSize = roundUpAllocationSize(n, pageSize());
Allocation mem = systemAlloc(allocSize);
m_pools.append(mem);
m_freePtr = static_cast<char*>(mem.base());
......@@ -354,7 +349,7 @@ inline ExecutablePool::ExecutablePool(size_t n)
inline void* ExecutablePool::poolAllocate(size_t n)
{
size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
size_t allocSize = roundUpAllocationSize(n, pageSize());
Allocation result = systemAlloc(allocSize);
if (!result.base())
......
......@@ -491,11 +491,6 @@ size_t ExecutableAllocator::committedByteCount()
return allocator ? allocator->allocated() : 0;
}
void ExecutableAllocator::intializePageSize()
{
ExecutableAllocator::pageSize = getpagesize();
}
bool ExecutableAllocator::isValid() const
{
SpinLockHolder lock_holder(&spinlock);
......
......@@ -42,8 +42,7 @@ def build(bld):
if Options.options.port == "wx":
if building_on_win32:
jscore_excludes += ['MarkStackPosix.cpp', 'OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
sources += ['heap/MarkStackWin.cpp']
jscore_excludes += ['OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
else:
jscore_excludes.append('JSStringRefBSTR.cpp')
jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp']))
......
......@@ -66,9 +66,18 @@ inline size_t systemPageSize()
inline size_t systemPageSize()
{
#if CPU(ARMV5_OR_LOWER)
// The moving memory model (as used in ARMv5 and earlier platforms)
// on Symbian OS limits the number of chunks for each process to 16.
// To mitigate this limitation increase the pagesize to allocate
// fewer, larger chunks. Set the page size to 256 Kb to compensate
// for moving memory model limitation
return 256 * 1024;
#else
static TInt page_size = 0;
UserHal::PageSizeInBytes(page_size);
return page_size;
#endif
}
#endif
......
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