From 2bde8e466a4451c7319e3a072d118917957d6554 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 25 May 2011 19:08:45 +0100 Subject: Merge WebKit at r82507: Initial merge by git Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e --- Source/JavaScriptCore/runtime/ConservativeSet.cpp | 25 ++++++++--------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'Source/JavaScriptCore/runtime/ConservativeSet.cpp') diff --git a/Source/JavaScriptCore/runtime/ConservativeSet.cpp b/Source/JavaScriptCore/runtime/ConservativeSet.cpp index bc8bd6d..8872023 100644 --- a/Source/JavaScriptCore/runtime/ConservativeSet.cpp +++ b/Source/JavaScriptCore/runtime/ConservativeSet.cpp @@ -33,33 +33,26 @@ inline bool isPointerAligned(void* p) return !((intptr_t)(p) & (sizeof(char*) - 1)); } -void ConservativeSet::grow() +void ConservativeRoots::grow() { size_t newCapacity = m_capacity == inlineCapacity ? nonInlineCapacity : m_capacity * 2; - DeprecatedPtr* newSet = static_cast*>(OSAllocator::reserveAndCommit(newCapacity * sizeof(JSCell*))); - memcpy(newSet, m_set, m_size * sizeof(JSCell*)); - if (m_set != m_inlineSet) - OSAllocator::decommitAndRelease(m_set, m_capacity * sizeof(JSCell*)); + JSCell** newRoots = static_cast(OSAllocator::reserveAndCommit(newCapacity * sizeof(JSCell*))); + memcpy(newRoots, m_roots, m_size * sizeof(JSCell*)); + if (m_roots != m_inlineRoots) + OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(JSCell*)); m_capacity = newCapacity; - m_set = newSet; + m_roots = newRoots; } -void ConservativeSet::add(void* begin, void* end) +void ConservativeRoots::add(void* begin, void* end) { ASSERT(begin <= end); ASSERT((static_cast(end) - static_cast(begin)) < 0x1000000); ASSERT(isPointerAligned(begin)); ASSERT(isPointerAligned(end)); - for (char** it = static_cast(begin); it != static_cast(end); ++it) { - if (!m_heap->contains(*it)) - continue; - - if (m_size == m_capacity) - grow(); - - m_set[m_size++] = reinterpret_cast(*it); - } + for (char** it = static_cast(begin); it != static_cast(end); ++it) + add(*it); } } // namespace JSC -- cgit v1.1