Title: [141504] trunk/Source
Revision
141504
Author
jber...@webkit.org
Date
2013-01-31 16:37:38 -0800 (Thu, 31 Jan 2013)

Log Message

Rolling out r141407 because it is causing crashes under
WTF::TCMalloc_Central_FreeList::FetchFromSpans() in Release builds.

Source/_javascript_Core:

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):

Source/WTF:

* wtf/Deque.h:
(WTF::::expandCapacity):
* wtf/FastMalloc.cpp:
* wtf/FastMalloc.h:
(WTF):
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (141503 => 141504)


--- trunk/Source/_javascript_Core/ChangeLog	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-02-01 00:37:38 UTC (rev 141504)
@@ -1,3 +1,11 @@
+2013-01-31  Jessie Berlin  <jber...@apple.com>
+
+        Rolling out r141407 because it is causing crashes under
+        WTF::TCMalloc_Central_FreeList::FetchFromSpans() in Release builds.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::CodeBlock):
+
 2013-01-31  Mark Hahnenberg  <mhahnenb...@apple.com>
 
         Objective-C API: JSContext exception property causes reference cycle

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (141503 => 141504)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2013-02-01 00:37:38 UTC (rev 141504)
@@ -1820,10 +1820,12 @@
     if (size_t size = unlinkedCodeBlock->numberOfResolveOperations())
         m_resolveOperations.grow(size);
     size_t putToBaseCount = unlinkedCodeBlock->numberOfPutToBaseOperations();
-    m_putToBaseOperations.reserveInitialCapacity(putToBaseCount);
+    m_putToBaseOperations.reserveCapacity(putToBaseCount);
     for (size_t i = 0; i < putToBaseCount; ++i)
-        m_putToBaseOperations.uncheckedAppend(PutToBaseOperation(isStrictMode()));
+        m_putToBaseOperations.append(PutToBaseOperation(isStrictMode()));
 
+    ASSERT(m_putToBaseOperations.capacity() == putToBaseCount);
+
     // Copy and translate the UnlinkedInstructions
     size_t instructionCount = unlinkedCodeBlock->instructions().size();
     UnlinkedInstruction* pc = unlinkedCodeBlock->instructions().data();

Modified: trunk/Source/WTF/ChangeLog (141503 => 141504)


--- trunk/Source/WTF/ChangeLog	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/WTF/ChangeLog	2013-02-01 00:37:38 UTC (rev 141504)
@@ -1,3 +1,18 @@
+2013-01-31  Jessie Berlin  <jber...@apple.com>
+
+        Rolling out r141407 because it is causing crashes under
+        WTF::TCMalloc_Central_FreeList::FetchFromSpans() in Release builds.
+
+        * wtf/Deque.h:
+        (WTF::::expandCapacity):
+        * wtf/FastMalloc.cpp:
+        * wtf/FastMalloc.h:
+        (WTF):
+        * wtf/Vector.h:
+        (WTF::VectorBufferBase::allocateBuffer):
+        (WTF::VectorBufferBase::tryAllocateBuffer):
+        (WTF::VectorBufferBase::reallocateBuffer):
+
 2013-01-31  Mark Lam  <mark....@apple.com>
 
         Abstraction for hiding enum class.

Modified: trunk/Source/WTF/wtf/Deque.h (141503 => 141504)


--- trunk/Source/WTF/wtf/Deque.h	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/WTF/wtf/Deque.h	2013-02-01 00:37:38 UTC (rev 141504)
@@ -383,13 +383,14 @@
     {
         checkValidity();
         size_t oldCapacity = m_buffer.capacity();
+        size_t newCapacity = std::max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1);
         T* oldBuffer = m_buffer.buffer();
-        m_buffer.allocateBuffer(std::max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1));
+        m_buffer.allocateBuffer(newCapacity);
         if (m_start <= m_end)
             TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffer.buffer() + m_start);
         else {
             TypeOperations::move(oldBuffer, oldBuffer + m_end, m_buffer.buffer());
-            size_t newStart = m_buffer.capacity() - (oldCapacity - m_start);
+            size_t newStart = newCapacity - (oldCapacity - m_start);
             TypeOperations::move(oldBuffer + m_start, oldBuffer + oldCapacity, m_buffer.buffer() + newStart);
             m_start = newStart;
         }

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (141503 => 141504)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2013-02-01 00:37:38 UTC (rev 141504)
@@ -237,15 +237,6 @@
 
 namespace WTF {
 
-size_t fastMallocGoodSize(size_t bytes)
-{
-#if OS(DARWIN)
-    return malloc_good_size(bytes);
-#else
-    return bytes;
-#endif
-}
-
 TryMallocReturnValue tryFastMalloc(size_t n) 
 {
     ASSERT(!isForbidden());
@@ -1036,11 +1027,6 @@
   }
 }
 
-size_t fastMallocGoodSize(size_t bytes)
-{
-    return AllocationSize(bytes);
-}
-
 // Information kept for a span (a contiguous run of pages).
 struct Span {
   PageID        start;          // Starting page number

Modified: trunk/Source/WTF/wtf/FastMalloc.h (141503 => 141504)


--- trunk/Source/WTF/wtf/FastMalloc.h	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/WTF/wtf/FastMalloc.h	2013-02-01 00:37:38 UTC (rev 141504)
@@ -35,7 +35,6 @@
     WTF_EXPORT_PRIVATE void* fastRealloc(void*, size_t);
     WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
     WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
-    WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
 
     struct TryMallocReturnValue {
         TryMallocReturnValue(void* data)

Modified: trunk/Source/WTF/wtf/Vector.h (141503 => 141504)


--- trunk/Source/WTF/wtf/Vector.h	2013-02-01 00:37:22 UTC (rev 141503)
+++ trunk/Source/WTF/wtf/Vector.h	2013-02-01 00:37:38 UTC (rev 141504)
@@ -252,11 +252,10 @@
         void allocateBuffer(size_t newCapacity)
         {
             ASSERT(newCapacity);
+            m_capacity = newCapacity;
             if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
                 CRASH();
-            size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
-            m_capacity = sizeToAllocate / sizeof(T);
-            m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate));
+            m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
         }
 
         bool tryAllocateBuffer(size_t newCapacity)
@@ -265,10 +264,9 @@
             if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
                 return false;
 
-            size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
             T* newBuffer;
-            if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) {
-                m_capacity = sizeToAllocate / sizeof(T);
+            if (tryFastMalloc(newCapacity * sizeof(T)).getValue(newBuffer)) {
+                m_capacity = newCapacity;
                 m_buffer = newBuffer;
                 return true;
             }
@@ -283,11 +281,10 @@
         void reallocateBuffer(size_t newCapacity)
         {
             ASSERT(shouldReallocateBuffer(newCapacity));
+            m_capacity = newCapacity;
             if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
                 CRASH();
-            size_t sizeToAllocate = fastMallocGoodSize(newCapacity * sizeof(T));
-            m_capacity = sizeToAllocate / sizeof(T);
-            m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate));
+            m_buffer = static_cast<T*>(fastRealloc(m_buffer, newCapacity * sizeof(T)));
         }
 
         void deallocateBuffer(T* bufferToDeallocate)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to