From bddffd6d6ead62dc078683fdb601b425c2f9e641 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 2 May 2012 20:20:39 +0200 Subject: Updated WebKit to a096458b01a9387719308c99e5917a7b42196078 QNX fixes for https://bugs.webkit.org/show_bug.cgi?id=77013 and http://trac.webkit.org/changeset/109105 backported by Nicolas Arnaud-Cormos Change-Id: I4b57f26bac6ed61a8a48ea6ef4c2dedf0503675b Reviewed-by: Nicolas Arnaud-Cormos Reviewed-by: Zeno Albisser --- src/3rdparty/webkit/.tag | 2 +- .../Source/JavaScriptCore/runtime/JSString.cpp | 5 ++-- .../Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp | 31 +++++++++++++++++++--- src/3rdparty/webkit/VERSION | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) (limited to 'src/3rdparty/webkit') diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 82cb8f566d..d290c0b68b 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -9c745c625c6d1112cec51d742ecc8c041cc090d7 +a096458b01a9387719308c99e5917a7b42196078 diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp index da15997d32..a0ba3e2f3e 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSString.cpp @@ -41,9 +41,10 @@ void JSString::resolveRope(ExecState* exec) const ASSERT(isRope()); UChar* buffer; - if (PassRefPtr newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) + if (PassRefPtr newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) { + Heap::heap(this)->reportExtraMemoryCost(newImpl->cost()); m_value = newImpl; - else { + } else { outOfMemory(exec); return; } diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp index 8c3b8090b0..5ba5410251 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp @@ -35,11 +35,21 @@ namespace WTF { void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable) { +#if OS(QNX) + // Reserve memory with PROT_NONE and MAP_LAZY so it isn't committed now. + void* result = mmap(0, bytes, PROT_NONE, MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0); + if (result == MAP_FAILED) + CRASH(); +#else // OS(QNX) + void* result = reserveAndCommit(bytes, usage, writable, executable); #if HAVE(MADV_FREE_REUSE) // To support the "reserve then commit" model, we have to initially decommit. while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } #endif + +#endif // OS(QNX) + return result; } @@ -98,20 +108,35 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo return result; } -void OSAllocator::commit(void* address, size_t bytes, bool, bool) +void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable) { -#if HAVE(MADV_FREE_REUSE) +#if OS(QNX) + int protection = PROT_READ; + if (writable) + protection |= PROT_WRITE; + if (executable) + protection |= PROT_EXEC; + if (MAP_FAILED == mmap(address, bytes, protection, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0)) + CRASH(); +#elif HAVE(MADV_FREE_REUSE) + UNUSED_PARAM(writable); + UNUSED_PARAM(executable); while (madvise(address, bytes, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { } #else // Non-MADV_FREE_REUSE reservations automatically commit on demand. UNUSED_PARAM(address); UNUSED_PARAM(bytes); + UNUSED_PARAM(writable); + UNUSED_PARAM(executable); #endif } void OSAllocator::decommit(void* address, size_t bytes) { -#if HAVE(MADV_FREE_REUSE) +#if OS(QNX) + // Use PROT_NONE and MAP_LAZY to decommit the pages. + mmap(address, bytes, PROT_NONE, MAP_FIXED | MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0); +#elif HAVE(MADV_FREE_REUSE) while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } #elif HAVE(MADV_FREE) while (madvise(address, bytes, MADV_FREE) == -1 && errno == EAGAIN) { } diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b352b881fc..d8a9930275 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 9c745c625c6d1112cec51d742ecc8c041cc090d7 + a096458b01a9387719308c99e5917a7b42196078 -- cgit v1.2.3