[webkit-gtk] [PATCH 2/2] commitSize changed to pageSize

Michel Normand normand at linux.vnet.ibm.com
Thu Mar 13 10:26:05 PDT 2014


to avoid mprotect failure for architecture
like ppc64 where memory to be pageSize aligned.
related fedora bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1074093

Signed-off-by: Michel Normand <normand at linux.vnet.ibm.com>
---
 Source/JavaScriptCore/interpreter/JSStack.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Source/JavaScriptCore/interpreter/JSStack.cpp b/Source/JavaScriptCore/interpreter/JSStack.cpp
index 9e6bee9..1129e4c 100644
--- a/Source/JavaScriptCore/interpreter/JSStack.cpp
+++ b/Source/JavaScriptCore/interpreter/JSStack.cpp
@@ -58,7 +58,8 @@ JSStack::JSStack(VM& vm)
     size_t capacity = Options::maxPerThreadStackUsage();
     ASSERT(capacity && isPageAligned(capacity));
 
-    m_reservation = PageReservation::reserve(WTF::roundUpToMultipleOf(commitSize, capacity), OSAllocator::JSVMStackPages);
+    size_t commitsize = pageSize();
+    m_reservation = PageReservation::reserve(WTF::roundUpToMultipleOf(commitsize, capacity), OSAllocator::JSVMStackPages);
     setStackLimit(highAddress());
     m_commitTop = highAddress();
     
@@ -91,8 +92,9 @@ bool JSStack::growSlowCase(Register* newTopOfStack)
     // Compute the chunk size of additional memory to commit, and see if we
     // have it is still within our budget. If not, we'll fail to grow and
     // return false.
+    size_t commitsize = pageSize();
     ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithReservedZone);
-    delta = WTF::roundUpToMultipleOf(commitSize, delta);
+    delta = WTF::roundUpToMultipleOf(commitsize, delta);
     Register* newCommitTop = m_commitTop - (delta / sizeof(Register));
     if (newCommitTop < reservationTop())
         return false;
-- 
1.7.9.5



More information about the webkit-gtk mailing list