2011-02-22 Sheriff Bot <webkit.review.bot@gmail.com>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 03:31:00 +0000 (03:31 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 03:31:00 +0000 (03:31 +0000)
        Unreviewed, rolling out r79367.
        http://trac.webkit.org/changeset/79367
        https://bugs.webkit.org/show_bug.cgi?id=55012

        all layout tests are crashing on Snow Leopard (Requested by
        rniwa on #webkit).

        * GNUmakefile.am:
        * JavaScriptCore.gypi:
        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * runtime/MarkedBlock.cpp:
        (JSC::MarkedBlock::MarkedBlock):
        * runtime/MarkedBlock.h:
        * runtime/MarkedSpace.cpp:
        (JSC::MarkedSpace::destroy):
        (JSC::MarkedSpace::allocateBlock):
        (JSC::MarkedSpace::freeBlock):
        (JSC::MarkedSpace::allocate):
        (JSC::MarkedSpace::shrink):
        (JSC::MarkedSpace::reset):
        * runtime/MarkedSpace.h:
        (JSC::CollectorHeap::collectorBlock):
        * wtf/CMakeLists.txt:
        * wtf/DoublyLinkedList.h: Removed.
2011-02-22  Sheriff Bot  <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r79367.
        http://trac.webkit.org/changeset/79367
        https://bugs.webkit.org/show_bug.cgi?id=55012

        all layout tests are crashing on Snow Leopard (Requested by
        rniwa on #webkit).

        * ForwardingHeaders/wtf/DoublyLinkedList.h: Removed.
2011-02-22  Sheriff Bot  <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r79367.
        http://trac.webkit.org/changeset/79367
        https://bugs.webkit.org/show_bug.cgi?id=55012

        all layout tests are crashing on Snow Leopard (Requested by
        rniwa on #webkit).

        * ForwardingHeaders/wtf/DoublyLinkedList.h: Removed.

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

15 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.am
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/runtime/MarkedBlock.cpp
Source/JavaScriptCore/runtime/MarkedBlock.h
Source/JavaScriptCore/runtime/MarkedSpace.cpp
Source/JavaScriptCore/runtime/MarkedSpace.h
Source/JavaScriptCore/wtf/CMakeLists.txt
Source/JavaScriptCore/wtf/DoublyLinkedList.h [deleted file]
Source/JavaScriptGlue/ChangeLog
Source/JavaScriptGlue/ForwardingHeaders/wtf/DoublyLinkedList.h [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/wtf/DoublyLinkedList.h [deleted file]

index e0b9717..7f3c109 100644 (file)
@@ -1,3 +1,31 @@
+2011-02-22  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r79367.
+        http://trac.webkit.org/changeset/79367
+        https://bugs.webkit.org/show_bug.cgi?id=55012
+
+        all layout tests are crashing on Snow Leopard (Requested by
+        rniwa on #webkit).
+
+        * GNUmakefile.am:
+        * JavaScriptCore.gypi:
+        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * runtime/MarkedBlock.cpp:
+        (JSC::MarkedBlock::MarkedBlock):
+        * runtime/MarkedBlock.h:
+        * runtime/MarkedSpace.cpp:
+        (JSC::MarkedSpace::destroy):
+        (JSC::MarkedSpace::allocateBlock):
+        (JSC::MarkedSpace::freeBlock):
+        (JSC::MarkedSpace::allocate):
+        (JSC::MarkedSpace::shrink):
+        (JSC::MarkedSpace::reset):
+        * runtime/MarkedSpace.h:
+        (JSC::CollectorHeap::collectorBlock):
+        * wtf/CMakeLists.txt:
+        * wtf/DoublyLinkedList.h: Removed.
+
 2011-02-22  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Oliver Hunt.
index 1afb96c..0299166 100644 (file)
@@ -441,7 +441,6 @@ javascriptcore_sources += \
        Source/JavaScriptCore/wtf/Decoder.h \
        Source/JavaScriptCore/wtf/Deque.h \
        Source/JavaScriptCore/wtf/DisallowCType.h \
-       Source/JavaScriptCore/wtf/DoublyLinkedList.h \
        Source/JavaScriptCore/wtf/dtoa.cpp \
        Source/JavaScriptCore/wtf/dtoa.h \
        Source/JavaScriptCore/wtf/Encoder.h \
index eae3a9d..656e16d 100644 (file)
             'wtf/DecimalNumber.cpp',
             'wtf/Deque.h',
             'wtf/DisallowCType.h',
-            'wtf/DoublyLinkedList.h',
             'wtf/dtoa.cpp',
             'wtf/dtoa.h',
             'wtf/FastAllocBase.h',
index d0e6ba8..5f854f9 100644 (file)
                        >
                </File>
                <File
-                       RelativePath="..\..\wtf\DoublyLinkedList.h"
-                       >
-               </File>
-               <File
                        RelativePath="..\..\wtf\dtoa.cpp"
                        >
                </File>
index 3935f2c..237ddb9 100644 (file)
                1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */; };
                1440F8AF0A508D200005F061 /* JSCallbackConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */; };
                1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */; };
-               14456A321314657800212CA3 /* DoublyLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = 14456A311314657800212CA3 /* DoublyLinkedList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14469DD7107EC79E00650446 /* dtoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651F6412039D5B5F0078395C /* dtoa.cpp */; };
                14469DDE107EC7E700650446 /* Lookup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8680255597D01FF60F7 /* Lookup.cpp */; };
                14469DDF107EC7E700650446 /* MathObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A86A0255597D01FF60F7 /* MathObject.cpp */; };
                1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackConstructor.cpp; sourceTree = "<group>"; };
                1440FCE10A51E46B0005F061 /* JSClassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClassRef.h; sourceTree = "<group>"; };
                1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; };
-               14456A311314657800212CA3 /* DoublyLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoublyLinkedList.h; sourceTree = "<group>"; };
                145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; };
                146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; };
                146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; };
                                862AF4B512239C7B0024E5B8 /* DecimalNumber.h */,
                                5186111D0CC824830081412B /* Deque.h */,
                                938C4F6B0CA06BCE00D9310A /* DisallowCType.h */,
-                               14456A311314657800212CA3 /* DoublyLinkedList.h */,
                                651F6412039D5B5F0078395C /* dtoa.cpp */,
                                651F6413039D5B5F0078395C /* dtoa.h */,
                                E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */,
                                5135FAF212D26ACE003C083B /* Decoder.h in Headers */,
                                BC18C3FC0E16F5CD00B34460 /* Deque.h in Headers */,
                                BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */,
-                               14456A321314657800212CA3 /* DoublyLinkedList.h in Headers */,
                                BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */,
                                5135FAF312D26AD1003C083B /* Encoder.h in Headers */,
                                BC3046070E1F497F003232CF /* Error.h in Headers */,
index c66d15c..af64835 100644 (file)
@@ -50,8 +50,6 @@ MarkedBlock::MarkedBlock(const PageAllocationAligned& allocation, JSGlobalData*
     , m_endAtom(atomsPerBlock - m_atomsPerCell + 1)
     , m_allocation(allocation)
     , m_heap(&globalData->heap)
-    , m_prev(0)
-    , m_next(0)
 {
     Structure* dummyMarkableCellStructure = globalData->dummyMarkableCellStructure.get();
     for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell)
index 161d6df..396fe4e 100644 (file)
@@ -54,11 +54,6 @@ namespace JSC {
         static size_t firstAtom();
         
         Heap* heap() const;
-
-        void setPrev(MarkedBlock*);
-        void setNext(MarkedBlock*);
-        MarkedBlock* prev() const;
-        MarkedBlock* next() const;
         
         void* allocate(size_t& nextCell);
         void sweep();
@@ -102,8 +97,6 @@ namespace JSC {
         WTF::Bitmap<blockSize / atomSize> m_marks;
         PageAllocationAligned m_allocation;
         Heap* m_heap;
-        MarkedBlock* m_prev;
-        MarkedBlock* m_next;
     };
 
     inline size_t MarkedBlock::firstAtom()
@@ -131,26 +124,6 @@ namespace JSC {
         return m_heap;
     }
 
-    inline void MarkedBlock::setPrev(MarkedBlock* prev)
-    {
-        m_prev = prev;
-    }
-
-    inline void MarkedBlock::setNext(MarkedBlock* next)
-    {
-        m_next = next;
-    }
-
-    inline MarkedBlock* MarkedBlock::prev() const
-    {
-        return m_prev;
-    }
-
-    inline MarkedBlock* MarkedBlock::next() const
-    {
-        return m_next;
-    }
-
     inline bool MarkedBlock::isEmpty()
     {
         return m_marks.isEmpty();
index 468a80f..0096daa 100644 (file)
@@ -39,64 +39,56 @@ MarkedSpace::MarkedSpace(JSGlobalData* globalData)
 
 void MarkedSpace::destroy()
 {
-    clearMarks();
-    shrink();
-    ASSERT(!size());
+    clearMarks(); // Make sure weak pointers appear dead during destruction.
+
+    while (m_heap.blocks.size())
+        freeBlock(0);
 }
 
 NEVER_INLINE MarkedBlock* MarkedSpace::allocateBlock()
 {
     MarkedBlock* block = MarkedBlock::create(globalData(), cellSize);
-    m_heap.blockList.append(block);
+    m_heap.blocks.append(block);
     m_blocks.add(block);
-
     return block;
 }
 
-void MarkedSpace::freeBlocks(DoublyLinkedList<MarkedBlock>& blocks)
+NEVER_INLINE void MarkedSpace::freeBlock(size_t blockNumber)
 {
-    MarkedBlock* next = 0;
-    for (MarkedBlock* block = blocks.head(); block; block = next) {
-        next = block->next();
+    MarkedBlock* block = m_heap.blocks[blockNumber];
 
-        blocks.remove(block);
-        m_blocks.remove(block);
-        MarkedBlock::destroy(block);
-    }
+    // swap with the last block so we compact as we go
+    m_heap.blocks[blockNumber] = m_heap.blocks.last();
+    m_heap.blocks.removeLast();
+    m_blocks.remove(block);
+
+    MarkedBlock::destroy(block);
 }
 
 void* MarkedSpace::allocate(size_t)
 {
-    for ( ; m_heap.nextBlock; m_heap.nextBlock = m_heap.nextBlock->next()) {
-        if (void* result = m_heap.nextBlock->allocate(m_heap.nextAtom))
+    for ( ; m_heap.nextBlock < m_heap.blocks.size(); ++m_heap.nextBlock) {
+        MarkedBlock* block = m_heap.collectorBlock(m_heap.nextBlock);
+        if (void* result = block->allocate(m_heap.nextAtom))
             return result;
 
-        m_waterMark += m_heap.nextBlock->capacity();
+        m_waterMark += block->capacity();
     }
 
-    if (m_waterMark < m_highWaterMark) {
-        m_heap.nextBlock = allocateBlock();
-        return m_heap.nextBlock->allocate(m_heap.nextAtom);
-    }
+    if (m_waterMark < m_highWaterMark)
+        return allocateBlock()->allocate(m_heap.nextAtom);
 
     return 0;
 }
 
 void MarkedSpace::shrink()
 {
-    // We record a temporary list of empties to avoid modifying m_blocks while iterating it.
-    DoublyLinkedList<MarkedBlock> empties;
-
-    BlockIterator end = m_blocks.end();
-    for (BlockIterator it = m_blocks.begin(); it != end; ++it) {
-        if ((*it)->isEmpty()) {
-            m_heap.blockList.remove(*it);
-            empties.append(*it);
-        }
+    for (size_t i = 0; i != m_heap.blocks.size() && m_heap.blocks.size() > 1; ) { // We assume at least one block exists at all times.
+        if (m_heap.collectorBlock(i)->isEmpty()) {
+            freeBlock(i);
+        } else
+            ++i;
     }
-    
-    freeBlocks(empties);
-    ASSERT(empties.isEmpty());
 }
 
 void MarkedSpace::clearMarks()
@@ -142,7 +134,7 @@ size_t MarkedSpace::capacity() const
 
 void MarkedSpace::reset()
 {
-    m_heap.nextBlock = m_heap.blockList.head();
+    m_heap.nextBlock = 0;
     m_heap.nextAtom = MarkedBlock::firstAtom();
     m_waterMark = 0;
 #if ENABLE(JSC_ZOMBIES)
index 85a2ca6..5844d40 100644 (file)
@@ -26,7 +26,6 @@
 #include "MarkedBlock.h"
 #include "PageAllocationAligned.h"
 #include <wtf/Bitmap.h>
-#include <wtf/DoublyLinkedList.h>
 #include <wtf/FixedArray.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
@@ -50,10 +49,15 @@ namespace JSC {
             , nextAtom(0)
         {
         }
+        
+        MarkedBlock* collectorBlock(size_t index) const
+        {
+            return blocks[index];
+        }
 
-        MarkedBlock* nextBlock;
+        size_t nextBlock;
         size_t nextAtom;
-        DoublyLinkedList<MarkedBlock> blockList;
+        Vector<MarkedBlock*> blocks;
     };
 
     class MarkedSpace {
@@ -96,7 +100,7 @@ namespace JSC {
         typedef HashSet<MarkedBlock*>::iterator BlockIterator;
 
         NEVER_INLINE MarkedBlock* allocateBlock();
-        NEVER_INLINE void freeBlocks(DoublyLinkedList<MarkedBlock>&);
+        NEVER_INLINE void freeBlock(size_t);
 
         void clearMarks(MarkedBlock*);
 
index 1bd69aa..f85bf02 100644 (file)
@@ -16,7 +16,6 @@ SET(WTF_HEADERS
     Decoder.h
     Deque.h
     DisallowCType.h
-    DoublyLinkedList.h
     Encoder.h
     FastAllocBase.h
     FastMalloc.h
diff --git a/Source/JavaScriptCore/wtf/DoublyLinkedList.h b/Source/JavaScriptCore/wtf/DoublyLinkedList.h
deleted file mode 100644 (file)
index 9351263..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DoublyLinkedList_h
-#define DoublyLinkedList_h
-
-namespace WTF {
-
-template <typename Node> class DoublyLinkedList {
-public:
-    DoublyLinkedList();
-    
-    bool isEmpty();
-
-    Node* head();
-
-    void append(Node*);
-    void remove(Node*);
-
-private:
-    Node* m_head;
-    Node* m_tail;
-};
-
-template <typename Node> inline DoublyLinkedList<Node>::DoublyLinkedList()
-    : m_head(0)
-    , m_tail(0)
-{
-}
-
-template <typename Node> inline bool DoublyLinkedList<Node>::isEmpty()
-{
-    return !m_head;
-}
-
-template <typename Node> inline Node* DoublyLinkedList<Node>::head()
-{
-    return m_head;
-}
-
-template <typename Node> inline void DoublyLinkedList<Node>::append(Node* node)
-{
-    if (!m_tail) {
-        ASSERT(!m_head);
-        m_head = node;
-        m_tail = node;
-        node->setPrev(0);
-        node->setNext(0);
-        return;
-    }
-
-    ASSERT(m_head);
-    m_tail->setNext(node);
-    node->setPrev(m_tail);
-    node->setNext(0);
-    m_tail = node;
-}
-
-template <typename Node> inline void DoublyLinkedList<Node>::remove(Node* node)
-{
-    if (node->prev()) {
-        ASSERT(node != m_head);
-        node->prev()->setNext(node->next());
-    } else {
-        ASSERT(node == m_head);
-        m_head = node->next();
-    }
-
-    if (node->next()) {
-        ASSERT(node != m_tail);
-        node->next()->setPrev(node->prev());
-    } else {
-        ASSERT(node == m_tail);
-        m_tail = node->prev();
-    }
-}
-
-} // namespace WTF
-
-using WTF::DoublyLinkedList;
-
-#endif
index 44a732c..2e34a6c 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-22  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r79367.
+        http://trac.webkit.org/changeset/79367
+        https://bugs.webkit.org/show_bug.cgi?id=55012
+
+        all layout tests are crashing on Snow Leopard (Requested by
+        rniwa on #webkit).
+
+        * ForwardingHeaders/wtf/DoublyLinkedList.h: Removed.
+
 2011-02-22  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/Source/JavaScriptGlue/ForwardingHeaders/wtf/DoublyLinkedList.h b/Source/JavaScriptGlue/ForwardingHeaders/wtf/DoublyLinkedList.h
deleted file mode 100644 (file)
index e87c862..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/DoublyLinkedList.h>
index 6e366b4..f8c1ef0 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-22  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r79367.
+        http://trac.webkit.org/changeset/79367
+        https://bugs.webkit.org/show_bug.cgi?id=55012
+
+        all layout tests are crashing on Snow Leopard (Requested by
+        rniwa on #webkit).
+
+        * ForwardingHeaders/wtf/DoublyLinkedList.h: Removed.
+
 2011-02-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebCore/ForwardingHeaders/wtf/DoublyLinkedList.h b/Source/WebCore/ForwardingHeaders/wtf/DoublyLinkedList.h
deleted file mode 100644 (file)
index 86c8f7a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WebCore_FWD_DoublyLinkedList_h
-#define WebCore_FWD_DoublyLinkedList_h
-#include <JavaScriptCore/DoublyLinkedList.h>
-#endif