Title: [179361] trunk/Source/_javascript_Core
Revision
179361
Author
[email protected]
Date
2015-01-29 13:41:32 -0800 (Thu, 29 Jan 2015)

Log Message

Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
https://bugs.webkit.org/show_bug.cgi?id=140900

Reviewed by Mark Hahnenberg.

Re-landing just the WeakBlock piece of this patch.

* heap/WeakBlock.cpp:
(JSC::WeakBlock::create):
(JSC::WeakBlock::destroy):
(JSC::WeakBlock::WeakBlock):
* heap/WeakBlock.h:
* heap/WeakSet.cpp:
(JSC::WeakSet::~WeakSet):
(JSC::WeakSet::addAllocator):
(JSC::WeakSet::removeAllocator):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179360 => 179361)


--- trunk/Source/_javascript_Core/ChangeLog	2015-01-29 21:32:32 UTC (rev 179360)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-01-29 21:41:32 UTC (rev 179361)
@@ -1,5 +1,24 @@
 2015-01-29  Geoffrey Garen  <[email protected]>
 
+        Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
+        https://bugs.webkit.org/show_bug.cgi?id=140900
+
+        Reviewed by Mark Hahnenberg.
+
+        Re-landing just the WeakBlock piece of this patch.
+
+        * heap/WeakBlock.cpp:
+        (JSC::WeakBlock::create):
+        (JSC::WeakBlock::destroy):
+        (JSC::WeakBlock::WeakBlock):
+        * heap/WeakBlock.h:
+        * heap/WeakSet.cpp:
+        (JSC::WeakSet::~WeakSet):
+        (JSC::WeakSet::addAllocator):
+        (JSC::WeakSet::removeAllocator):
+
+2015-01-29  Geoffrey Garen  <[email protected]>
+
         Use Vector instead of GCSegmentedArray in CodeBlockSet
         https://bugs.webkit.org/show_bug.cgi?id=141044
 

Modified: trunk/Source/_javascript_Core/heap/WeakBlock.cpp (179360 => 179361)


--- trunk/Source/_javascript_Core/heap/WeakBlock.cpp	2015-01-29 21:32:32 UTC (rev 179360)
+++ trunk/Source/_javascript_Core/heap/WeakBlock.cpp	2015-01-29 21:41:32 UTC (rev 179361)
@@ -34,15 +34,20 @@
 
 namespace JSC {
 
-WeakBlock* WeakBlock::create(DeadBlock* block)
+WeakBlock* WeakBlock::create()
 {
-    Region* region = block->region();
-    return new (NotNull, block) WeakBlock(region);
+    return new (NotNull, fastMalloc(blockSize)) WeakBlock();
 }
 
-WeakBlock::WeakBlock(Region* region)
-    : HeapBlock<WeakBlock>(region)
+void WeakBlock::destroy(WeakBlock* block)
 {
+    block->~WeakBlock();
+    fastFree(block);
+}
+
+WeakBlock::WeakBlock()
+    : DoublyLinkedListNode<WeakBlock>()
+{
     for (size_t i = 0; i < weakImplCount(); ++i) {
         WeakImpl* weakImpl = &weakImpls()[i];
         new (NotNull, weakImpl) WeakImpl;

Modified: trunk/Source/_javascript_Core/heap/WeakBlock.h (179360 => 179361)


--- trunk/Source/_javascript_Core/heap/WeakBlock.h	2015-01-29 21:32:32 UTC (rev 179360)
+++ trunk/Source/_javascript_Core/heap/WeakBlock.h	2015-01-29 21:41:32 UTC (rev 179361)
@@ -26,7 +26,7 @@
 #ifndef WeakBlock_h
 #define WeakBlock_h
 
-#include "HeapBlock.h"
+#include <wtf/DoublyLinkedList.h>
 #include "WeakHandleOwner.h"
 #include "WeakImpl.h"
 #include <wtf/DoublyLinkedList.h>
@@ -34,14 +34,13 @@
 
 namespace JSC {
 
-class DeadBlock;
 class HeapRootVisitor;
 class JSValue;
 class WeakHandleOwner;
 
-class WeakBlock : public HeapBlock<WeakBlock> {
+class WeakBlock : public DoublyLinkedListNode<WeakBlock> {
 public:
-    friend class WTF::DoublyLinkedListNode<WeakBlock>;
+    friend class DoublyLinkedListNode<WeakBlock>;
     static const size_t blockSize = 4 * KB; // 5% of MarkedBlock size
 
     struct FreeCell {
@@ -56,7 +55,8 @@
         FreeCell* freeList;
     };
 
-    static WeakBlock* create(DeadBlock*);
+    static WeakBlock* create();
+    static void destroy(WeakBlock*);
 
     static WeakImpl* asWeakImpl(FreeCell*);
 
@@ -73,13 +73,15 @@
 private:
     static FreeCell* asFreeCell(WeakImpl*);
 
-    WeakBlock(Region*);
+    WeakBlock();
     WeakImpl* firstWeakImpl();
     void finalize(WeakImpl*);
     WeakImpl* weakImpls();
     size_t weakImplCount();
     void addToFreeList(FreeCell**, WeakImpl*);
 
+    WeakBlock* m_prev;
+    WeakBlock* m_next;
     SweepResult m_sweepResult;
 };
 

Modified: trunk/Source/_javascript_Core/heap/WeakSet.cpp (179360 => 179361)


--- trunk/Source/_javascript_Core/heap/WeakSet.cpp	2015-01-29 21:32:32 UTC (rev 179360)
+++ trunk/Source/_javascript_Core/heap/WeakSet.cpp	2015-01-29 21:41:32 UTC (rev 179361)
@@ -37,7 +37,7 @@
     WeakBlock* next = 0;
     for (WeakBlock* block = m_blocks.head(); block; block = next) {
         next = block->next();
-        heap()->blockAllocator().deallocate(WeakBlock::destroy(block));
+        WeakBlock::destroy(block);
     }
     m_blocks.clear();
 }
@@ -74,7 +74,7 @@
 
 WeakBlock::FreeCell* WeakSet::addAllocator()
 {
-    WeakBlock* block = WeakBlock::create(heap()->blockAllocator().allocate<WeakBlock>());
+    WeakBlock* block = WeakBlock::create();
     heap()->didAllocate(WeakBlock::blockSize);
     m_blocks.append(block);
     WeakBlock::SweepResult sweepResult = block->takeSweepResult();
@@ -85,7 +85,7 @@
 void WeakSet::removeAllocator(WeakBlock* block)
 {
     m_blocks.remove(block);
-    heap()->blockAllocator().deallocate(WeakBlock::destroy(block));
+    WeakBlock::destroy(block);
 }
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to