Title: [87416] trunk/Source/_javascript_Core
- Revision
- 87416
- Author
- [email protected]
- Date
- 2011-05-26 12:34:17 -0700 (Thu, 26 May 2011)
Log Message
Rolled out http://trac.webkit.org/changeset/87408 because it broke the
Windows build.
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::MarkedBlock):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::setPrev):
(JSC::MarkedBlock::setNext):
(JSC::MarkedBlock::prev):
(JSC::MarkedBlock::next):
* wtf/DoublyLinkedList.h:
(WTF::::DoublyLinkedList):
(WTF::::isEmpty):
(WTF::::head):
(WTF::::append):
(WTF::::remove):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (87415 => 87416)
--- trunk/Source/_javascript_Core/ChangeLog 2011-05-26 19:33:58 UTC (rev 87415)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-05-26 19:34:17 UTC (rev 87416)
@@ -1,31 +1,21 @@
2011-05-26 Geoffrey Garen <[email protected]>
- Reviewed by Oliver Hunt.
+ Rolled out http://trac.webkit.org/changeset/87408 because it broke the
+ Windows build.
- Filled out some features in DoublyLinkedList
- https://bugs.webkit.org/show_bug.cgi?id=61549
-
- * heap/MarkedBlock.h: Use DoublyLinkedListNode to simplify our class
- definition.
-
+ * heap/MarkedBlock.cpp:
+ (JSC::MarkedBlock::MarkedBlock):
+ * heap/MarkedBlock.h:
+ (JSC::MarkedBlock::setPrev):
+ (JSC::MarkedBlock::setNext):
+ (JSC::MarkedBlock::prev):
+ (JSC::MarkedBlock::next):
* wtf/DoublyLinkedList.h:
- (WTF::::DoublyLinkedListNode):
- (WTF::::setPrev):
- (WTF::::setNext):
- (WTF::::prev):
- (WTF::::next): Added a helper base class for being a node in a list.
- The odd idioms here allow subclasses to choose their own data member
- layout, which is sometimes important for performance.
-
(WTF::::DoublyLinkedList):
(WTF::::isEmpty):
- (WTF::::size):
- (WTF::::clear):
(WTF::::head):
(WTF::::append):
(WTF::::remove):
- (WTF::::removeHead): Change "Node" to "T" to be more idiomatic, and added
- clear(), removeHead(), and size() functions.
2011-05-26 Geoffrey Garen <[email protected]>
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.cpp (87415 => 87416)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2011-05-26 19:33:58 UTC (rev 87415)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2011-05-26 19:34:17 UTC (rev 87416)
@@ -52,6 +52,8 @@
: m_nextAtom(firstAtom())
, m_allocation(allocation)
, m_heap(&globalData->heap)
+ , m_prev(0)
+ , m_next(0)
{
m_atomsPerCell = (cellSize + atomSize - 1) / atomSize;
m_endAtom = atomsPerBlock - m_atomsPerCell + 1;
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.h (87415 => 87416)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.h 2011-05-26 19:33:58 UTC (rev 87415)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.h 2011-05-26 19:34:17 UTC (rev 87416)
@@ -23,7 +23,6 @@
#define MarkedBlock_h
#include <wtf/Bitmap.h>
-#include <wtf/DoublyLinkedList.h>
#include <wtf/PageAllocationAligned.h>
#include <wtf/StdLibExtras.h>
@@ -37,8 +36,7 @@
static const size_t KB = 1024;
- class MarkedBlock : public DoublyLinkedListNode<MarkedBlock> {
- friend class DoublyLinkedListNode<MarkedBlock>;
+ class MarkedBlock {
public:
static const size_t atomSize = sizeof(double); // Ensures natural alignment for all built-in types.
@@ -51,6 +49,11 @@
Heap* heap() const;
+ void setPrev(MarkedBlock*);
+ void setNext(MarkedBlock*);
+ MarkedBlock* prev() const;
+ MarkedBlock* next() const;
+
void* allocate();
void reset();
void sweep();
@@ -121,6 +124,26 @@
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 void MarkedBlock::reset()
{
m_nextAtom = firstAtom();
Modified: trunk/Source/_javascript_Core/wtf/DoublyLinkedList.h (87415 => 87416)
--- trunk/Source/_javascript_Core/wtf/DoublyLinkedList.h 2011-05-26 19:33:58 UTC (rev 87415)
+++ trunk/Source/_javascript_Core/wtf/DoublyLinkedList.h 2011-05-26 19:34:17 UTC (rev 87416)
@@ -28,94 +28,39 @@
namespace WTF {
-// This class allows nodes to share code without dictating data member layout.
-template<typename T> class DoublyLinkedListNode {
+template <typename Node> class DoublyLinkedList {
public:
- DoublyLinkedListNode();
-
- void setPrev(T*);
- void setNext(T*);
-
- T* prev() const;
- T* next() const;
-};
-
-template<typename T> inline DoublyLinkedListNode<T>::DoublyLinkedListNode()
-{
- setPrev(0);
- setNext(0);
-}
-
-template<typename T> inline void DoublyLinkedListNode<T>::setPrev(T* prev)
-{
- static_cast<T*>(this)->m_prev = prev;
-}
-
-template<typename T> inline void DoublyLinkedListNode<T>::setNext(T* next)
-{
- static_cast<T*>(this)->m_next = next;
-}
-
-template<typename T> inline T* DoublyLinkedListNode<T>::prev() const
-{
- return static_cast<const T*>(this)->m_prev;
-}
-
-template<typename T> inline T* DoublyLinkedListNode<T>::next() const
-{
- return static_cast<const T*>(this)->m_next;
-}
-
-template<typename T> class DoublyLinkedList {
-public:
DoublyLinkedList();
- bool isEmpty() const;
- size_t size() const; // This is O(n).
- void clear();
+ bool isEmpty();
- T* head() const;
- T* removeHead();
+ Node* head();
- void append(T*);
- void remove(T*);
+ void append(Node*);
+ void remove(Node*);
private:
- T* m_head;
- T* m_tail;
+ Node* m_head;
+ Node* m_tail;
};
-template<typename T> inline DoublyLinkedList<T>::DoublyLinkedList()
+template <typename Node> inline DoublyLinkedList<Node>::DoublyLinkedList()
: m_head(0)
, m_tail(0)
{
}
-template<typename T> inline bool DoublyLinkedList<T>::isEmpty() const
+template <typename Node> inline bool DoublyLinkedList<Node>::isEmpty()
{
return !m_head;
}
-template<typename T> inline size_t DoublyLinkedList<T>::size() const
+template <typename Node> inline Node* DoublyLinkedList<Node>::head()
{
- size_t size = 0;
- for (T* node = m_head; node; node = node->next())
- ++size;
- return size;
-}
-
-template<typename T> inline void DoublyLinkedList<T>::clear()
-{
- m_head = 0;
- m_tail = 0;
-}
-
-template<typename T> inline T* DoublyLinkedList<T>::head() const
-{
return m_head;
}
-template<typename T> inline void DoublyLinkedList<T>::append(T* node)
+template <typename Node> inline void DoublyLinkedList<Node>::append(Node* node)
{
if (!m_tail) {
ASSERT(!m_head);
@@ -133,7 +78,7 @@
m_tail = node;
}
-template<typename T> inline void DoublyLinkedList<T>::remove(T* node)
+template <typename Node> inline void DoublyLinkedList<Node>::remove(Node* node)
{
if (node->prev()) {
ASSERT(node != m_head);
@@ -152,17 +97,8 @@
}
}
-template<typename T> inline T* DoublyLinkedList<T>::removeHead()
-{
- T* node = head();
- if (node)
- remove(node);
- return node;
-}
-
} // namespace WTF
-using WTF::DoublyLinkedListNode;
using WTF::DoublyLinkedList;
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes