Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it...
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 21:38:53 +0000 (21:38 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 21:38:53 +0000 (21:38 +0000)
progression.

Source/bmalloc:

* bmalloc/Algorithm.h:
(bmalloc::fastCopy): Deleted.
(bmalloc::fastZeroFill): Deleted.
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate):
* bmalloc/Bits.h:
(bmalloc::BitsWordOwner::operator=):
(bmalloc::BitsWordOwner::clearAll):
(bmalloc::BitsWordOwner::set):
* bmalloc/IsoPageInlines.h:
(bmalloc::IsoPage<Config>::IsoPage):
* bmalloc/Vector.h:
(bmalloc::Vector<T>::reallocateBuffer):

Source/JavaScriptCore:

* assembler/AssemblerBuffer.h:
(JSC::AssemblerBuffer::append):
* heap/LargeAllocation.cpp:
(JSC::LargeAllocation::tryCreate):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::Handle::didAddToDirectory):
* runtime/ArrayBuffer.cpp:
(JSC::ArrayBufferContents::tryAllocate):
(JSC::ArrayBufferContents::copyTo):
(JSC::ArrayBuffer::createInternal):
* runtime/ArrayBufferView.h:
(JSC::ArrayBufferView::zeroRangeImpl):
* runtime/ArrayConventions.cpp:
(JSC::clearArrayMemset):
* runtime/ArrayConventions.h:
(JSC::clearArray):
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoPrivateFuncConcatMemcpy):
* runtime/ButterflyInlines.h:
(JSC::Butterfly::tryCreate):
(JSC::Butterfly::createOrGrowPropertyStorage):
(JSC::Butterfly::growArrayRight):
(JSC::Butterfly::resizeArray):
* runtime/GenericTypedArrayViewInlines.h:
(JSC::GenericTypedArrayView<Adaptor>::create):
* runtime/JSArray.cpp:
(JSC::JSArray::appendMemcpy):
(JSC::JSArray::fastSlice):
* runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::set):
* runtime/JSObject.cpp:
(JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements):
(JSC::JSObject::shiftButterflyAfterFlattening):
* runtime/PropertyTable.cpp:
(JSC::PropertyTable::PropertyTable):

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/BitVector.cpp:
(WTF::BitVector::setSlow):
(WTF::BitVector::clearAll):
(WTF::BitVector::resizeOutOfLine):
* wtf/BitVector.h:
(WTF::BitVector::OutOfLineBits::numWords const):
(WTF::BitVector::wordCount): Deleted.
* wtf/CMakeLists.txt:
* wtf/ConcurrentBuffer.h:
(WTF::ConcurrentBuffer::growExact):
* wtf/FastBitVector.h:
(WTF::FastBitVectorWordOwner::operator=):
(WTF::FastBitVectorWordOwner::clearAll):
(WTF::FastBitVectorWordOwner::set):
* wtf/FastCopy.h: Removed.
* wtf/FastMalloc.cpp:
(WTF::fastZeroedMalloc):
(WTF::fastStrDup):
(WTF::tryFastZeroedMalloc):
* wtf/FastZeroFill.h: Removed.
* wtf/OSAllocator.h:
(WTF::OSAllocator::reallocateCommitted):
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::increaseSize):
* wtf/Vector.h:
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::decodeFixedLengthData):
* wtf/persistence/PersistentEncoder.cpp:
(WTF::Persistence::Encoder::encodeFixedLengthData):
* wtf/text/CString.cpp:
(WTF::CString::init):
(WTF::CString::copyBufferIfNeeded):
* wtf/text/LineBreakIteratorPoolICU.h:
(WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::allocateBuffer):
(WTF::StringBuilder::append):
* wtf/text/StringConcatenate.h:
* wtf/text/StringImpl.h:
(WTF::StringImpl::copyCharacters):
* wtf/text/icu/UTextProvider.cpp:
(WTF::uTextCloneImpl):
* wtf/text/icu/UTextProviderLatin1.cpp:
(WTF::uTextLatin1Clone):
(WTF::openLatin1UTextProvider):
* wtf/threads/Signals.cpp:

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

45 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/AssemblerBuffer.h
Source/JavaScriptCore/heap/LargeAllocation.cpp
Source/JavaScriptCore/heap/MarkedBlock.cpp
Source/JavaScriptCore/runtime/ArrayBuffer.cpp
Source/JavaScriptCore/runtime/ArrayBufferView.h
Source/JavaScriptCore/runtime/ArrayConventions.cpp
Source/JavaScriptCore/runtime/ArrayConventions.h
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/ButterflyInlines.h
Source/JavaScriptCore/runtime/GenericTypedArrayViewInlines.h
Source/JavaScriptCore/runtime/JSArray.cpp
Source/JavaScriptCore/runtime/JSArrayBufferView.cpp
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/PropertyTable.cpp
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/BitVector.cpp
Source/WTF/wtf/BitVector.h
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/ConcurrentBuffer.h
Source/WTF/wtf/FastBitVector.h
Source/WTF/wtf/FastCopy.h [deleted file]
Source/WTF/wtf/FastMalloc.cpp
Source/WTF/wtf/FastZeroFill.h [deleted file]
Source/WTF/wtf/OSAllocator.h
Source/WTF/wtf/StringPrintStream.cpp
Source/WTF/wtf/Vector.h
Source/WTF/wtf/persistence/PersistentDecoder.cpp
Source/WTF/wtf/persistence/PersistentEncoder.cpp
Source/WTF/wtf/text/CString.cpp
Source/WTF/wtf/text/LineBreakIteratorPoolICU.h
Source/WTF/wtf/text/StringBuilder.cpp
Source/WTF/wtf/text/StringConcatenate.h
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/icu/UTextProvider.cpp
Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp
Source/WTF/wtf/threads/Signals.cpp
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/Algorithm.h
Source/bmalloc/bmalloc/Allocator.cpp
Source/bmalloc/bmalloc/Bits.h
Source/bmalloc/bmalloc/IsoPageInlines.h
Source/bmalloc/bmalloc/Vector.h

index 56e3171..486e30e 100644 (file)
@@ -1,3 +1,46 @@
+2018-02-16  Filip Pizlo  <fpizlo@apple.com>
+
+        Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it was not a
+        progression.
+
+        * assembler/AssemblerBuffer.h:
+        (JSC::AssemblerBuffer::append):
+        * heap/LargeAllocation.cpp:
+        (JSC::LargeAllocation::tryCreate):
+        * heap/MarkedBlock.cpp:
+        (JSC::MarkedBlock::Handle::didAddToDirectory):
+        * runtime/ArrayBuffer.cpp:
+        (JSC::ArrayBufferContents::tryAllocate):
+        (JSC::ArrayBufferContents::copyTo):
+        (JSC::ArrayBuffer::createInternal):
+        * runtime/ArrayBufferView.h:
+        (JSC::ArrayBufferView::zeroRangeImpl):
+        * runtime/ArrayConventions.cpp:
+        (JSC::clearArrayMemset):
+        * runtime/ArrayConventions.h:
+        (JSC::clearArray):
+        * runtime/ArrayPrototype.cpp:
+        (JSC::arrayProtoPrivateFuncConcatMemcpy):
+        * runtime/ButterflyInlines.h:
+        (JSC::Butterfly::tryCreate):
+        (JSC::Butterfly::createOrGrowPropertyStorage):
+        (JSC::Butterfly::growArrayRight):
+        (JSC::Butterfly::resizeArray):
+        * runtime/GenericTypedArrayViewInlines.h:
+        (JSC::GenericTypedArrayView<Adaptor>::create):
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::appendMemcpy):
+        (JSC::JSArray::fastSlice):
+        * runtime/JSArrayBufferView.cpp:
+        (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
+        * runtime/JSGenericTypedArrayViewInlines.h:
+        (JSC::JSGenericTypedArrayView<Adaptor>::set):
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::constructConvertedArrayStorageWithoutCopyingElements):
+        (JSC::JSObject::shiftButterflyAfterFlattening):
+        * runtime/PropertyTable.cpp:
+        (JSC::PropertyTable::PropertyTable):
+
 2018-02-16  Saam Barati  <sbarati@apple.com>
 
         Fix bugs from r228411
index 8325093..3165557 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2012, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -277,7 +277,7 @@ namespace JSC {
             if (!isAvailable(size))
                 grow(size);
 
-            fastCopyBytes(m_storage.buffer() + m_index, data, size);
+            memcpy(m_storage.buffer() + m_index, data, size);
             m_index += size;
         }
 
index 6dd021d..dfbf6ac 100644 (file)
@@ -45,7 +45,7 @@ LargeAllocation* LargeAllocation::tryCreate(Heap& heap, size_t size, Subspace* s
         return nullptr;
     
     // Make sure that the padding does not contain useful things.
-    fastZeroFillBytes(static_cast<char*>(space) + sizeBeforeDistancing, distancing);
+    memset(static_cast<char*>(space) + sizeBeforeDistancing, 0, distancing);
     
     if (scribbleFreeCells())
         scribble(space, size);
index 54c75f6..f6e91d5 100644 (file)
@@ -358,7 +358,7 @@ void MarkedBlock::Handle::didAddToDirectory(BlockDirectory* directory, size_t in
         
         if (m_attributes.securityKind != SecurityKind::JSValueOOB
             || m_securityOriginToken != securityOriginToken)
-            fastZeroFillBytes(&block(), m_endAtom * atomSize);
+            memset(&block(), 0, m_endAtom * atomSize);
     }
     
     m_attributes = directory->attributes();
index b5867e4..4171f2e 100644 (file)
@@ -113,7 +113,7 @@ void ArrayBufferContents::tryAllocate(unsigned numElements, unsigned elementByte
     }
     
     if (policy == ZeroInitialize)
-        fastZeroFillBytes(m_data.get(), size);
+        memset(m_data.get(), 0, size);
 
     m_sizeInBytes = numElements * elementByteSize;
     m_destructor = [] (void* p) { Gigacage::free(Gigacage::Primitive, p); };
@@ -141,7 +141,7 @@ void ArrayBufferContents::copyTo(ArrayBufferContents& other)
     other.tryAllocate(m_sizeInBytes, sizeof(char), ArrayBufferContents::DontInitialize);
     if (!other.m_data)
         return;
-    fastCopyBytes(other.m_data.get(), m_data.get(), m_sizeInBytes);
+    memcpy(other.m_data.get(), m_data.get(), m_sizeInBytes);
     other.m_sizeInBytes = m_sizeInBytes;
 }
 
@@ -246,7 +246,7 @@ Ref<ArrayBuffer> ArrayBuffer::createInternal(ArrayBufferContents&& contents, con
 {
     ASSERT(!byteLength || source);
     auto buffer = adoptRef(*new ArrayBuffer(WTFMove(contents)));
-    fastCopyBytes(buffer->data(), source, byteLength);
+    memcpy(buffer->data(), source, byteLength);
     return buffer;
 }
 
index f4be7ba..703bc62 100644 (file)
@@ -215,7 +215,7 @@ bool ArrayBufferView::zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength)
     }
     
     uint8_t* base = static_cast<uint8_t*>(baseAddress());
-    fastZeroFillBytes(base + byteOffset, rangeByteLength);
+    memset(base + byteOffset, 0, rangeByteLength);
     return true;
 }
 
index 93a08ab..69a4789 100644 (file)
 namespace JSC {
 
 #if USE(JSVALUE64)
+void clearArrayMemset(WriteBarrier<Unknown>* base, unsigned count)
+{
+#if CPU(X86_64) && COMPILER(GCC_OR_CLANG)
+    uint64_t zero = 0;
+    asm volatile (
+        "rep stosq\n\t"
+        : "+D"(base), "+c"(count)
+        : "a"(zero)
+        : "memory"
+        );
+#else // not CPU(X86_64)
+    memset(base, 0, count * sizeof(WriteBarrier<Unknown>));
+#endif // generic CPU
+}
+
 void clearArrayMemset(double* base, unsigned count)
 {
 #if CPU(X86_64) && COMPILER(GCC_OR_CLANG)
index 101847d..aab19d0 100644 (file)
@@ -117,17 +117,22 @@ inline IndexingHeader baseIndexingHeaderForArrayStorage(unsigned length)
 }
 
 #if USE(JSVALUE64)
+JS_EXPORT_PRIVATE void clearArrayMemset(WriteBarrier<Unknown>* base, unsigned count);
 JS_EXPORT_PRIVATE void clearArrayMemset(double* base, unsigned count);
 #endif // USE(JSVALUE64)
 
 ALWAYS_INLINE void clearArray(WriteBarrier<Unknown>* base, unsigned count)
 {
 #if USE(JSVALUE64)
-    fastZeroFill(base, count);
-#else
+    const unsigned minCountForMemset = 100;
+    if (count >= minCountForMemset) {
+        clearArrayMemset(base, count);
+        return;
+    }
+#endif
+    
     for (unsigned i = count; i--;)
         base[i].clear();
-#endif
 }
 
 ALWAYS_INLINE void clearArray(double* base, unsigned count)
index a17b7c6..efbaf32 100644 (file)
@@ -1341,18 +1341,19 @@ EncodedJSValue JSC_HOST_CALL arrayProtoPrivateFuncConcatMemcpy(ExecState* exec)
     
     if (type == ArrayWithDouble) {
         double* buffer = result->butterfly()->contiguousDouble().data();
-        fastCopy(buffer, firstButterfly->contiguousDouble().data(), firstArraySize);
-        fastCopy(buffer + firstArraySize, secondButterfly->contiguousDouble().data(), secondArraySize);
+        memcpy(buffer, firstButterfly->contiguousDouble().data(), sizeof(JSValue) * firstArraySize);
+        memcpy(buffer + firstArraySize, secondButterfly->contiguousDouble().data(), sizeof(JSValue) * secondArraySize);
     } else if (type != ArrayWithUndecided) {
         WriteBarrier<Unknown>* buffer = result->butterfly()->contiguous().data();
         
         auto copy = [&] (unsigned offset, void* source, unsigned size, IndexingType type) {
             if (type != ArrayWithUndecided) {
-                fastCopy(buffer + offset, static_cast<WriteBarrier<Unknown>*>(source), size);
+                memcpy(buffer + offset, source, sizeof(JSValue) * size);
                 return;
             }
             
-            clearArray(buffer + offset, size);
+            for (unsigned i = size; i--;)
+                buffer[i + offset].clear();
         };
         
         copy(0, firstButterfly->contiguous().data(), firstArraySize, firstType);
index 403ac9c..6265f58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -93,7 +93,7 @@ inline Butterfly* Butterfly::tryCreate(VM& vm, JSCell*, size_t preCapacity, size
     Butterfly* result = fromBase(base, preCapacity, propertyCapacity);
     if (hasIndexingHeader)
         *result->indexingHeader() = indexingHeader;
-    fastZeroFill(result->propertyStorage() - propertyCapacity, propertyCapacity);
+    memset(result->propertyStorage() - propertyCapacity, 0, propertyCapacity * sizeof(EncodedJSValue));
     return result;
 }
 
@@ -129,13 +129,14 @@ inline Butterfly* Butterfly::createOrGrowPropertyStorage(
     bool hasIndexingHeader = structure->hasIndexingHeader(intendedOwner);
     Butterfly* result = createUninitialized(
         vm, intendedOwner, preCapacity, newPropertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
-    fastCopyBytes(
+    memcpy(
         result->propertyStorage() - oldPropertyCapacity,
         oldButterfly->propertyStorage() - oldPropertyCapacity,
         totalSize(0, oldPropertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes));
-    fastZeroFill(
+    memset(
         result->propertyStorage() - newPropertyCapacity,
-        newPropertyCapacity - oldPropertyCapacity);
+        0,
+        (newPropertyCapacity - oldPropertyCapacity) * sizeof(EncodedJSValue));
     return result;
 }
 
@@ -167,7 +168,8 @@ inline Butterfly* Butterfly::growArrayRight(
     void* newBase = vm.jsValueGigacageAuxiliarySpace.allocateNonVirtual(vm, newSize, nullptr, AllocationFailureMode::ReturnNull);
     if (!newBase)
         return nullptr;
-    fastCopyBytes(newBase, theBase, oldSize);
+    // FIXME: This probably shouldn't be a memcpy.
+    memcpy(newBase, theBase, oldSize);
     return fromBase(newBase, 0, propertyCapacity);
 }
 
@@ -197,7 +199,7 @@ inline Butterfly* Butterfly::resizeArray(
     size_t size = std::min(
         totalSize(0, propertyCapacity, oldHasIndexingHeader, oldIndexingPayloadSizeInBytes),
         totalSize(0, propertyCapacity, newHasIndexingHeader, newIndexingPayloadSizeInBytes));
-    fastCopyBytes(to, from, size);
+    memcpy(to, from, size);
     return result;
 }
 
index 254f628..1b6da56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -52,7 +52,7 @@ RefPtr<GenericTypedArrayView<Adaptor>> GenericTypedArrayView<Adaptor>::create(
     const typename Adaptor::Type* array, unsigned length)
 {
     RefPtr<GenericTypedArrayView> result = create(length);
-    fastCopy(result->data(), array, length);
+    memcpy(result->data(), array, length * sizeof(typename Adaptor::Type));
     return result;
 }
 
index 1cf0b86..fd6770d 100644 (file)
@@ -553,9 +553,9 @@ bool JSArray::appendMemcpy(ExecState* exec, VM& vm, unsigned startIndex, JSC::JS
                 butterfly->contiguousInt32().at(this, i).setWithoutWriteBarrier(JSValue());
         }
     } else if (type == ArrayWithDouble)
-        fastCopy(butterfly()->contiguousDouble().data() + startIndex, otherArray->butterfly()->contiguousDouble().data(), otherLength);
+        memcpy(butterfly()->contiguousDouble().data() + startIndex, otherArray->butterfly()->contiguousDouble().data(), sizeof(JSValue) * otherLength);
     else
-        fastCopy(butterfly()->contiguous().data() + startIndex, otherArray->butterfly()->contiguous().data(), otherLength);
+        memcpy(butterfly()->contiguous().data() + startIndex, otherArray->butterfly()->contiguous().data(), sizeof(JSValue) * otherLength);
 
     return true;
 }
@@ -761,9 +761,9 @@ JSArray* JSArray::fastSlice(ExecState& exec, unsigned startIndex, unsigned count
 
         auto& resultButterfly = *resultArray->butterfly();
         if (arrayType == ArrayWithDouble)
-            fastCopy(resultButterfly.contiguousDouble().data(), butterfly()->contiguousDouble().data() + startIndex, count);
+            memcpy(resultButterfly.contiguousDouble().data(), butterfly()->contiguousDouble().data() + startIndex, sizeof(JSValue) * count);
         else
-            fastCopy(resultButterfly.contiguous().data(), butterfly()->contiguous().data() + startIndex, count);
+            memcpy(resultButterfly.contiguous().data(), butterfly()->contiguous().data() + startIndex, sizeof(JSValue) * count);
         resultButterfly.setPublicLength(count);
 
         return resultArray;
index ec2f633..806a347 100644 (file)
@@ -94,7 +94,7 @@ JSArrayBufferView::ConstructionContext::ConstructionContext(
     if (!m_vector)
         return;
     if (mode == ZeroFill)
-        fastZeroFillBytes(m_vector.get(), size);
+        memset(m_vector.get(), 0, size);
     
     vm.heap.reportExtraMemoryAllocated(static_cast<size_t>(length) * elementSize);
     
index 4a872a9..7857583 100644 (file)
@@ -246,7 +246,7 @@ bool JSGenericTypedArrayView<Adaptor>::set(
 
     const ClassInfo* ci = object->classInfo(vm);
     if (ci->typedArrayStorageType == Adaptor::typeValue) {
-        // The super fast case: we can just memmove since we're the same type.
+        // The super fast case: we can just memcpy since we're the same type.
         JSGenericTypedArrayView* other = jsCast<JSGenericTypedArrayView*>(object);
         length = std::min(length, other->length());
         
index f202f7b..ef0e22f 100644 (file)
@@ -1178,10 +1178,10 @@ ArrayStorage* JSObject::constructConvertedArrayStorageWithoutCopyingElements(VM&
     Butterfly* newButterfly = Butterfly::createUninitialized(
         vm, this, 0, propertyCapacity, true, ArrayStorage::sizeFor(neededLength));
     
-    fastCopy(
+    memcpy(
         newButterfly->propertyStorage() - propertySize,
         m_butterfly->propertyStorage() - propertySize,
-        propertySize);
+        propertySize * sizeof(EncodedJSValue));
     
     ArrayStorage* newStorage = newButterfly->arrayStorage();
     newStorage->setVectorLength(neededLength);
@@ -3572,7 +3572,7 @@ void JSObject::shiftButterflyAfterFlattening(const GCSafeConcurrentJSLocker&, VM
     void* currentBase = oldButterfly->base(0, outOfLineCapacityAfter);
     void* newBase = newButterfly->base(0, outOfLineCapacityAfter);
 
-    fastCopyBytes(newBase, currentBase, Butterfly::totalSize(0, outOfLineCapacityAfter, hasIndexingHeader, indexingPayloadSizeInBytes));
+    memcpy(newBase, currentBase, Butterfly::totalSize(0, outOfLineCapacityAfter, hasIndexingHeader, indexingPayloadSizeInBytes));
     
     setButterfly(vm, newButterfly);
 }
index 28ac1b2..59ec41c 100644 (file)
@@ -74,7 +74,7 @@ PropertyTable::PropertyTable(VM& vm, const PropertyTable& other)
 {
     ASSERT(isPowerOf2(m_indexSize));
 
-    fastCopyBytes(m_index, other.m_index, dataSize());
+    memcpy(m_index, other.m_index, dataSize());
 
     iterator end = this->end();
     for (iterator iter = begin(); iter != end; ++iter)
index 25a5019..c7d3500 100644 (file)
@@ -1,3 +1,56 @@
+2018-02-16  Filip Pizlo  <fpizlo@apple.com>
+
+        Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it was not a
+        progression.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/BitVector.cpp:
+        (WTF::BitVector::setSlow):
+        (WTF::BitVector::clearAll):
+        (WTF::BitVector::resizeOutOfLine):
+        * wtf/BitVector.h:
+        (WTF::BitVector::OutOfLineBits::numWords const):
+        (WTF::BitVector::wordCount): Deleted.
+        * wtf/CMakeLists.txt:
+        * wtf/ConcurrentBuffer.h:
+        (WTF::ConcurrentBuffer::growExact):
+        * wtf/FastBitVector.h:
+        (WTF::FastBitVectorWordOwner::operator=):
+        (WTF::FastBitVectorWordOwner::clearAll):
+        (WTF::FastBitVectorWordOwner::set):
+        * wtf/FastCopy.h: Removed.
+        * wtf/FastMalloc.cpp:
+        (WTF::fastZeroedMalloc):
+        (WTF::fastStrDup):
+        (WTF::tryFastZeroedMalloc):
+        * wtf/FastZeroFill.h: Removed.
+        * wtf/OSAllocator.h:
+        (WTF::OSAllocator::reallocateCommitted):
+        * wtf/StringPrintStream.cpp:
+        (WTF::StringPrintStream::increaseSize):
+        * wtf/Vector.h:
+        * wtf/persistence/PersistentDecoder.cpp:
+        (WTF::Persistence::Decoder::decodeFixedLengthData):
+        * wtf/persistence/PersistentEncoder.cpp:
+        (WTF::Persistence::Encoder::encodeFixedLengthData):
+        * wtf/text/CString.cpp:
+        (WTF::CString::init):
+        (WTF::CString::copyBufferIfNeeded):
+        * wtf/text/LineBreakIteratorPoolICU.h:
+        (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
+        * wtf/text/StringBuilder.cpp:
+        (WTF::StringBuilder::allocateBuffer):
+        (WTF::StringBuilder::append):
+        * wtf/text/StringConcatenate.h:
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::copyCharacters):
+        * wtf/text/icu/UTextProvider.cpp:
+        (WTF::uTextCloneImpl):
+        * wtf/text/icu/UTextProviderLatin1.cpp:
+        (WTF::uTextLatin1Clone):
+        (WTF::openLatin1UTextProvider):
+        * wtf/threads/Signals.cpp:
+
 2018-02-16  Keith Miller  <keith_miller@apple.com>
 
         Remove unused line from Platform.h
index a3d7a7e..60a25bf 100644 (file)
                0F5F3D681F3FEBA600B115A2 /* CagedUniquePtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CagedUniquePtr.h; sourceTree = "<group>"; };
                0F60F32D1DFCBD1B00416D6C /* LockedPrintStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LockedPrintStream.cpp; sourceTree = "<group>"; };
                0F60F32E1DFCBD1B00416D6C /* LockedPrintStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LockedPrintStream.h; sourceTree = "<group>"; };
-               0F62A8A6202CCC14007B8623 /* FastCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastCopy.h; sourceTree = "<group>"; };
-               0F62A8A7202CCC15007B8623 /* FastZeroFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastZeroFill.h; sourceTree = "<group>"; };
                0F66B2801DC97BAB004A1D3F /* ClockType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClockType.cpp; sourceTree = "<group>"; };
                0F66B2811DC97BAB004A1D3F /* ClockType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClockType.h; sourceTree = "<group>"; };
                0F66B2821DC97BAB004A1D3F /* MonotonicTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MonotonicTime.cpp; sourceTree = "<group>"; };
                                A8A4729F151A825A004123FF /* ExportMacros.h */,
                                0F7C5FB51D885CF20044F5E2 /* FastBitVector.cpp */,
                                0FD81AC4154FB22E00983E72 /* FastBitVector.h */,
-                               0F62A8A6202CCC14007B8623 /* FastCopy.h */,
                                A8A472A1151A825A004123FF /* FastMalloc.cpp */,
                                A8A472A2151A825A004123FF /* FastMalloc.h */,
                                0F79C7C31E73511800EB34D1 /* FastTLS.h */,
-                               0F62A8A7202CCC15007B8623 /* FastZeroFill.h */,
                                B38FD7BC168953E80065C969 /* FeatureDefines.h */,
                                0F9D335B165DBA73005AD387 /* FilePrintStream.cpp */,
                                0F9D335C165DBA73005AD387 /* FilePrintStream.h */,
index ea9b743..25f29b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
+ * 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
@@ -29,9 +29,7 @@
 #include <algorithm>
 #include <string.h>
 #include <wtf/Assertions.h>
-#include <wtf/FastCopy.h>
 #include <wtf/FastMalloc.h>
-#include <wtf/FastZeroFill.h>
 #include <wtf/StdLibExtras.h>
 
 namespace WTF {
@@ -43,7 +41,7 @@ void BitVector::setSlow(const BitVector& other)
         newBitsOrPointer = other.m_bitsOrPointer;
     else {
         OutOfLineBits* newOutOfLineBits = OutOfLineBits::create(other.size());
-        fastCopy(newOutOfLineBits->bits(), other.bits(), wordCount(other.size()));
+        memcpy(newOutOfLineBits->bits(), other.bits(), byteCount(other.size()));
         newBitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1;
     }
     if (!isInline() && !isEmptyOrDeletedValue())
@@ -71,7 +69,7 @@ void BitVector::clearAll()
     if (isInline())
         m_bitsOrPointer = makeInlineBits(0);
     else
-        fastZeroFill(outOfLineBits()->bits(), wordCount(size()));
+        memset(outOfLineBits()->bits(), 0, byteCount(size()));
 }
 
 BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits)
@@ -95,14 +93,14 @@ void BitVector::resizeOutOfLine(size_t numBits)
     if (isInline()) {
         // Make sure that all of the bits are zero in case we do a no-op resize.
         *newOutOfLineBits->bits() = m_bitsOrPointer & ~(static_cast<uintptr_t>(1) << maxInlineBits());
-        fastZeroFill(newOutOfLineBits->bits() + 1, newNumWords - 1);
+        memset(newOutOfLineBits->bits() + 1, 0, (newNumWords - 1) * sizeof(void*));
     } else {
         if (numBits > size()) {
             size_t oldNumWords = outOfLineBits()->numWords();
-            fastCopy(newOutOfLineBits->bits(), outOfLineBits()->bits(), oldNumWords);
-            fastZeroFill(newOutOfLineBits->bits() + oldNumWords, newNumWords - oldNumWords);
+            memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), oldNumWords * sizeof(void*));
+            memset(newOutOfLineBits->bits() + oldNumWords, 0, (newNumWords - oldNumWords) * sizeof(void*));
         } else
-            fastCopy(newOutOfLineBits->bits(), outOfLineBits()->bits(), newOutOfLineBits->numWords());
+            memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), newOutOfLineBits->numWords() * sizeof(void*));
         OutOfLineBits::destroy(outOfLineBits());
     }
     m_bitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1;
index b3bba7c..8c8bdd7 100644 (file)
@@ -354,11 +354,6 @@ private:
         return (bitCount + 7) >> 3;
     }
 
-    static size_t wordCount(uintptr_t bits)
-    {
-        return (bits + bitsInPointer() - 1) / bitsInPointer();
-    }
-    
     static uintptr_t makeInlineBits(uintptr_t bits)
     {
         ASSERT(!(bits & (static_cast<uintptr_t>(1) << maxInlineBits())));
@@ -423,7 +418,7 @@ private:
     class OutOfLineBits {
     public:
         size_t numBits() const { return m_numBits; }
-        size_t numWords() const { return wordCount(m_numBits); }
+        size_t numWords() const { return (m_numBits + bitsInPointer() - 1) / bitsInPointer(); }
         uintptr_t* bits() { return bitwise_cast<uintptr_t*>(this + 1); }
         const uintptr_t* bits() const { return bitwise_cast<const uintptr_t*>(this + 1); }
         
index 877d814..220bafd 100644 (file)
@@ -59,10 +59,8 @@ set(WTF_HEADERS
     Expected.h
     ExportMacros.h
     FastBitVector.h
-    FastCopy.h
     FastMalloc.h
     FastTLS.h
-    FastZeroFill.h
     FeatureDefines.h
     FilePrintStream.h
     FlipBytes.h
index c6db4c9..6da7e28 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include <wtf/Atomics.h>
-#include <wtf/FastCopy.h>
 #include <wtf/FastMalloc.h>
 #include <wtf/HashFunctions.h>
 #include <wtf/Lock.h>
@@ -66,7 +65,7 @@ public:
         Array* newArray = createArray(newSize);
         // This allows us to do ConcurrentBuffer<std::unique_ptr<>>.
         if (array)
-            fastCopy(newArray->data, array->data, array->size);
+            memcpy(newArray->data, array->data, sizeof(T) * array->size);
         for (size_t i = array ? array->size : 0; i < newSize; ++i)
             new (newArray->data + i) T();
         WTF::storeStoreFence();
index 52d4c78..9119a1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,9 +27,7 @@
 
 #include <string.h>
 #include <wtf/Atomics.h>
-#include <wtf/FastCopy.h>
 #include <wtf/FastMalloc.h>
-#include <wtf/FastZeroFill.h>
 #include <wtf/PrintStream.h>
 #include <wtf/StdLibExtras.h>
 
@@ -97,7 +95,7 @@ public:
         if (arrayLength() != other.arrayLength())
             setEqualsSlow(other);
         else {
-            fastCopy(m_words, other.m_words, arrayLength());
+            memcpy(m_words, other.m_words, arrayLength() * sizeof(uint32_t));
             m_numBits = other.m_numBits;
         }
         return *this;
@@ -117,13 +115,13 @@ public:
     
     void clearAll()
     {
-        fastZeroFill(m_words, arrayLength());
+        memset(m_words, 0, arrayLength() * sizeof(uint32_t));
     }
     
     void set(const FastBitVectorWordOwner& other)
     {
         ASSERT_WITH_SECURITY_IMPLICATION(m_numBits == other.m_numBits);
-        fastCopy(m_words, other.m_words, arrayLength());
+        memcpy(m_words, other.m_words, arrayLength() * sizeof(uint32_t));
     }
     
     size_t numBits() const
diff --git a/Source/WTF/wtf/FastCopy.h b/Source/WTF/wtf/FastCopy.h
deleted file mode 100644 (file)
index a48c251..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2018 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. ``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
- * 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. 
- */
-
-#pragma once
-
-#include <wtf/StdLibExtras.h>
-
-namespace WTF {
-
-template<typename T>
-void fastCopy(T* dst, const T* src, size_t length)
-{
-#if CPU(X86_64) && COMPILER(GCC_OR_CLANG)
-    uint64_t tmp = 0;
-    size_t count = length * sizeof(T);
-    if (!(sizeof(T) % sizeof(uint64_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $3, %%rcx\n\t"
-            "rep movsq\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint32_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $2, %%rcx\n\t"
-            "rep movsl\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $4, %%rcx\n\t" // FIXME: This isn't really a loop. https://bugs.webkit.org/show_bug.cgi?id=182617
-            "4:\n\t"
-            "movl (%%rsi, %%rcx), %%eax\n\t"
-            "movl %%eax, (%%rdi, %%rcx)\n\t"
-            "subq $4, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint16_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $1, %%rcx\n\t"
-            "rep movsw\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $6, %%rcx\n\t"
-            "4:\n\t"
-            "movw (%%rsi, %%rcx), %%ax\n\t"
-            "movw %%ax, (%%rdi, %%rcx)\n\t"
-            "subq $2, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    asm volatile (
-        "cmpq $200, %%rcx\n\t"
-        "jb 1f\n\t"
-        "rep movsb\n\t"
-        "jmp 2f\n\t"
-        "3:\n\t"
-        "movq (%%rsi, %%rcx), %%rax\n\t"
-        "movq %%rax, (%%rdi, %%rcx)\n\t"
-        "1:\n\t"
-        "subq $8, %%rcx\n\t"
-        "jae 3b\n\t"
-        "cmpq $-8, %%rcx\n\t"
-        "je 2f\n\t"
-        "addq $7, %%rcx\n\t"
-        "4:\n\t"
-        "movb (%%rsi, %%rcx), %%al\n\t"
-        "movb %%al, (%%rdi, %%rcx)\n\t"
-        "subq $1, %%rcx\n\t"
-        "jae 4b\n\t"
-        "2:\n\t"
-        : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-        :
-        : "memory"
-        );
-#else
-    memcpy(dst, src, length * sizeof(T));
-#endif
-}
-
-inline void fastCopyBytes(void* dst, const void* src, size_t bytes)
-{
-    fastCopy(static_cast<char*>(dst), static_cast<const char*>(src), bytes);
-}
-
-} // namespace WTF
-
-using WTF::fastCopy;
-using WTF::fastCopyBytes;
index f1b06ea..9a0f08b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2005, 2007, Google Inc. All rights reserved.
- * Copyright (C) 2005-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 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:
@@ -31,8 +31,6 @@
 #include <limits>
 #include <string.h>
 #include <wtf/DataLog.h>
-#include <wtf/FastCopy.h>
-#include <wtf/FastZeroFill.h>
 
 #if OS(WINDOWS)
 #include <windows.h>
@@ -80,7 +78,7 @@ void fastSetMaxSingleAllocationSize(size_t size)
 void* fastZeroedMalloc(size_t n) 
 {
     void* result = fastMalloc(n);
-    fastZeroFillBytes(result, n);
+    memset(result, 0, n);
     return result;
 }
 
@@ -88,7 +86,7 @@ char* fastStrDup(const char* src)
 {
     size_t len = strlen(src) + 1;
     char* dup = static_cast<char*>(fastMalloc(len));
-    fastCopy(dup, src, len);
+    memcpy(dup, src, len);
     return dup;
 }
 
@@ -97,7 +95,7 @@ TryMallocReturnValue tryFastZeroedMalloc(size_t n)
     void* result;
     if (!tryFastMalloc(n).getValue(result))
         return 0;
-    fastZeroFillBytes(result, n);
+    memset(result, 0, n);
     return result;
 }
 
diff --git a/Source/WTF/wtf/FastZeroFill.h b/Source/WTF/wtf/FastZeroFill.h
deleted file mode 100644 (file)
index 56dad17..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2018 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. ``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
- * 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. 
- */
-
-#pragma once
-
-#include <wtf/StdLibExtras.h>
-
-namespace WTF {
-
-template<typename T>
-void fastZeroFill(T* dst, size_t length)
-{
-#if CPU(X86_64) && COMPILER(GCC_OR_CLANG)
-    uint64_t zero = 0;
-    size_t count = length * sizeof(T);
-    if (!(sizeof(T) % sizeof(uint64_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $3, %%rcx\n\t"
-            "rep stosq\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint32_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $2, %%rcx\n\t"
-            "rep stosl\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $4, %%rcx\n\t" // FIXME: This isn't really a loop. https://bugs.webkit.org/show_bug.cgi?id=182617
-            "4:\n\t"
-            "movl %%eax, (%%rdi, %%rcx)\n\t"
-            "subq $4, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint16_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $1, %%rcx\n\t"
-            "rep stosw\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $6, %%rcx\n\t"
-            "4:\n\t"
-            "movw %%ax, (%%rdi, %%rcx)\n\t"
-            "subq $2, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    asm volatile (
-        "cmpq $200, %%rcx\n\t"
-        "jb 1f\n\t"
-        "rep stosb\n\t"
-        "jmp 2f\n\t"
-        "3:\n\t"
-        "movq %%rax, (%%rdi, %%rcx)\n\t"
-        "1:\n\t"
-        "subq $8, %%rcx\n\t"
-        "jae 3b\n\t"
-        "cmpq $-8, %%rcx\n\t"
-        "je 2f\n\t"
-        "addq $7, %%rcx\n\t"
-        "4:\n\t"
-        "movb %%al, (%%rdi, %%rcx)\n\t"
-        "sub $1, %%rcx\n\t"
-        "jae 4b\n\t"
-        "2:\n\t"
-        : "+D"(dst), "+c"(count)
-        : "a"(zero)
-        : "memory"
-        );
-#else
-    memset(dst, 0, length * sizeof(T));
-#endif
-}
-
-inline void fastZeroFillBytes(void* dst, size_t bytes)
-{
-    fastZeroFill(static_cast<char*>(dst), bytes);
-}
-
-} // namespace WTF
-
-using WTF::fastZeroFill;
-using WTF::fastZeroFillBytes;
index ac97279..1acb265 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,7 +27,6 @@
 #define OSAllocator_h
 
 #include <algorithm>
-#include <wtf/FastCopy.h>
 #include <wtf/VMTags.h>
 
 namespace WTF {
@@ -91,7 +90,7 @@ template<typename T>
 inline T* OSAllocator::reallocateCommitted(T* oldBase, size_t oldSize, size_t newSize, Usage usage, bool writable, bool executable)
 {
     void* newBase = reserveAndCommit(newSize, usage, writable, executable);
-    fastCopyBytes(newBase, oldBase, std::min(oldSize, newSize));
+    memcpy(newBase, oldBase, std::min(oldSize, newSize));
     decommitAndRelease(oldBase, oldSize);
     return static_cast<T*>(newBase);
 }
index cf6485d..33fd5ab 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <stdarg.h>
 #include <stdio.h>
-#include <wtf/FastCopy.h>
 #include <wtf/FastMalloc.h>
 
 namespace WTF {
@@ -120,7 +119,7 @@ void StringPrintStream::increaseSize(size_t newSize)
     // fastRealloc will just do malloc+free anyway. Also, this simplifies the code since
     // we can't realloc the inline buffer.
     char* newBuffer = static_cast<char*>(fastMalloc(m_size));
-    fastCopy(newBuffer, m_buffer, m_next + 1);
+    memcpy(newBuffer, m_buffer, m_next + 1);
     if (m_buffer != m_inlineBuffer)
         fastFree(m_buffer);
     m_buffer = newBuffer;
index f458cc8..abcabd0 100644 (file)
@@ -27,9 +27,7 @@
 #include <type_traits>
 #include <utility>
 #include <wtf/CheckedArithmetic.h>
-#include <wtf/FastCopy.h>
 #include <wtf/FastMalloc.h>
-#include <wtf/FastZeroFill.h>
 #include <wtf/Forward.h>
 #include <wtf/MallocPtr.h>
 #include <wtf/MathExtras.h>
@@ -88,7 +86,7 @@ struct VectorInitializer<true, true, T>
 {
     static void initialize(T* begin, T* end) 
     {
-        fastZeroFill(begin, end - begin);
+        memset(begin, 0, reinterpret_cast<char*>(end) - reinterpret_cast<char*>(begin));
     }
 };
 
@@ -128,7 +126,7 @@ struct VectorMover<true, T>
 {
     static void move(const T* src, const T* srcEnd, T* dst) 
     {
-        fastCopy(dst, src, srcEnd - src);
+        memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
     }
     static void moveOverlapping(const T* src, const T* srcEnd, T* dst) 
     {
index ac05633..92dd50e 100644 (file)
@@ -52,7 +52,7 @@ bool Decoder::decodeFixedLengthData(uint8_t* data, size_t size)
     if (!bufferIsLargeEnoughToContain(size))
         return false;
 
-    fastCopy(data, m_bufferPosition, size);
+    memcpy(data, m_bufferPosition, size);
     m_bufferPosition += size;
 
     Encoder::updateChecksumForData(m_sha1, data, size);
index 4af4291..6636eb6 100644 (file)
@@ -58,7 +58,7 @@ void Encoder::encodeFixedLengthData(const uint8_t* data, size_t size)
     updateChecksumForData(m_sha1, data, size);
 
     uint8_t* buffer = grow(size);
-    fastCopy(buffer, data, size);
+    memcpy(buffer, data, size);
 }
 
 template<typename Type>
index ab6901e..181b110 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,7 +28,6 @@
 #include "CString.h"
 
 #include <string.h>
-#include <wtf/FastCopy.h>
 #include <wtf/text/StringHasher.h>
 #include <wtf/text/StringMalloc.h>
 
@@ -67,7 +66,7 @@ void CString::init(const char* str, size_t length)
     ASSERT(str);
 
     m_buffer = CStringBuffer::createUninitialized(length);
-    fastCopy(m_buffer->mutableData(), str, length); 
+    memcpy(m_buffer->mutableData(), str, length); 
     m_buffer->mutableData()[length] = '\0';
 }
 
@@ -97,7 +96,7 @@ void CString::copyBufferIfNeeded()
     RefPtr<CStringBuffer> buffer = WTFMove(m_buffer);
     size_t length = buffer->length();
     m_buffer = CStringBuffer::createUninitialized(length);
-    fastCopy(m_buffer->mutableData(), buffer->data(), length + 1);
+    memcpy(m_buffer->mutableData(), buffer->data(), length + 1);
 }
 
 bool CString::isSafeToSendToAnotherThread() const
index 17f1dd2..8e89c31 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2018 Apple Inc. All Rights Reserved.
+ * 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
@@ -26,8 +26,6 @@
 #pragma once
 
 #include <unicode/uloc.h>
-#include <wtf/FastCopy.h>
-#include <wtf/FastZeroFill.h>
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/ThreadSpecific.h>
@@ -53,7 +51,7 @@ public:
         if (!utf8Locale.length())
             return locale;
         Vector<char> scratchBuffer(utf8Locale.length() + 11, 0);
-        fastCopy(scratchBuffer.data(), utf8Locale.data(), utf8Locale.length());
+        memcpy(scratchBuffer.data(), utf8Locale.data(), utf8Locale.length());
 
         const char* keywordValue = nullptr;
         switch (mode) {
@@ -77,7 +75,7 @@ public:
             return AtomicString::fromUTF8(scratchBuffer.data(), lengthNeeded);
         if (status == U_BUFFER_OVERFLOW_ERROR) {
             scratchBuffer.grow(lengthNeeded + 1);
-            fastZeroFill(scratchBuffer.data() + utf8Locale.length(), scratchBuffer.size() - utf8Locale.length());
+            memset(scratchBuffer.data() + utf8Locale.length(), 0, scratchBuffer.size() - utf8Locale.length());
             status = U_ZERO_ERROR;
             int32_t lengthNeeded2 = uloc_setKeywordValue("lb", keywordValue, scratchBuffer.data(), scratchBuffer.size(), &status);
             if (!U_SUCCESS(status) || lengthNeeded != lengthNeeded2)
index 4aa9007..85b0c21 100644 (file)
@@ -99,7 +99,7 @@ void StringBuilder::allocateBuffer(const LChar* currentCharacters, unsigned requ
     ASSERT(m_is8Bit);
     // Copy the existing data into a new buffer, set result to point to the end of the existing data.
     auto buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters8);
-    fastCopy(m_bufferCharacters8, currentCharacters, m_length);
+    memcpy(m_bufferCharacters8, currentCharacters, static_cast<size_t>(m_length) * sizeof(LChar)); // This can't overflow.
     
     // Update the builder state.
     m_buffer = WTFMove(buffer);
@@ -114,7 +114,7 @@ void StringBuilder::allocateBuffer(const UChar* currentCharacters, unsigned requ
     ASSERT(!m_is8Bit);
     // Copy the existing data into a new buffer, set result to point to the end of the existing data.
     auto buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters16);
-    fastCopy(m_bufferCharacters16, currentCharacters, m_length);
+    memcpy(m_bufferCharacters16, currentCharacters, static_cast<size_t>(m_length) * sizeof(UChar)); // This can't overflow.
     
     // Update the builder state.
     m_buffer = WTFMove(buffer);
@@ -276,10 +276,10 @@ void StringBuilder::append(const UChar* characters, unsigned length)
             allocateBufferUpConvert(m_string.isNull() ? 0 : m_string.characters8(), expandedCapacity(capacity(), requiredLength));
         }
 
-        fastCopy(m_bufferCharacters16 + m_length, characters, length);
+        memcpy(m_bufferCharacters16 + m_length, characters, static_cast<size_t>(length) * sizeof(UChar));
         m_length = requiredLength;
     } else
-        fastCopy(appendUninitialized<UChar>(length), characters, length);
+        memcpy(appendUninitialized<UChar>(length), characters, static_cast<size_t>(length) * sizeof(UChar));
     ASSERT(m_buffer->length() >= m_length);
 }
 
@@ -291,7 +291,13 @@ void StringBuilder::append(const LChar* characters, unsigned length)
 
     if (m_is8Bit) {
         LChar* dest = appendUninitialized<LChar>(length);
-        fastCopy(dest, characters, length);
+        if (length > 8)
+            memcpy(dest, characters, static_cast<size_t>(length) * sizeof(LChar));
+        else {
+            const LChar* end = characters + length;
+            while (characters < end)
+                *(dest++) = *(characters++);
+        }
     } else {
         UChar* dest = appendUninitialized<UChar>(length);
         const LChar* end = characters + length;
index 472c08c..18ff3f8 100644 (file)
@@ -27,7 +27,6 @@
 #define StringConcatenate_h
 
 #include <string.h>
-#include <wtf/FastCopy.h>
 
 #ifndef AtomicString_h
 #include <wtf/text/AtomicString.h>
@@ -158,7 +157,7 @@ public:
 
     void writeTo(UChar* destination) const
     {
-        fastCopy(destination, m_characters, m_length);
+        memcpy(destination, m_characters, m_length * sizeof(UChar));
     }
 
     String toString() const { return String(m_characters, m_length); }
index c3d2a5a..7029f19 100644 (file)
@@ -1066,7 +1066,7 @@ template<typename CharacterType> inline void StringImpl::copyCharacters(Characte
         *destination = *source;
         return;
     }
-    fastCopy(destination, source, numCharacters);
+    memcpy(destination, source, numCharacters * sizeof(CharacterType));
 }
 
 ALWAYS_INLINE void StringImpl::copyCharacters(UChar* destination, const LChar* source, unsigned numCharacters)
index dc1a2ce..7388fdb 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <algorithm>
 #include <string.h>
-#include <wtf/FastCopy.h>
 
 namespace WTF {
 
@@ -56,10 +55,10 @@ UText* uTextCloneImpl(UText* destination, const UText* source, UBool deep, UErro
     void* extraNew = destination->pExtra;
     int32_t flags = destination->flags;
     int sizeToCopy = std::min(source->sizeOfStruct, destination->sizeOfStruct);
-    fastCopyBytes(destination, source, sizeToCopy);
+    memcpy(destination, source, sizeToCopy);
     destination->pExtra = extraNew;
     destination->flags = flags;
-    fastCopyBytes(destination->pExtra, source->pExtra, extraSize);
+    memcpy(destination->pExtra, source->pExtra, extraSize);
     fixPointer(source, destination, destination->context);
     fixPointer(source, destination, destination->p);
     fixPointer(source, destination, destination->q);
index 9921c45..b8109d7 100644 (file)
@@ -27,7 +27,6 @@
 #include "UTextProviderLatin1.h"
 
 #include "UTextProvider.h"
-#include <wtf/FastZeroFill.h>
 #include <wtf/text/StringImpl.h>
 
 namespace WTF {
@@ -83,7 +82,7 @@ static UText* uTextLatin1Clone(UText* destination, const UText* source, UBool de
     result->a = source->a;
     result->pFuncs = &uTextLatin1Funcs;
     result->chunkContents = (UChar*)result->pExtra;
-    fastZeroFill(const_cast<UChar*>(result->chunkContents), UTextWithBufferInlineCapacity);
+    memset(const_cast<UChar*>(result->chunkContents), 0, sizeof(UChar) * UTextWithBufferInlineCapacity);
 
     return result;
 }
@@ -229,7 +228,7 @@ UText* openLatin1UTextProvider(UTextWithBuffer* utWithBuffer, const LChar* strin
     text->a = length;
     text->pFuncs = &uTextLatin1Funcs;
     text->chunkContents = (UChar*)text->pExtra;
-    fastZeroFill(const_cast<UChar*>(text->chunkContents), UTextWithBufferInlineCapacity);
+    memset(const_cast<UChar*>(text->chunkContents), 0, sizeof(UChar) * UTextWithBufferInlineCapacity);
 
     return text;
 }
index b9b15ff..fc7205b 100644 (file)
@@ -172,7 +172,7 @@ kern_return_t catch_mach_exception_raise_state(
     Signal signal = fromMachException(exceptionType);
     RELEASE_ASSERT(signal != Signal::Unknown);
 
-    fastCopy(outState, inState, inStateCount);
+    memcpy(outState, inState, inStateCount * sizeof(inState[0]));
     *outStateCount = inStateCount;
 
 #if CPU(X86_64)
index e9d9e46..a707d0f 100644 (file)
@@ -1,3 +1,22 @@
+2018-02-16  Filip Pizlo  <fpizlo@apple.com>
+
+        Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it was not a
+        progression.
+
+        * bmalloc/Algorithm.h:
+        (bmalloc::fastCopy): Deleted.
+        (bmalloc::fastZeroFill): Deleted.
+        * bmalloc/Allocator.cpp:
+        (bmalloc::Allocator::reallocate):
+        * bmalloc/Bits.h:
+        (bmalloc::BitsWordOwner::operator=):
+        (bmalloc::BitsWordOwner::clearAll):
+        (bmalloc::BitsWordOwner::set):
+        * bmalloc/IsoPageInlines.h:
+        (bmalloc::IsoPage<Config>::IsoPage):
+        * bmalloc/Vector.h:
+        (bmalloc::Vector<T>::reallocateBuffer):
+
 2018-02-09  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         Improve of string.h include after r228317.
index 7948f43..e4e51a5 100644 (file)
@@ -181,221 +181,6 @@ bool findBitInWord(T word, size_t& index, size_t endIndex, bool value)
     return false;
 }
 
-template<typename T>
-void fastCopy(T* dst, T* src, size_t length)
-{
-#if BCPU(X86_64)
-    uint64_t tmp = 0;
-    size_t count = length * sizeof(T);
-    if (!(sizeof(T) % sizeof(uint64_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $3, %%rcx\n\t"
-            "rep movsq\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint32_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $2, %%rcx\n\t"
-            "rep movsl\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $4, %%rcx\n\t" // FIXME: This isn't really a loop. https://bugs.webkit.org/show_bug.cgi?id=182617
-            "4:\n\t"
-            "movl (%%rsi, %%rcx), %%eax\n\t"
-            "movl %%eax, (%%rdi, %%rcx)\n\t"
-            "subq $4, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint16_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $1, %%rcx\n\t"
-            "rep movsw\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq (%%rsi, %%rcx), %%rax\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $6, %%rcx\n\t"
-            "4:\n\t"
-            "movw (%%rsi, %%rcx), %%ax\n\t"
-            "movw %%ax, (%%rdi, %%rcx)\n\t"
-            "subq $2, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-            :
-            : "memory"
-            );
-        return;
-    }
-    asm volatile (
-        "cmpq $200, %%rcx\n\t"
-        "jb 1f\n\t"
-        "rep movsb\n\t"
-        "jmp 2f\n\t"
-        "3:\n\t"
-        "movq (%%rsi, %%rcx), %%rax\n\t"
-        "movq %%rax, (%%rdi, %%rcx)\n\t"
-        "1:\n\t"
-        "subq $8, %%rcx\n\t"
-        "jae 3b\n\t"
-        "cmpq $-8, %%rcx\n\t"
-        "je 2f\n\t"
-        "addq $7, %%rcx\n\t"
-        "4:\n\t"
-        "movb (%%rsi, %%rcx), %%al\n\t"
-        "movb %%al, (%%rdi, %%rcx)\n\t"
-        "subq $1, %%rcx\n\t"
-        "jae 4b\n\t"
-        "2:\n\t"
-        : "+D"(dst), "+S"(src), "+c"(count), "+a"(tmp)
-        :
-        : "memory"
-        );
-#else
-    memcpy(dst, src, length * sizeof(T));
-#endif
-}
-
-template<typename T>
-void fastZeroFill(T* dst, size_t length)
-{
-#if BCPU(X86_64)
-    uint64_t zero = 0;
-    size_t count = length * sizeof(T);
-    if (!(sizeof(T) % sizeof(uint64_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $3, %%rcx\n\t"
-            "rep stosq\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint32_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $2, %%rcx\n\t"
-            "rep stosl\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $4, %%rcx\n\t" // FIXME: This isn't really a loop. https://bugs.webkit.org/show_bug.cgi?id=182617
-            "4:\n\t"
-            "movl %%eax, (%%rdi, %%rcx)\n\t"
-            "subq $4, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    if (!(sizeof(T) % sizeof(uint16_t))) {
-        asm volatile (
-            "cmpq $200, %%rcx\n\t"
-            "jb 1f\n\t"
-            "shrq $1, %%rcx\n\t"
-            "rep stosw\n\t"
-            "jmp 2f\n\t"
-            "3:\n\t"
-            "movq %%rax, (%%rdi, %%rcx)\n\t"
-            "1:\n\t"
-            "subq $8, %%rcx\n\t"
-            "jae 3b\n\t"
-            "cmpq $-8, %%rcx\n\t"
-            "je 2f\n\t"
-            "addq $6, %%rcx\n\t"
-            "4:\n\t"
-            "movw %%ax, (%%rdi, %%rcx)\n\t"
-            "subq $2, %%rcx\n\t"
-            "jae 4b\n\t"
-            "2:\n\t"
-            : "+D"(dst), "+c"(count)
-            : "a"(zero)
-            : "memory"
-            );
-        return;
-    }
-    asm volatile (
-        "cmpq $200, %%rcx\n\t"
-        "jb 1f\n\t"
-        "rep stosb\n\t"
-        "jmp 2f\n\t"
-        "3:\n\t"
-        "movq %%rax, (%%rdi, %%rcx)\n\t"
-        "1:\n\t"
-        "subq $8, %%rcx\n\t"
-        "jae 3b\n\t"
-        "cmpq $-8, %%rcx\n\t"
-        "je 2f\n\t"
-        "addq $7, %%rcx\n\t"
-        "4:\n\t"
-        "movb %%al, (%%rdi, %%rcx)\n\t"
-        "sub $1, %%rcx\n\t"
-        "jae 4b\n\t"
-        "2:\n\t"
-        : "+D"(dst), "+c"(count)
-        : "a"(zero)
-        : "memory"
-        );
-#else
-    memset(dst, 0, length * sizeof(T));
-#endif
-}
-
 } // namespace bmalloc
 
 #endif // Algorithm_h
index d844977..b442def 100644 (file)
@@ -125,7 +125,7 @@ void* Allocator::reallocate(void* object, size_t newSize)
 
     void* result = allocate(newSize);
     size_t copySize = std::min(oldSize, newSize);
-    fastCopy(static_cast<char*>(result), static_cast<char*>(object), copySize);
+    memcpy(result, object, copySize);
     m_deallocator.deallocate(object);
     return result;
 }
index a808ddf..8bdd344 100644 (file)
@@ -80,7 +80,7 @@ public:
     
     BitsWordOwner& operator=(const BitsWordOwner& other)
     {
-        fastCopy(m_words, other.m_words, arrayLength());
+        memcpy(m_words, other.m_words, arrayLength() * sizeof(uint32_t));
         return *this;
     }
     
@@ -91,12 +91,12 @@ public:
     
     void clearAll()
     {
-        fastZeroFill(m_words, arrayLength());
+        memset(m_words, 0, arrayLength() * sizeof(uint32_t));
     }
     
     void set(const BitsWordOwner& other)
     {
-        fastCopy(m_words, other.m_words, arrayLength());
+        memcpy(m_words, other.m_words, arrayLength() * sizeof(uint32_t));
     }
     
     size_t numBits() const
index 1b76ba5..0c47864 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,7 +47,7 @@ IsoPage<Config>::IsoPage(IsoDirectoryBase<Config>& directory, unsigned index)
     : m_directory(directory)
     , m_index(index)
 {
-    fastZeroFill(m_allocBits, bitsArrayLength(numObjects));
+    memset(m_allocBits, 0, sizeof(m_allocBits));
 }
 
 template<typename Config>
index 04df5e2..9d87655 100644 (file)
@@ -203,7 +203,7 @@ void Vector<T>::reallocateBuffer(size_t newCapacity)
     size_t vmSize = bmalloc::vmSize(newCapacity * sizeof(T));
     T* newBuffer = vmSize ? static_cast<T*>(vmAllocate(vmSize)) : nullptr;
     if (m_buffer) {
-        fastCopy(newBuffer, m_buffer, m_size);
+        std::memcpy(newBuffer, m_buffer, m_size * sizeof(T));
         vmDeallocate(m_buffer, bmalloc::vmSize(m_capacity * sizeof(T)));
     }