Diff
Modified: trunk/Source/_javascript_Core/CMakeListsEfl.txt (87197 => 87198)
--- trunk/Source/_javascript_Core/CMakeListsEfl.txt 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/CMakeListsEfl.txt 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,7 +1,6 @@
LIST(APPEND _javascript_Core_SOURCES
jit/ExecutableAllocatorFixedVMPool.cpp
jit/ExecutableAllocator.cpp
- heap/MarkStackPosix.cpp
)
LIST(APPEND _javascript_Core_LIBRARIES
Modified: trunk/Source/_javascript_Core/CMakeListsWinCE.txt (87197 => 87198)
--- trunk/Source/_javascript_Core/CMakeListsWinCE.txt 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/CMakeListsWinCE.txt 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,7 +1,5 @@
LIST(APPEND _javascript_Core_SOURCES
jit/ExecutableAllocator.cpp
-
- heap/MarkStackWin.cpp
)
IF (ENABLE_JIT AND WTF_CPU_ARM)
Modified: trunk/Source/_javascript_Core/ChangeLog (87197 => 87198)
--- trunk/Source/_javascript_Core/ChangeLog 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,3 +1,45 @@
+2011-05-24 Geoffrey Garen <[email protected]>
+
+ 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:
+ * _javascript_Core.exp:
+ * _javascript_Core.gypi:
+ * _javascript_Core.pro:
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.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 <[email protected]>
Reviewed by Gavin Barraclough.
Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (87197 => 87198)
--- trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-05-24 20:51:52 UTC (rev 87198)
@@ -576,12 +576,10 @@
if TARGET_WIN32
_javascript_core_sources += \
- Source/_javascript_Core/heap/MarkStackWin.cpp \
Source/_javascript_Core/wtf/OSAllocatorWin.cpp
else
_javascript_core_sources += \
Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp \
- Source/_javascript_Core/heap/MarkStackPosix.cpp \
Source/_javascript_Core/wtf/OSAllocatorPosix.cpp
endif
Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (87197 => 87198)
--- trunk/Source/_javascript_Core/_javascript_Core.exp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -323,8 +323,6 @@
__ZN3JSC8isZombieEPKNS_6JSCellE
__ZN3JSC9CodeBlockD1Ev
__ZN3JSC9CodeBlockD2Ev
-__ZN3JSC9MarkStack10s_pageSizeE
-__ZN3JSC9MarkStack18initializePagesizeEv
__ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
__ZN3JSC9Structure22materializePropertyMapERNS_12JSGlobalDataE
__ZN3JSC9Structure25changePrototypeTransitionERNS_12JSGlobalDataEPS0_NS_7JSValueE
Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (87197 => 87198)
--- trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-05-24 20:51:52 UTC (rev 87198)
@@ -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',
Modified: trunk/Source/_javascript_Core/_javascript_Core.pro (87197 => 87198)
--- trunk/Source/_javascript_Core/_javascript_Core.pro 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/_javascript_Core.pro 2011-05-24 20:51:52 UTC (rev 87198)
@@ -76,9 +76,6 @@
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 \
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj (87197 => 87198)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.vcproj 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1914,10 +1914,6 @@
>
</File>
<File
- RelativePath="..\..\heap\MarkStackWin.cpp"
- >
- </File>
- <File
RelativePath="..\..\heap\Heap.cpp"
>
</File>
Modified: trunk/Source/_javascript_Core/heap/MarkStack.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/heap/MarkStack.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/heap/MarkStack.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -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();
}
Modified: trunk/Source/_javascript_Core/heap/MarkStack.h (87197 => 87198)
--- trunk/Source/_javascript_Core/heap/MarkStack.h 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/heap/MarkStack.h 2011-05-24 20:51:52 UTC (rev 87198)
@@ -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 @@
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 @@
static void validateValue(JSValue);
#endif
- static void initializePagesize();
-
void append(JSValue*);
void append(JSValue*, size_t count);
void append(JSCell**);
@@ -118,8 +115,6 @@
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 @@
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 @@
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)
Modified: trunk/Source/_javascript_Core/heap/MarkStackPosix.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/heap/MarkStackPosix.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/heap/MarkStackPosix.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,43 +0,0 @@
-/*
- * 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
Modified: trunk/Source/_javascript_Core/heap/MarkStackSymbian.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/heap/MarkStackSymbian.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/heap/MarkStackSymbian.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,38 +0,0 @@
-/*
- 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
Modified: trunk/Source/_javascript_Core/heap/MarkStackWin.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/heap/MarkStackWin.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/heap/MarkStackWin.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -1,44 +0,0 @@
-/*
- * 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
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -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 @@
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.
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (87197 => 87198)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2011-05-24 20:51:52 UTC (rev 87198)
@@ -66,8 +66,7 @@
#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 @@
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 @@
#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 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())
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -491,11 +491,6 @@
return allocator ? allocator->allocated() : 0;
}
-void ExecutableAllocator::intializePageSize()
-{
- ExecutableAllocator::pageSize = getpagesize();
-}
-
bool ExecutableAllocator::isValid() const
{
SpinLockHolder lock_holder(&spinlock);
Modified: trunk/Source/_javascript_Core/wscript (87197 => 87198)
--- trunk/Source/_javascript_Core/wscript 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/wscript 2011-05-24 20:51:52 UTC (rev 87198)
@@ -42,8 +42,7 @@
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']))
Modified: trunk/Source/_javascript_Core/wtf/PageBlock.cpp (87197 => 87198)
--- trunk/Source/_javascript_Core/wtf/PageBlock.cpp 2011-05-24 20:41:51 UTC (rev 87197)
+++ trunk/Source/_javascript_Core/wtf/PageBlock.cpp 2011-05-24 20:51:52 UTC (rev 87198)
@@ -66,9 +66,18 @@
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