Title: [179443] trunk/Source
Revision
179443
Author
commit-qu...@webkit.org
Date
2015-01-31 10:28:17 -0800 (Sat, 31 Jan 2015)

Log Message

Unreviewed, rolling out r179426.
https://bugs.webkit.org/show_bug.cgi?id=141119

"caused a memory use regression" (Requested by Guest45 on
#webkit).

Reverted changeset:

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179442 => 179443)


--- trunk/Source/_javascript_Core/ChangeLog	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-01-31 18:28:17 UTC (rev 179443)
@@ -1,3 +1,18 @@
+2015-01-31  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r179426.
+        https://bugs.webkit.org/show_bug.cgi?id=141119
+
+        "caused a memory use regression" (Requested by Guest45 on
+        #webkit).
+
+        Reverted changeset:
+
+        "Use FastMalloc (bmalloc) instead of BlockAllocator for GC
+        pages"
+        https://bugs.webkit.org/show_bug.cgi?id=140900
+        http://trac.webkit.org/changeset/179426
+
 2015-01-30  Daniel Bates  <daba...@apple.com>
 
         Clean up: Remove unnecessary <dispatch/dispatch.h> header from RemoteInspectorDebuggableConnection.h

Modified: trunk/Source/_javascript_Core/heap/HandleBlock.h (179442 => 179443)


--- trunk/Source/_javascript_Core/heap/HandleBlock.h	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/_javascript_Core/heap/HandleBlock.h	2015-01-31 18:28:17 UTC (rev 179443)
@@ -34,11 +34,9 @@
 class HandleSet;
 class HandleNode;
 
-class HandleBlock : public DoublyLinkedListNode<HandleBlock> {
-    friend class WTF::DoublyLinkedListNode<HandleBlock>;
+class HandleBlock : public HeapBlock<HandleBlock> {
 public:
-    static HandleBlock* create(HandleSet*);
-    static void destroy(HandleBlock*);
+    static HandleBlock* create(DeadBlock*, HandleSet*);
     static HandleBlock* blockFor(HandleNode*);
 
     static const size_t blockSize = 4 * KB;
@@ -50,15 +48,13 @@
     unsigned nodeCapacity();
 
 private:
-    HandleBlock(HandleSet*);
+    HandleBlock(Region*, HandleSet*);
 
     char* payload();
     char* payloadEnd();
 
     static const size_t s_blockMask = ~(blockSize - 1);
 
-    HandleBlock* m_prev;
-    HandleBlock* m_next;
     HandleSet* m_handleSet;
 };
 

Modified: trunk/Source/_javascript_Core/heap/HandleBlockInlines.h (179442 => 179443)


--- trunk/Source/_javascript_Core/heap/HandleBlockInlines.h	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/_javascript_Core/heap/HandleBlockInlines.h	2015-01-31 18:28:17 UTC (rev 179443)
@@ -28,30 +28,24 @@
 
 #include "BlockAllocator.h"
 #include "HandleBlock.h"
-#include <wtf/FastMalloc.h>
 
 namespace JSC {
 
-inline HandleBlock* HandleBlock::create(HandleSet* handleSet)
+inline HandleBlock* HandleBlock::create(DeadBlock* block, HandleSet* handleSet)
 {
-    return new (NotNull, fastAlignedMalloc(blockSize, blockSize)) HandleBlock(handleSet);
+    Region* region = block->region();
+    return new (NotNull, block) HandleBlock(region, handleSet);
 }
 
-inline void HandleBlock::destroy(HandleBlock* block)
-{
-    block->~HandleBlock();
-    fastAlignedFree(block);
-}
-
-inline HandleBlock::HandleBlock(HandleSet* handleSet)
-    : DoublyLinkedListNode<HandleBlock>()
+inline HandleBlock::HandleBlock(Region* region, HandleSet* handleSet)
+    : HeapBlock<HandleBlock>(region)
     , m_handleSet(handleSet)
 {
 }
 
 inline char* HandleBlock::payloadEnd()
 {
-    return reinterpret_cast<char*>(this) + blockSize;
+    return reinterpret_cast<char*>(this) + region()->blockSize();
 }
 
 inline char* HandleBlock::payload()

Modified: trunk/Source/_javascript_Core/heap/HandleSet.cpp (179442 => 179443)


--- trunk/Source/_javascript_Core/heap/HandleSet.cpp	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/_javascript_Core/heap/HandleSet.cpp	2015-01-31 18:28:17 UTC (rev 179443)
@@ -44,12 +44,12 @@
 HandleSet::~HandleSet()
 {
     while (!m_blockList.isEmpty())
-        HandleBlock::destroy(m_blockList.removeHead());
+        m_vm->heap.blockAllocator().deallocate(HandleBlock::destroy(m_blockList.removeHead()));
 }
 
 void HandleSet::grow()
 {
-    HandleBlock* newBlock = HandleBlock::create(this);
+    HandleBlock* newBlock = HandleBlock::create(m_vm->heap.blockAllocator().allocate<HandleBlock>(), this);
     m_blockList.append(newBlock);
 
     for (int i = newBlock->nodeCapacity() - 1; i >= 0; --i) {

Modified: trunk/Source/WTF/ChangeLog (179442 => 179443)


--- trunk/Source/WTF/ChangeLog	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/WTF/ChangeLog	2015-01-31 18:28:17 UTC (rev 179443)
@@ -1,5 +1,20 @@
 2015-01-31  Commit Queue  <commit-qu...@webkit.org>
 
+        Unreviewed, rolling out r179426.
+        https://bugs.webkit.org/show_bug.cgi?id=141119
+
+        "caused a memory use regression" (Requested by Guest45 on
+        #webkit).
+
+        Reverted changeset:
+
+        "Use FastMalloc (bmalloc) instead of BlockAllocator for GC
+        pages"
+        https://bugs.webkit.org/show_bug.cgi?id=140900
+        http://trac.webkit.org/changeset/179426
+
+2015-01-31  Commit Queue  <commit-qu...@webkit.org>
+
         Unreviewed, rolling out r179408.
         https://bugs.webkit.org/show_bug.cgi?id=141117
 

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (179442 => 179443)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2015-01-31 18:28:17 UTC (rev 179443)
@@ -162,34 +162,6 @@
 #endif
 }
 
-#if OS(WINDOWS)
-
-void* fastAlignedMalloc(size_t alignment, size_t size) 
-{
-    return _aligned_malloc(alignment, size);
-}
-
-void fastAlignedFree(void* p) 
-{
-    _aligned_free(p);
-}
-
-#else
-
-void* fastAlignedMalloc(size_t alignment, size_t size) 
-{
-    void* p = nullptr;
-    posix_memalign(&p, alignment, size);
-    return p;
-}
-
-void fastAlignedFree(void* p) 
-{
-    free(p);
-}
-
-#endif // OS(WINDOWS)
-
 TryMallocReturnValue tryFastMalloc(size_t n) 
 {
     return malloc(n);
@@ -301,16 +273,6 @@
     return size;
 }
     
-void* fastAlignedMalloc(size_t alignment, size_t size) 
-{
-    return bmalloc::api::memalign(alignment, size);
-}
-
-void fastAlignedFree(void* p) 
-{
-    bmalloc::api::free(p);
-}
-
 TryMallocReturnValue tryFastMalloc(size_t size)
 {
     return fastMalloc(size);
@@ -4062,6 +4024,7 @@
   }
 }
 
+#ifndef WTF_CHANGES
 // For use by exported routines below that want specific alignments
 //
 // Note: this code can be slow, and can significantly fragment memory.
@@ -4132,6 +4095,7 @@
   }
   return SpanToMallocResult(span);
 }
+#endif
 
 // Helpers for use by exported routines below:
 
@@ -4188,16 +4152,6 @@
 template <bool crashOnFailure>
 ALWAYS_INLINE void* malloc(size_t);
 
-void* fastAlignedMalloc(size_t alignment, size_t size) 
-{
-    return do_memalign(alignment, size);
-}
-
-void fastAlignedFree(void* p) 
-{
-    do_free(p);
-}
-
 void* fastMalloc(size_t size)
 {
     void* result = malloc<true>(size);

Modified: trunk/Source/WTF/wtf/FastMalloc.h (179442 => 179443)


--- trunk/Source/WTF/wtf/FastMalloc.h	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/WTF/wtf/FastMalloc.h	2015-01-31 18:28:17 UTC (rev 179443)
@@ -37,10 +37,6 @@
     WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
     WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
 
-    // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree().
-    WTF_EXPORT_PRIVATE void* fastAlignedMalloc(size_t alignment, size_t);
-    WTF_EXPORT_PRIVATE void fastAlignedFree(void*);
-
     struct TryMallocReturnValue {
         TryMallocReturnValue(void* data)
             : m_data(data)
@@ -108,8 +104,6 @@
 using WTF::tryFastMalloc;
 using WTF::tryFastRealloc;
 using WTF::tryFastZeroedMalloc;
-using WTF::fastAlignedMalloc;
-using WTF::fastAlignedFree;
 
 #if COMPILER(GCC) && OS(DARWIN)
 #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))

Modified: trunk/Source/WebCore/ChangeLog (179442 => 179443)


--- trunk/Source/WebCore/ChangeLog	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/WebCore/ChangeLog	2015-01-31 18:28:17 UTC (rev 179443)
@@ -1,3 +1,18 @@
+2015-01-31  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r179426.
+        https://bugs.webkit.org/show_bug.cgi?id=141119
+
+        "caused a memory use regression" (Requested by Guest45 on
+        #webkit).
+
+        Reverted changeset:
+
+        "Use FastMalloc (bmalloc) instead of BlockAllocator for GC
+        pages"
+        https://bugs.webkit.org/show_bug.cgi?id=140900
+        http://trac.webkit.org/changeset/179426
+
 2015-01-30  Zalan Bujtas  <za...@apple.com>
 
         Simple line layout: Improve FlowContentsIterator::TextFragment's encapsulation.

Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (179442 => 179443)


--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm	2015-01-31 18:12:55 UTC (rev 179442)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm	2015-01-31 18:28:17 UTC (rev 179443)
@@ -115,11 +115,14 @@
 
     // Allow simulation of memory pressure with "notifyutil -p org.WebKit.lowMemory"
     notify_register_dispatch("org.WebKit.lowMemory", &_notifyToken, dispatch_get_main_queue(), ^(int) {
+        memoryPressureHandler().respondToMemoryPressure(true);
+
         // We only do a synchronous GC when *simulating* memory pressure.
         // This gives us a more consistent picture of live objects at the end of testing.
         gcController().garbageCollectNow();
 
-        memoryPressureHandler().respondToMemoryPressure(true);
+        // Release any freed up blocks from the JS heap back to the system.
+        JSDOMWindowBase::commonVM().heap.blockAllocator().releaseFreeRegions();
 
         malloc_zone_pressure_relief(nullptr, 0);
     });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to