JSC GC lazy sweep does not inline the common cases of cell destruction.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 22:55:47 +0000 (22:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 22:55:47 +0000 (22:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=64745

Patch by Filip Pizlo <fpizlo@apple.com> on 2011-07-18
Reviewed by Oliver Hunt.

This inlines the case of JSFinalObject destruction.

* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::lazySweep):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91218 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/MarkedBlock.cpp

index b8f87cf..6ee7afb 100644 (file)
@@ -1,3 +1,15 @@
+2011-07-18  Filip Pizlo  <fpizlo@apple.com>
+
+        JSC GC lazy sweep does not inline the common cases of cell destruction.
+        https://bugs.webkit.org/show_bug.cgi?id=64745
+
+        Reviewed by Oliver Hunt.
+        
+        This inlines the case of JSFinalObject destruction.
+
+        * heap/MarkedBlock.cpp:
+        (JSC::MarkedBlock::lazySweep):
+
 2011-07-18  Oliver Hunt  <oliver@apple.com>
 
         Interpreter build-fix
index e3f4819..4958416 100644 (file)
@@ -86,12 +86,18 @@ MarkedBlock::FreeCell* MarkedBlock::lazySweep()
     // This is fine, since the allocation code makes no assumptions about the
     // order of the free list.
     
+    void* jsFinalObjectVPtr = m_heap->globalData()->jsFinalObjectVPtr;
+    
     FreeCell* result = 0;
     
     for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) {
         if (!m_marks.testAndSet(i)) {
             JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[i]);
-            cell->~JSCell();
+            if (cell->vptr() == jsFinalObjectVPtr) {
+                JSFinalObject* object = reinterpret_cast<JSFinalObject*>(cell);
+                object->JSFinalObject::~JSFinalObject();
+            } else
+                cell->~JSCell();
             FreeCell* freeCell = reinterpret_cast<FreeCell*>(cell);
             freeCell->next = result;
             result = freeCell;