Rolling out r141407 because it is causing crashes under
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 00:37:38 +0000 (00:37 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 00:37:38 +0000 (00:37 +0000)
WTF::TCMalloc_Central_FreeList::FetchFromSpans() in Release builds.

Source/JavaScriptCore:

* 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):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Deque.h
Source/WTF/wtf/FastMalloc.cpp
Source/WTF/wtf/FastMalloc.h
Source/WTF/wtf/Vector.h

index faf2622..b14c5f7 100644 (file)
@@ -1,3 +1,11 @@
+2013-01-31  Jessie Berlin  <jberlin@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  <mhahnenberg@apple.com>
 
         Objective-C API: JSContext exception property causes reference cycle
index 6b15847..084594a 100644 (file)
@@ -1820,9 +1820,11 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin
     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();
index 35d2cdc..e3c8581 100644 (file)
@@ -1,3 +1,18 @@
+2013-01-31  Jessie Berlin  <jberlin@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.lam@apple.com>
 
         Abstraction for hiding enum class.
index 93c9799..e5c47b6 100644 (file)
@@ -383,13 +383,14 @@ namespace WTF {
     {
         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;
         }
index c2c9a2d..bebcff2 100644 (file)
@@ -237,15 +237,6 @@ TryMallocReturnValue tryFastZeroedMalloc(size_t n)
 
 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 @@ static size_t AllocationSize(size_t bytes) {
   }
 }
 
-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
index 324f162..1300a8e 100644 (file)
@@ -35,7 +35,6 @@ namespace WTF {
     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)
index 63eb5d5..64b7f5d 100644 (file)
@@ -252,11 +252,10 @@ namespace WTF {
         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 @@ namespace WTF {
             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 @@ namespace WTF {
         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)