From be01689f43cf6882cf670d33df49ead1f570c53a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 27 May 2012 21:51:42 +0200 Subject: Imported WebKit commit 8d6c5efc74f0222dfc7bcce8d845d4a2707ed9e6 (http://svn.webkit.org/repository/webkit/trunk@118629) --- Source/JavaScriptCore/heap/MarkedBlock.cpp | 6 +++++- Source/JavaScriptCore/heap/WeakBlock.h | 10 ---------- Source/JavaScriptCore/heap/WeakSetInlines.h | 13 +++++++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'Source/JavaScriptCore/heap') diff --git a/Source/JavaScriptCore/heap/MarkedBlock.cpp b/Source/JavaScriptCore/heap/MarkedBlock.cpp index 42dc10371..0075f78d7 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.cpp +++ b/Source/JavaScriptCore/heap/MarkedBlock.cpp @@ -67,8 +67,12 @@ inline void MarkedBlock::callDestructor(JSCell* cell) #if ENABLE(SIMPLE_HEAP_PROFILING) m_heap->m_destroyedTypeCounts.countVPtr(vptr); #endif - cell->methodTable()->destroy(cell); +#if !ASSERT_DISABLED || ENABLE(GC_VALIDATION) + cell->clearStructure(); +#endif + + cell->methodTable()->destroy(cell); cell->zap(); } diff --git a/Source/JavaScriptCore/heap/WeakBlock.h b/Source/JavaScriptCore/heap/WeakBlock.h index dc3e89d55..6461f7b2f 100644 --- a/Source/JavaScriptCore/heap/WeakBlock.h +++ b/Source/JavaScriptCore/heap/WeakBlock.h @@ -115,16 +115,6 @@ inline WeakBlock::FreeCell* WeakBlock::asFreeCell(WeakImpl* weakImpl) return reinterpret_cast(weakImpl); } -inline void WeakBlock::finalize(WeakImpl* weakImpl) -{ - ASSERT(weakImpl->state() == WeakImpl::Dead); - weakImpl->setState(WeakImpl::Finalized); - WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner(); - if (!weakHandleOwner) - return; - weakHandleOwner->finalize(Handle::wrapSlot(&const_cast(weakImpl->jsValue())), weakImpl->context()); -} - inline WeakImpl* WeakBlock::weakImpls() { return reinterpret_cast(this) + ((sizeof(WeakBlock) + sizeof(WeakImpl) - 1) / sizeof(WeakImpl)); diff --git a/Source/JavaScriptCore/heap/WeakSetInlines.h b/Source/JavaScriptCore/heap/WeakSetInlines.h index 6e2420c45..c1c87b380 100644 --- a/Source/JavaScriptCore/heap/WeakSetInlines.h +++ b/Source/JavaScriptCore/heap/WeakSetInlines.h @@ -42,6 +42,19 @@ inline WeakImpl* WeakSet::allocate(JSValue jsValue, WeakHandleOwner* weakHandleO return new (NotNull, weakImpl) WeakImpl(jsValue, weakHandleOwner, context); } +inline void WeakBlock::finalize(WeakImpl* weakImpl) +{ + ASSERT(weakImpl->state() == WeakImpl::Dead); + weakImpl->setState(WeakImpl::Finalized); + WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner(); + if (!weakHandleOwner) + return; +#if !ASSERT_DISABLED || ENABLE(GC_VALIDATION) + weakImpl->jsValue().asCell()->clearStructure(); +#endif + weakHandleOwner->finalize(Handle::wrapSlot(&const_cast(weakImpl->jsValue())), weakImpl->context()); +} + } // namespace JSC #endif // WeakSetInlines_h -- cgit v1.2.1