Log Message
Unreviewed, rolling out r221384.
This patch caused multiple 32-bit JSC test failures. Reverted changeset: "Strings need to be in some kind of gigacage" https://bugs.webkit.org/show_bug.cgi?id=174924 http://trac.webkit.org/changeset/221384
Modified Paths
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/runtime/JSString.cpp
- trunk/Source/_javascript_Core/runtime/JSString.h
- trunk/Source/_javascript_Core/runtime/JSStringBuilder.h
- trunk/Source/_javascript_Core/runtime/VM.h
- trunk/Source/WTF/ChangeLog
- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
- trunk/Source/WTF/wtf/CMakeLists.txt
- trunk/Source/WTF/wtf/Deque.h
- trunk/Source/WTF/wtf/FastMalloc.h
- trunk/Source/WTF/wtf/Forward.h
- trunk/Source/WTF/wtf/Gigacage.cpp
- trunk/Source/WTF/wtf/Gigacage.h
- trunk/Source/WTF/wtf/Vector.h
- trunk/Source/WTF/wtf/text/AtomicStringImpl.h
- trunk/Source/WTF/wtf/text/CString.cpp
- trunk/Source/WTF/wtf/text/CString.h
- trunk/Source/WTF/wtf/text/StringBuffer.h
- trunk/Source/WTF/wtf/text/StringImpl.cpp
- trunk/Source/WTF/wtf/text/StringImpl.h
- trunk/Source/WTF/wtf/text/SymbolImpl.h
- trunk/Source/WTF/wtf/text/UniquedStringImpl.h
- trunk/Source/WTF/wtf/text/WTFString.h
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp
- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
- trunk/Source/WebCore/platform/URLParser.cpp
- trunk/Source/WebCore/platform/URLParser.h
- trunk/Source/WebCore/platform/graphics/FourCC.cpp
- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
- trunk/Source/WebCore/platform/text/LocaleICU.cpp
- trunk/Source/WebCore/platform/text/mac/TextCodecMac.cpp
- trunk/Source/WebCore/platform/win/FileSystemWin.cpp
- trunk/Source/bmalloc/ChangeLog
- trunk/Source/bmalloc/bmalloc/Gigacage.cpp
- trunk/Source/bmalloc/bmalloc/Gigacage.h
- trunk/Source/bmalloc/bmalloc/HeapKind.h
Removed Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (221401 => 221402)
--- trunk/Source/_javascript_Core/ChangeLog 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,3 +1,15 @@
+2017-08-30 Matt Lewis <jlew...@apple.com>
+
+ Unreviewed, rolling out r221384.
+
+ This patch caused multiple 32-bit JSC test failures.
+
+ Reverted changeset:
+
+ "Strings need to be in some kind of gigacage"
+ https://bugs.webkit.org/show_bug.cgi?id=174924
+ http://trac.webkit.org/changeset/221384
+
2017-08-30 Saam Barati <sbar...@apple.com>
semicolon is being interpreted as an = in the LiteralParser
Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (221401 => 221402)
--- trunk/Source/_javascript_Core/runtime/JSString.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -178,34 +178,30 @@
void JSRopeString::resolveRopeToAtomicString(ExecState* exec) const
{
- [&] () {
- if (length() > maxLengthForOnStackResolve) {
- resolveRope(exec);
- m_value = AtomicString(m_value);
- setIs8Bit(m_value.impl()->is8Bit());
- return;
- }
+ if (length() > maxLengthForOnStackResolve) {
+ resolveRope(exec);
+ m_value = AtomicString(m_value);
+ setIs8Bit(m_value.impl()->is8Bit());
+ return;
+ }
- if (is8Bit()) {
- LChar buffer[maxLengthForOnStackResolve];
- resolveRopeInternal8(buffer);
- m_value = AtomicString(buffer, length());
- setIs8Bit(m_value.impl()->is8Bit());
- } else {
- UChar buffer[maxLengthForOnStackResolve];
- resolveRopeInternal16(buffer);
- m_value = AtomicString(buffer, length());
- setIs8Bit(m_value.impl()->is8Bit());
- }
+ if (is8Bit()) {
+ LChar buffer[maxLengthForOnStackResolve];
+ resolveRopeInternal8(buffer);
+ m_value = AtomicString(buffer, length());
+ setIs8Bit(m_value.impl()->is8Bit());
+ } else {
+ UChar buffer[maxLengthForOnStackResolve];
+ resolveRopeInternal16(buffer);
+ m_value = AtomicString(buffer, length());
+ setIs8Bit(m_value.impl()->is8Bit());
+ }
- clearFibers();
+ clearFibers();
- // If we resolved a string that didn't previously exist, notify the heap that we've grown.
- if (m_value.impl()->hasOneRef())
- Heap::heap(this)->reportExtraMemoryAllocated(m_value.impl()->cost());
- }();
-
- m_value.releaseAssertCaged();
+ // If we resolved a string that didn't previously exist, notify the heap that we've grown.
+ if (m_value.impl()->hasOneRef())
+ Heap::heap(this)->reportExtraMemoryAllocated(m_value.impl()->cost());
}
void JSRopeString::clearFibers() const
@@ -252,32 +248,17 @@
void JSRopeString::resolveRope(ExecState* exec) const
{
- [&] () {
- ASSERT(isRope());
-
- if (isSubstring()) {
- ASSERT(!substringBase()->isRope());
- m_value = substringBase()->m_value.substringSharingImpl(substringOffset(), length());
- substringBase().clear();
- return;
- }
-
- if (is8Bit()) {
- LChar* buffer;
- if (auto newImpl = StringImpl::tryCreateUninitialized(length(), buffer)) {
- Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
- m_value = WTFMove(newImpl);
- } else {
- outOfMemory(exec);
- return;
- }
- resolveRopeInternal8NoSubstring(buffer);
- clearFibers();
- ASSERT(!isRope());
- return;
- }
-
- UChar* buffer;
+ ASSERT(isRope());
+
+ if (isSubstring()) {
+ ASSERT(!substringBase()->isRope());
+ m_value = substringBase()->m_value.substringSharingImpl(substringOffset(), length());
+ substringBase().clear();
+ return;
+ }
+
+ if (is8Bit()) {
+ LChar* buffer;
if (auto newImpl = StringImpl::tryCreateUninitialized(length(), buffer)) {
Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
m_value = WTFMove(newImpl);
@@ -285,13 +266,24 @@
outOfMemory(exec);
return;
}
-
- resolveRopeInternal16NoSubstring(buffer);
+ resolveRopeInternal8NoSubstring(buffer);
clearFibers();
ASSERT(!isRope());
- }();
+ return;
+ }
- m_value.releaseAssertCaged();
+ UChar* buffer;
+ if (auto newImpl = StringImpl::tryCreateUninitialized(length(), buffer)) {
+ Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
+ m_value = WTFMove(newImpl);
+ } else {
+ outOfMemory(exec);
+ return;
+ }
+
+ resolveRopeInternal16NoSubstring(buffer);
+ clearFibers();
+ ASSERT(!isRope());
}
// Overview: These functions convert a JSString from holding a string in rope form
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (221401 => 221402)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -139,7 +139,6 @@
public:
static JSString* create(VM& vm, Ref<StringImpl>&& value)
{
- value->assertCaged();
unsigned length = value->length();
size_t cost = value->cost();
JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, WTFMove(value));
@@ -148,7 +147,6 @@
}
static JSString* createHasOtherOwner(VM& vm, Ref<StringImpl>&& value)
{
- value->assertCaged();
size_t length = value->length();
JSString* newString = new (NotNull, allocateCell<JSString>(vm.heap)) JSString(vm, WTFMove(value));
newString->finishCreation(vm, length);
Modified: trunk/Source/_javascript_Core/runtime/JSStringBuilder.h (221401 => 221402)
--- trunk/Source/_javascript_Core/runtime/JSStringBuilder.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/_javascript_Core/runtime/JSStringBuilder.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 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,7 +27,7 @@
#include "ExceptionHelpers.h"
#include "JSString.h"
-#include <wtf/text/StringVector.h>
+#include <wtf/Vector.h>
namespace JSC {
@@ -113,8 +113,8 @@
m_is8Bit = false;
}
- StringVector<LChar, 64, UnsafeVectorOverflow> buffer8;
- StringVector<UChar, 64, UnsafeVectorOverflow> buffer16;
+ Vector<LChar, 64, UnsafeVectorOverflow> buffer8;
+ Vector<UChar, 64, UnsafeVectorOverflow> buffer16;
bool m_okay;
bool m_is8Bit;
};
Modified: trunk/Source/_javascript_Core/runtime/VM.h (221401 => 221402)
--- trunk/Source/_javascript_Core/runtime/VM.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -308,8 +308,6 @@
return primitiveGigacageAuxiliarySpace;
case Gigacage::JSValue:
return jsValueGigacageAuxiliarySpace;
- case Gigacage::String:
- break;
}
RELEASE_ASSERT_NOT_REACHED();
return primitiveGigacageAuxiliarySpace;
Modified: trunk/Source/WTF/ChangeLog (221401 => 221402)
--- trunk/Source/WTF/ChangeLog 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/ChangeLog 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,3 +1,15 @@
+2017-08-30 Matt Lewis <jlew...@apple.com>
+
+ Unreviewed, rolling out r221384.
+
+ This patch caused multiple 32-bit JSC test failures.
+
+ Reverted changeset:
+
+ "Strings need to be in some kind of gigacage"
+ https://bugs.webkit.org/show_bug.cgi?id=174924
+ http://trac.webkit.org/changeset/221384
+
2017-08-30 Brady Eidson <beid...@apple.com>
Add "Identified" base class to replace a whole bunch of custom identifier generators.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (221401 => 221402)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-08-30 22:48:08 UTC (rev 221402)
@@ -21,7 +21,6 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
- 0F0F526B1F421FF8004A452C /* StringMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0F52691F421FF8004A452C /* StringMalloc.cpp */; };
0F30BA901E78708E002CA847 /* GlobalVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F30BA8A1E78708E002CA847 /* GlobalVersion.cpp */; };
0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */; };
0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5BF1741F23D49A0029D91D /* Gigacage.cpp */; };
@@ -164,8 +163,6 @@
/* Begin PBXFileReference section */
0F0D85B317234CB100338210 /* NoLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoLock.h; sourceTree = "<group>"; };
- 0F0F52691F421FF8004A452C /* StringMalloc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StringMalloc.cpp; sourceTree = "<group>"; };
- 0F0F526A1F421FF8004A452C /* StringMalloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StringMalloc.h; sourceTree = "<group>"; };
0F0FCDDD1DD167F900CCAB53 /* LockAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LockAlgorithm.h; sourceTree = "<group>"; };
0F2AC5601E89F70C0001EE3F /* Range.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; };
0F2AC5621E8A01490001EE3F /* IndexKeyType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexKeyType.h; sourceTree = "<group>"; };
@@ -179,7 +176,6 @@
0F30BA8E1E78708E002CA847 /* LoggingHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingHashSet.h; sourceTree = "<group>"; };
0F30BA8F1E78708E002CA847 /* LoggingHashTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingHashTraits.h; sourceTree = "<group>"; };
0F31DD701F1308BC0072EB4A /* LockAlgorithmInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LockAlgorithmInlines.h; sourceTree = "<group>"; };
- 0F348C7D1F47AA9D003CFEF2 /* StringVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StringVector.h; sourceTree = "<group>"; };
0F3501631BB258C800F0A2A3 /* WeakRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakRandom.h; sourceTree = "<group>"; };
0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutomaticThread.cpp; sourceTree = "<group>"; };
0F43D8F01DB5ADDC00108FB6 /* AutomaticThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomaticThread.h; sourceTree = "<group>"; };
@@ -1094,10 +1090,7 @@
A8A47327151A825B004123FF /* StringHash.h */,
A8A47328151A825B004123FF /* StringImpl.cpp */,
A8A47329151A825B004123FF /* StringImpl.h */,
- 0F0F52691F421FF8004A452C /* StringMalloc.cpp */,
- 0F0F526A1F421FF8004A452C /* StringMalloc.h */,
A8A4732A151A825B004123FF /* StringOperators.h */,
- 0F348C7D1F47AA9D003CFEF2 /* StringVector.h */,
93F1993D19D7958D00C2390B /* StringView.cpp */,
1A6EB1DF187D0BD30030126F /* StringView.h */,
F72BBDB107FA424886178B9E /* SymbolImpl.cpp */,
@@ -1344,7 +1337,6 @@
515F794E1CFC9F4A00CCED93 /* CrossThreadCopier.cpp in Sources */,
A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */,
E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */,
- 0F0F526B1F421FF8004A452C /* StringMalloc.cpp in Sources */,
A8A47439151A825B004123FF /* CString.cpp in Sources */,
A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,
A8A4739E151A825B004123FF /* DataLog.cpp in Sources */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (221401 => 221402)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2017-08-30 22:48:08 UTC (rev 221402)
@@ -182,8 +182,6 @@
text/StringCommon.h
text/StringHash.h
text/StringImpl.h
- text/StringMalloc.h
- text/StringVector.h
text/StringView.h
text/SymbolImpl.h
text/SymbolRegistry.h
@@ -288,7 +286,6 @@
text/StringBuilder.cpp
text/StringBuilderJSON.cpp
text/StringImpl.cpp
- text/StringMalloc.cpp
text/StringView.cpp
text/SymbolImpl.cpp
text/SymbolRegistry.cpp
Modified: trunk/Source/WTF/wtf/Deque.h (221401 => 221402)
--- trunk/Source/WTF/wtf/Deque.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/Deque.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -113,7 +113,7 @@
private:
friend class DequeIteratorBase<T, inlineCapacity>;
- typedef VectorBuffer<T, inlineCapacity, FastMalloc> Buffer;
+ typedef VectorBuffer<T, inlineCapacity> Buffer;
typedef VectorTypeOperations<T> TypeOperations;
typedef DequeIteratorBase<T, inlineCapacity> IteratorBase;
Modified: trunk/Source/WTF/wtf/FastMalloc.h (221401 => 221402)
--- trunk/Source/WTF/wtf/FastMalloc.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/FastMalloc.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -129,22 +129,6 @@
template<typename T, typename U> inline bool operator==(const FastAllocator<T>&, const FastAllocator<U>&) { return true; }
template<typename T, typename U> inline bool operator!=(const FastAllocator<T>&, const FastAllocator<U>&) { return false; }
-struct FastMalloc {
- static void* malloc(size_t size) { return fastMalloc(size); }
-
- static void* tryMalloc(size_t size)
- {
- auto result = tryFastMalloc(size);
- void* realResult;
- if (result.getValue(realResult))
- return realResult;
- return nullptr;
- }
-
- static void* realloc(void* p, size_t size) { return fastRealloc(p, size); }
-
- static void free(void* p) { fastFree(p); }
-};
} // namespace WTF
@@ -152,8 +136,6 @@
using WTF::fastSetMaxSingleAllocationSize;
#endif
-using WTF::FastAllocator;
-using WTF::FastMalloc;
using WTF::isFastMallocEnabled;
using WTF::fastCalloc;
using WTF::fastFree;
@@ -169,6 +151,7 @@
using WTF::tryFastZeroedMalloc;
using WTF::fastAlignedMalloc;
using WTF::fastAlignedFree;
+using WTF::FastAllocator;
#if COMPILER(GCC_OR_CLANG) && OS(DARWIN)
#define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))
Modified: trunk/Source/WTF/wtf/Forward.h (221401 => 221402)
--- trunk/Source/WTF/wtf/Forward.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/Forward.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -37,7 +37,7 @@
template<typename T> class StringBuffer;
template<typename... T> class Variant;
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc> class Vector;
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> class Vector;
class AtomicString;
class AtomicStringImpl;
Modified: trunk/Source/WTF/wtf/Gigacage.cpp (221401 => 221402)
--- trunk/Source/WTF/wtf/Gigacage.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/Gigacage.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -40,7 +40,11 @@
void* tryMalloc(Kind, size_t size)
{
- return FastMalloc::tryMalloc(size);
+ auto result = tryFastMalloc(size);
+ void* realResult;
+ if (result.getValue(realResult))
+ return realResult;
+ return nullptr;
}
void* tryAllocateVirtualPages(Kind, size_t size)
Modified: trunk/Source/WTF/wtf/Gigacage.h (221401 => 221402)
--- trunk/Source/WTF/wtf/Gigacage.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/Gigacage.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -40,8 +40,7 @@
enum Kind {
Primitive,
- JSValue,
- String
+ JSValue
};
inline void ensureGigacage() { }
@@ -64,8 +63,6 @@
return "Primitive";
case JSValue:
return "JSValue";
- case String:
- return "String";
}
RELEASE_ASSERT_NOT_REACHED();
return nullptr;
Modified: trunk/Source/WTF/wtf/Vector.h (221401 => 221402)
--- trunk/Source/WTF/wtf/Vector.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/Vector.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -254,7 +254,7 @@
}
};
-template<typename T, typename Malloc>
+template<typename T>
class VectorBufferBase {
WTF_MAKE_NONCOPYABLE(VectorBufferBase);
public:
@@ -265,7 +265,7 @@
CRASH();
size_t sizeToAllocate = newCapacity * sizeof(T);
m_capacity = sizeToAllocate / sizeof(T);
- m_buffer = static_cast<T*>(Malloc::malloc(sizeToAllocate));
+ m_buffer = static_cast<T*>(fastMalloc(sizeToAllocate));
}
bool tryAllocateBuffer(size_t newCapacity)
@@ -275,12 +275,13 @@
return false;
size_t sizeToAllocate = newCapacity * sizeof(T);
- T* newBuffer = static_cast<T*>(Malloc::tryMalloc(sizeToAllocate));
- if (!newBuffer)
- return false;
- m_capacity = sizeToAllocate / sizeof(T);
- m_buffer = newBuffer;
- return true;
+ T* newBuffer;
+ if (tryFastMalloc(sizeToAllocate).getValue(newBuffer)) {
+ m_capacity = sizeToAllocate / sizeof(T);
+ m_buffer = newBuffer;
+ return true;
+ }
+ return false;
}
bool shouldReallocateBuffer(size_t newCapacity) const
@@ -295,7 +296,7 @@
CRASH();
size_t sizeToAllocate = newCapacity * sizeof(T);
m_capacity = sizeToAllocate / sizeof(T);
- m_buffer = static_cast<T*>(Malloc::realloc(m_buffer, sizeToAllocate));
+ m_buffer = static_cast<T*>(fastRealloc(m_buffer, sizeToAllocate));
}
void deallocateBuffer(T* bufferToDeallocate)
@@ -308,7 +309,7 @@
m_capacity = 0;
}
- Malloc::free(bufferToDeallocate);
+ fastFree(bufferToDeallocate);
}
T* buffer() { return m_buffer; }
@@ -349,13 +350,13 @@
unsigned m_size; // Only used by the Vector subclass, but placed here to avoid padding the struct.
};
-template<typename T, size_t inlineCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity>
class VectorBuffer;
-template<typename T, typename Malloc>
-class VectorBuffer<T, 0, Malloc> : private VectorBufferBase<T, Malloc> {
+template<typename T>
+class VectorBuffer<T, 0> : private VectorBufferBase<T> {
private:
- typedef VectorBufferBase<T, Malloc> Base;
+ typedef VectorBufferBase<T> Base;
public:
VectorBuffer()
{
@@ -375,7 +376,7 @@
deallocateBuffer(buffer());
}
- void swap(VectorBuffer<T, 0, Malloc>& other, size_t, size_t)
+ void swap(VectorBuffer<T, 0>& other, size_t, size_t)
{
std::swap(m_buffer, other.m_buffer);
std::swap(m_capacity, other.m_capacity);
@@ -410,11 +411,11 @@
using Base::m_capacity;
};
-template<typename T, size_t inlineCapacity, typename Malloc>
-class VectorBuffer : private VectorBufferBase<T, Malloc> {
+template<typename T, size_t inlineCapacity>
+class VectorBuffer : private VectorBufferBase<T> {
WTF_MAKE_NONCOPYABLE(VectorBuffer);
private:
- typedef VectorBufferBase<T, Malloc> Base;
+ typedef VectorBufferBase<T> Base;
public:
VectorBuffer()
: Base(inlineBuffer(), inlineCapacity, 0)
@@ -575,11 +576,11 @@
}
};
-template<typename T, size_t inlineCapacity = 0, typename OverflowHandler = CrashOnOverflow, size_t minCapacity = 16, typename Malloc = FastMalloc>
-class Vector : private VectorBuffer<T, inlineCapacity, Malloc> {
+template<typename T, size_t inlineCapacity = 0, typename OverflowHandler = CrashOnOverflow, size_t minCapacity = 16>
+class Vector : private VectorBuffer<T, inlineCapacity> {
WTF_MAKE_FAST_ALLOCATED;
private:
- typedef VectorBuffer<T, inlineCapacity, Malloc> Base;
+ typedef VectorBuffer<T, inlineCapacity> Base;
typedef VectorTypeOperations<T> TypeOperations;
public:
@@ -632,12 +633,12 @@
}
Vector(const Vector&);
- template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity, typename OtherMalloc>
- explicit Vector(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity, OtherMalloc>&);
+ template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity>
+ explicit Vector(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity>&);
Vector& operator=(const Vector&);
- template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity, typename OtherMalloc>
- Vector& operator=(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity, OtherMalloc>&);
+ template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity>
+ Vector& operator=(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity>&);
Vector(Vector&&);
Vector& operator=(Vector&&);
@@ -813,8 +814,8 @@
#endif
};
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::Vector(const Vector& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+Vector<T, inlineCapacity, OverflowHandler, minCapacity>::Vector(const Vector& other)
: Base(other.capacity(), other.size())
{
asanSetInitialBufferSizeTo(other.size());
@@ -823,9 +824,9 @@
TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity, typename OtherMalloc>
-Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::Vector(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity, OtherMalloc>& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity>
+Vector<T, inlineCapacity, OverflowHandler, minCapacity>::Vector(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity>& other)
: Base(other.capacity(), other.size())
{
asanSetInitialBufferSizeTo(other.size());
@@ -834,8 +835,8 @@
TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::operator=(const Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+Vector<T, inlineCapacity, OverflowHandler, minCapacity>& Vector<T, inlineCapacity, OverflowHandler, minCapacity>::operator=(const Vector<T, inlineCapacity, OverflowHandler, minCapacity>& other)
{
if (&other == this)
return *this;
@@ -859,9 +860,9 @@
inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; }
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity, typename OtherMalloc>
-Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::operator=(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity, OtherMalloc>& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+template<size_t otherCapacity, typename otherOverflowBehaviour, size_t otherMinimumCapacity>
+Vector<T, inlineCapacity, OverflowHandler, minCapacity>& Vector<T, inlineCapacity, OverflowHandler, minCapacity>::operator=(const Vector<T, otherCapacity, otherOverflowBehaviour, otherMinimumCapacity>& other)
{
// If the inline capacities match, we should call the more specific
// template. If the inline capacities don't match, the two objects
@@ -885,29 +886,29 @@
return *this;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::Vector(Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>&& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline Vector<T, inlineCapacity, OverflowHandler, minCapacity>::Vector(Vector<T, inlineCapacity, OverflowHandler, minCapacity>&& other)
{
swap(other);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::operator=(Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>&& other)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline Vector<T, inlineCapacity, OverflowHandler, minCapacity>& Vector<T, inlineCapacity, OverflowHandler, minCapacity>::operator=(Vector<T, inlineCapacity, OverflowHandler, minCapacity>&& other)
{
swap(other);
return *this;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::contains(const U& value) const
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::contains(const U& value) const
{
return find(value) != notFound;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename MatchFunction>
-size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::findMatching(const MatchFunction& matches) const
+size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity>::findMatching(const MatchFunction& matches) const
{
for (size_t i = 0; i < size(); ++i) {
if (matches(at(i)))
@@ -916,9 +917,9 @@
return notFound;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::find(const U& value) const
+size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity>::find(const U& value) const
{
return findMatching([&](auto& item) {
return item == value;
@@ -925,9 +926,9 @@
});
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::reverseFind(const U& value) const
+size_t Vector<T, inlineCapacity, OverflowHandler, minCapacity>::reverseFind(const U& value) const
{
for (size_t i = 1; i <= size(); ++i) {
const size_t index = size() - i;
@@ -937,9 +938,9 @@
return notFound;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::appendIfNotContains(const U& value)
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::appendIfNotContains(const U& value)
{
if (contains(value))
return false;
@@ -947,8 +948,8 @@
return true;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::fill(const T& val, size_t newSize)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::fill(const T& val, size_t newSize)
{
if (size() > newSize)
shrink(newSize);
@@ -965,22 +966,22 @@
m_size = newSize;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename Iterator>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::appendRange(Iterator start, Iterator end)
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::appendRange(Iterator start, Iterator end)
{
for (Iterator it = start; it != end; ++it)
append(*it);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::expandCapacity(size_t newMinCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::expandCapacity(size_t newMinCapacity)
{
reserveCapacity(std::max(newMinCapacity, std::max(static_cast<size_t>(minCapacity), capacity() + capacity() / 4 + 1)));
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-T* Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::expandCapacity(size_t newMinCapacity, T* ptr)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+T* Vector<T, inlineCapacity, OverflowHandler, minCapacity>::expandCapacity(size_t newMinCapacity, T* ptr)
{
if (ptr < begin() || ptr >= end()) {
expandCapacity(newMinCapacity);
@@ -991,14 +992,14 @@
return begin() + index;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryExpandCapacity(size_t newMinCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryExpandCapacity(size_t newMinCapacity)
{
return tryReserveCapacity(std::max(newMinCapacity, std::max(static_cast<size_t>(minCapacity), capacity() + capacity() / 4 + 1)));
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-const T* Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryExpandCapacity(size_t newMinCapacity, const T* ptr)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+const T* Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryExpandCapacity(size_t newMinCapacity, const T* ptr)
{
if (ptr < begin() || ptr >= end()) {
if (!tryExpandCapacity(newMinCapacity))
@@ -1011,16 +1012,15 @@
return begin() + index;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-inline U* Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::expandCapacity(size_t newMinCapacity, U* ptr)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+inline U* Vector<T, inlineCapacity, OverflowHandler, minCapacity>::expandCapacity(size_t newMinCapacity, U* ptr)
{
expandCapacity(newMinCapacity);
return ptr;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::resize(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::resize(size_t size)
{
if (size <= m_size) {
TypeOperations::destruct(begin() + size, end());
@@ -1036,15 +1036,15 @@
m_size = size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::resizeToFit(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::resizeToFit(size_t size)
{
reserveCapacity(size);
resize(size);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::shrink(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::shrink(size_t size)
{
ASSERT(size <= m_size);
TypeOperations::destruct(begin() + size, end());
@@ -1052,8 +1052,8 @@
m_size = size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::grow(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::grow(size_t size)
{
ASSERT(size >= m_size);
if (size > capacity())
@@ -1064,8 +1064,8 @@
m_size = size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::asanSetInitialBufferSizeTo(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::asanSetInitialBufferSizeTo(size_t size)
{
#if ASAN_ENABLED
if (!buffer())
@@ -1080,8 +1080,8 @@
#endif
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::asanSetBufferSizeToFullCapacity(size_t size)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::asanSetBufferSizeToFullCapacity(size_t size)
{
#if ASAN_ENABLED
if (!buffer())
@@ -1094,8 +1094,8 @@
#endif
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::asanBufferSizeWillChangeTo(size_t newSize)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::asanBufferSizeWillChangeTo(size_t newSize)
{
#if ASAN_ENABLED
if (!buffer())
@@ -1108,8 +1108,8 @@
#endif
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::reserveCapacity(size_t newCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::reserveCapacity(size_t newCapacity)
{
if (newCapacity <= capacity())
return;
@@ -1127,8 +1127,8 @@
Base::deallocateBuffer(oldBuffer);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryReserveCapacity(size_t newCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryReserveCapacity(size_t newCapacity)
{
if (newCapacity <= capacity())
return true;
@@ -1150,8 +1150,8 @@
return true;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::reserveInitialCapacity(size_t initialCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::reserveInitialCapacity(size_t initialCapacity)
{
ASSERT(!m_size);
ASSERT(capacity() == inlineCapacity);
@@ -1159,8 +1159,8 @@
Base::allocateBuffer(initialCapacity);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::shrinkCapacity(size_t newCapacity)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::shrinkCapacity(size_t newCapacity)
{
if (newCapacity >= capacity())
return;
@@ -1190,9 +1190,8 @@
asanSetInitialBufferSizeTo(size());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::append(const U* data, size_t dataSize)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::append(const U* data, size_t dataSize)
{
size_t newSize = m_size + dataSize;
if (newSize > capacity()) {
@@ -1207,9 +1206,8 @@
m_size = newSize;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryAppend(const U* data, size_t dataSize)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryAppend(const U* data, size_t dataSize)
{
size_t newSize = m_size + dataSize;
if (newSize > capacity()) {
@@ -1227,9 +1225,8 @@
return true;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::append(U&& value)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::append(U&& value)
{
if (size() != capacity()) {
asanBufferSizeWillChangeTo(m_size + 1);
@@ -1241,9 +1238,8 @@
appendSlowCase(std::forward<U>(value));
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename... Args>
-ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::constructAndAppend(Args&&... args)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename... Args>
+ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::constructAndAppend(Args&&... args)
{
if (size() != capacity()) {
asanBufferSizeWillChangeTo(m_size + 1);
@@ -1255,9 +1251,8 @@
constructAndAppendSlowCase(std::forward<Args>(args)...);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename... Args>
-ALWAYS_INLINE bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryConstructAndAppend(Args&&... args)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename... Args>
+ALWAYS_INLINE bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryConstructAndAppend(Args&&... args)
{
if (size() != capacity()) {
asanBufferSizeWillChangeTo(m_size + 1);
@@ -1269,9 +1264,8 @@
return tryConstructAndAppendSlowCase(std::forward<Args>(args)...);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::appendSlowCase(U&& value)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::appendSlowCase(U&& value)
{
ASSERT(size() == capacity());
@@ -1284,9 +1278,8 @@
++m_size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename... Args>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::constructAndAppendSlowCase(Args&&... args)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename... Args>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::constructAndAppendSlowCase(Args&&... args)
{
ASSERT(size() == capacity());
@@ -1298,9 +1291,8 @@
++m_size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename... Args>
-bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::tryConstructAndAppendSlowCase(Args&&... args)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename... Args>
+bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::tryConstructAndAppendSlowCase(Args&&... args)
{
ASSERT(size() == capacity());
@@ -1317,9 +1309,8 @@
// This version of append saves a branch in the case where you know that the
// vector's capacity is large enough for the append to succeed.
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::uncheckedAppend(U&& value)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+ALWAYS_INLINE void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::uncheckedAppend(U&& value)
{
ASSERT(size() < capacity());
@@ -1330,16 +1321,14 @@
++m_size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U, size_t otherCapacity>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::appendVector(const Vector<U, otherCapacity>& val)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U, size_t otherCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::appendVector(const Vector<U, otherCapacity>& val)
{
append(val.begin(), val.size());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::insert(size_t position, const U* data, size_t dataSize)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::insert(size_t position, const U* data, size_t dataSize)
{
ASSERT_WITH_SECURITY_IMPLICATION(position <= size());
size_t newSize = m_size + dataSize;
@@ -1356,9 +1345,8 @@
m_size = newSize;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::insert(size_t position, U&& value)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::insert(size_t position, U&& value)
{
ASSERT_WITH_SECURITY_IMPLICATION(position <= size());
@@ -1376,15 +1364,14 @@
++m_size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename U, size_t c>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::insertVector(size_t position, const Vector<U, c>& val)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U, size_t c>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::insertVector(size_t position, const Vector<U, c>& val)
{
insert(position, val.begin(), val.size());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::remove(size_t position)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::remove(size_t position)
{
ASSERT_WITH_SECURITY_IMPLICATION(position < size());
T* spot = begin() + position;
@@ -1394,8 +1381,8 @@
--m_size;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::remove(size_t position, size_t length)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::remove(size_t position, size_t length)
{
ASSERT_WITH_SECURITY_IMPLICATION(position <= size());
ASSERT_WITH_SECURITY_IMPLICATION(position + length <= size());
@@ -1407,9 +1394,9 @@
m_size -= length;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-inline bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::removeFirst(const U& value)
+inline bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::removeFirst(const U& value)
{
return removeFirstMatching([&value] (const T& current) {
return current == value;
@@ -1416,9 +1403,9 @@
});
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename MatchFunction>
-inline bool Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::removeFirstMatching(const MatchFunction& matches, size_t startIndex)
+inline bool Vector<T, inlineCapacity, OverflowHandler, minCapacity>::removeFirstMatching(const MatchFunction& matches, size_t startIndex)
{
for (size_t i = startIndex; i < size(); ++i) {
if (matches(at(i))) {
@@ -1429,9 +1416,9 @@
return false;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename U>
-inline unsigned Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::removeAll(const U& value)
+inline unsigned Vector<T, inlineCapacity, OverflowHandler, minCapacity>::removeAll(const U& value)
{
return removeAllMatching([&value] (const T& current) {
return current == value;
@@ -1438,9 +1425,9 @@
});
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
template<typename MatchFunction>
-inline unsigned Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::removeAllMatching(const MatchFunction& matches, size_t startIndex)
+inline unsigned Vector<T, inlineCapacity, OverflowHandler, minCapacity>::removeAllMatching(const MatchFunction& matches, size_t startIndex)
{
iterator holeBegin = end();
iterator holeEnd = end();
@@ -1465,16 +1452,15 @@
return matchCount;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::reverse()
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::reverse()
{
for (size_t i = 0; i < m_size / 2; ++i)
std::swap(at(i), at(m_size - 1 - i));
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-template<typename MapFunction, typename R>
-inline Vector<R> Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::map(MapFunction mapFunction) const
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename MapFunction, typename R>
+inline Vector<R> Vector<T, inlineCapacity, OverflowHandler, minCapacity>::map(MapFunction mapFunction) const
{
Vector<R> result;
result.reserveInitialCapacity(size());
@@ -1483,8 +1469,8 @@
return result;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline MallocPtr<T> Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::releaseBuffer()
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline MallocPtr<T> Vector<T, inlineCapacity, OverflowHandler, minCapacity>::releaseBuffer()
{
// FIXME: Find a way to preserve annotations on the returned buffer.
// ASan requires that all annotations are removed before deallocation,
@@ -1497,7 +1483,7 @@
// that means it was using the inline buffer. In that case,
// we create a brand new buffer so the caller always gets one.
size_t bytes = m_size * sizeof(T);
- buffer = adoptMallocPtr(static_cast<T*>(Malloc::malloc(bytes)));
+ buffer = adoptMallocPtr(static_cast<T*>(fastMalloc(bytes)));
memcpy(buffer.get(), data(), bytes);
}
m_size = 0;
@@ -1505,8 +1491,8 @@
return buffer;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>::checkConsistency()
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::checkConsistency()
{
#if !ASSERT_DISABLED
for (size_t i = 0; i < size(); ++i)
@@ -1514,14 +1500,14 @@
#endif
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline void swap(Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& a, Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& b)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline void swap(Vector<T, inlineCapacity, OverflowHandler, minCapacity>& a, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& b)
{
a.swap(b);
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-bool operator==(const Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& a, const Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& b)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+bool operator==(const Vector<T, inlineCapacity, OverflowHandler, minCapacity>& a, const Vector<T, inlineCapacity, OverflowHandler, minCapacity>& b)
{
if (a.size() != b.size())
return false;
@@ -1529,8 +1515,8 @@
return VectorTypeOperations<T>::compare(a.data(), b.data(), a.size());
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-inline bool operator!=(const Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& a, const Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& b)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+inline bool operator!=(const Vector<T, inlineCapacity, OverflowHandler, minCapacity>& a, const Vector<T, inlineCapacity, OverflowHandler, minCapacity>& b)
{
return !(a == b);
}
@@ -1554,8 +1540,8 @@
return newSize;
}
-template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity, typename Malloc>
-size_t removeRepeatedElements(Vector<T, inlineCapacity, OverflowHandler, minCapacity, Malloc>& vector)
+template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
+size_t removeRepeatedElements(Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector)
{
return removeRepeatedElements(vector, [] (T& a, T& b) { return a == b; });
}
Modified: trunk/Source/WTF/wtf/text/AtomicStringImpl.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/AtomicStringImpl.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/AtomicStringImpl.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -103,7 +103,7 @@
#if !ASSERT_DISABLED
// AtomicStringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
-// as they are not allocated by StringMalloc.
+// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
// so we ignore the consistency check for all AtomicStringImpls*.
template<> struct
Modified: trunk/Source/WTF/wtf/text/CString.cpp (221401 => 221402)
--- trunk/Source/WTF/wtf/text/CString.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/CString.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 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,7 +29,6 @@
#include <string.h>
#include <wtf/Hasher.h>
-#include <wtf/text/StringMalloc.h>
namespace WTF {
@@ -39,7 +38,7 @@
// The +1 is for the terminating null character.
size_t size = sizeof(CStringBuffer) + length + 1;
- CStringBuffer* stringBuffer = static_cast<CStringBuffer*>(stringMalloc(size));
+ CStringBuffer* stringBuffer = static_cast<CStringBuffer*>(fastMalloc(size));
return adoptRef(*new (NotNull, stringBuffer) CStringBuffer(length));
}
Modified: trunk/Source/WTF/wtf/text/CString.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/CString.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/CString.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,6 @@
#include <wtf/HashTraits.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
-#include <wtf/text/StringMalloc.h>
namespace WTF {
@@ -37,7 +36,6 @@
// CStringBuffer is the ref-counted storage class for the characters in a CString.
// The data is implicitly allocated 1 character longer than length(), as it is zero-terminated.
class CStringBuffer : public RefCounted<CStringBuffer> {
- WTF_MAKE_STRING_ALLOCATED;
public:
const char* data() { return mutableData(); }
size_t length() const { return m_length; }
Modified: trunk/Source/WTF/wtf/text/StringBuffer.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringBuffer.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringBuffer.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -30,7 +30,6 @@
#define StringBuffer_h
#include <wtf/Assertions.h>
-#include <wtf/text/StringMalloc.h>
#include <limits>
#include <unicode/utypes.h>
@@ -42,13 +41,13 @@
public:
explicit StringBuffer(unsigned length)
: m_length(length)
- , m_data(m_length ? static_cast<CharType*>(stringMalloc((Checked<size_t>(m_length) * sizeof(CharType)).unsafeGet())) : nullptr)
+ , m_data(m_length ? static_cast<CharType*>(fastMalloc((Checked<size_t>(m_length) * sizeof(CharType)).unsafeGet())) : nullptr)
{
}
~StringBuffer()
{
- stringFree(m_data);
+ fastFree(m_data);
}
void shrink(unsigned newLength)
@@ -62,7 +61,7 @@
if (newLength > m_length) {
if (newLength > std::numeric_limits<unsigned>::max() / sizeof(UChar))
CRASH();
- m_data = static_cast<UChar*>(stringRealloc(m_data, newLength * sizeof(UChar)));
+ m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
}
m_length = newLength;
}
Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringImpl.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (kn...@kde.org)
* (C) 1999 Antti Koivisto (koivi...@kde.org)
* (C) 2001 Dirk Mueller ( muel...@kde.org )
- * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2009, 2013-2016 Apple Inc. All rights reserved.
* Copyright (C) 2006 Andrew Wellington (pro...@wiretapped.net)
*
* This library is free software; you can redistribute it and/or
@@ -28,11 +28,9 @@
#include "AtomicString.h"
#include "StringBuffer.h"
#include "StringHash.h"
-#include <wtf/Gigacage.h>
#include <wtf/ProcessID.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
-#include <wtf/text/StringMalloc.h>
#include <wtf/text/StringView.h>
#include <wtf/text/SymbolImpl.h>
#include <wtf/text/SymbolRegistry.h>
@@ -131,7 +129,7 @@
if (ownership == BufferOwned) {
// We use m_data8, but since it is a union with m_data16 this works either way.
ASSERT(m_data8);
- stringFree(const_cast<LChar*>(m_data8));
+ fastFree(const_cast<LChar*>(m_data8));
return;
}
@@ -143,7 +141,7 @@
void StringImpl::destroy(StringImpl* stringImpl)
{
stringImpl->~StringImpl();
- stringFree(stringImpl);
+ fastFree(stringImpl);
}
Ref<StringImpl> StringImpl::createFromLiteral(const char* characters, unsigned length)
@@ -194,7 +192,7 @@
// heap allocation from this call.
if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(CharType)))
CRASH();
- StringImpl* string = static_cast<StringImpl*>(stringMalloc(allocationSize<CharType>(length)));
+ StringImpl* string = static_cast<StringImpl*>(fastMalloc(allocationSize<CharType>(length)));
data = ""
return constructInternal<CharType>(string, length);
@@ -221,12 +219,12 @@
return *empty();
}
- // Same as createUninitialized() except here we use stringRealloc.
+ // Same as createUninitialized() except here we use fastRealloc.
if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(CharType)))
CRASH();
originalString->~StringImpl();
- auto* string = static_cast<StringImpl*>(stringRealloc(&originalString.leakRef(), allocationSize<CharType>(length)));
+ auto* string = static_cast<StringImpl*>(fastRealloc(&originalString.leakRef(), allocationSize<CharType>(length)));
data = ""
return constructInternal<CharType>(string, length);
@@ -2179,14 +2177,4 @@
return !memcmp(a, b->characters16(), b->length() * sizeof(UChar));
}
-void StringImpl::releaseAssertCaged() const
-{
- if (isStatic())
- return;
- RELEASE_ASSERT(!GIGACAGE_ENABLED || Gigacage::isCaged(Gigacage::String, this));
- if (bufferOwnership() != BufferOwned)
- return;
- RELEASE_ASSERT(!GIGACAGE_ENABLED || Gigacage::isCaged(Gigacage::String, m_data8));
-}
-
} // namespace WTF
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -35,8 +35,6 @@
#include <wtf/Vector.h>
#include <wtf/text/ConversionMode.h>
#include <wtf/text/StringCommon.h>
-#include <wtf/text/StringMalloc.h>
-#include <wtf/text/StringVector.h>
#if USE(CF)
typedef const struct __CFString * CFStringRef;
@@ -180,7 +178,7 @@
};
class StringImpl : private StringImplShape {
- WTF_MAKE_NONCOPYABLE(StringImpl); WTF_MAKE_STRING_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(StringImpl); WTF_MAKE_FAST_ALLOCATED;
friend struct WTF::CStringTranslator;
template<typename CharacterType> friend struct WTF::HashAndCharactersTranslator;
friend struct WTF::HashAndUTF8CharactersTranslator;
@@ -195,7 +193,7 @@
friend class PrivateSymbolImpl;
friend class RegisteredSymbolImpl;
-public:
+private:
enum BufferOwnership {
BufferInternal,
BufferOwned,
@@ -203,6 +201,7 @@
};
// The bottom 6 bits in the hash are flags.
+public:
static constexpr const unsigned s_flagCount = 6;
private:
static constexpr const unsigned s_flagMask = (1u << s_flagCount) - 1;
@@ -338,7 +337,7 @@
auto* ownerRep = ((rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep);
// We allocate a buffer that contains both the StringImpl struct as well as the pointer to the owner string.
- auto* stringImpl = static_cast<StringImpl*>(stringMalloc(allocationSize<StringImpl*>(1)));
+ auto* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(1)));
if (rep.is8Bit())
return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data8 + offset, length, *ownerRep));
return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data16 + offset, length, *ownerRep));
@@ -373,8 +372,8 @@
output = nullptr;
return nullptr;
}
- StringImpl* resultImpl = static_cast<StringImpl*>(tryStringMalloc(allocationSize<T>(length)));
- if (!resultImpl) {
+ StringImpl* resultImpl;
+ if (!tryFastMalloc(allocationSize<T>(length)).getValue(resultImpl)) {
output = nullptr;
return nullptr;
}
@@ -396,8 +395,8 @@
static unsigned maskStringKind() { return s_hashMaskStringKind; }
static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); }
- template<typename CharType, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
- static Ref<StringImpl> adopt(StringVector<CharType, inlineCapacity, OverflowHandler, minCapacity>&& vector)
+ template<typename CharType, size_t inlineCapacity, typename OverflowHandler>
+ static Ref<StringImpl> adopt(Vector<CharType, inlineCapacity, OverflowHandler>&& vector)
{
if (size_t size = vector.size()) {
ASSERT(vector.data());
@@ -758,16 +757,6 @@
ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
#endif
- BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_hashAndFlags & s_hashMaskBufferOwnership); }
-
- void assertCaged() const
- {
- if (!ASSERT_DISABLED)
- releaseAssertCaged();
- }
-
- WTF_EXPORT_PRIVATE void releaseAssertCaged() const;
-
protected:
~StringImpl();
@@ -857,6 +846,7 @@
enum class CaseConvertType { Upper, Lower };
template<CaseConvertType type, typename CharacterType> static Ref<StringImpl> convertASCIICase(StringImpl&, const CharacterType*, unsigned);
+ BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_hashAndFlags & s_hashMaskBufferOwnership); }
template <class UCharPredicate> Ref<StringImpl> stripMatchedCharacters(UCharPredicate);
template <typename CharType, class UCharPredicate> Ref<StringImpl> simplifyMatchedCharactersToSpace(UCharPredicate);
template <typename CharType> static Ref<StringImpl> constructInternal(StringImpl*, unsigned);
@@ -891,7 +881,7 @@
#if !ASSERT_DISABLED
// StringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
-// as they are not allocated by stringMalloc.
+// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
// so we ignore the consistency check for all StringImpl*.
template<> struct
Deleted: trunk/Source/WTF/wtf/text/StringMalloc.cpp (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringMalloc.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringMalloc.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,89 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-#include "config.h"
-#include "StringMalloc.h"
-
-#include <wtf/DataLog.h>
-#include <wtf/FastMalloc.h>
-#include <wtf/Gigacage.h>
-#include <wtf/RawPointer.h>
-
-#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
-#include <bmalloc/bmalloc.h>
-#endif
-
-namespace WTF {
-
-#if defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
-void* tryStringMalloc(size_t size)
-{
- return FastMalloc::tryMalloc(size);
-}
-
-void* stringMalloc(size_t size)
-{
- return fastMalloc(size);
-}
-
-void* stringRealloc(void* p, size_t size)
-{
- return fastRealloc(p, size);
-}
-
-void stringFree(void* p)
-{
- return fastFree(p);
-}
-#else
-void* tryStringMalloc(size_t size)
-{
- return bmalloc::api::tryMalloc(size, bmalloc::HeapKind::StringGigacage);
-}
-
-void* stringMalloc(size_t size)
-{
- return bmalloc::api::malloc(size, bmalloc::HeapKind::StringGigacage);
-}
-
-void* stringRealloc(void* p, size_t size)
-{
- return bmalloc::api::realloc(p, size, bmalloc::HeapKind::StringGigacage);
-}
-
-void stringFree(void* p)
-{
- if (!p)
- return;
- if (UNLIKELY(!Gigacage::isCaged(Gigacage::String, p))) {
- dataLog("Trying to free string that is not caged: ", RawPointer(p), "\n");
- RELEASE_ASSERT_NOT_REACHED();
- }
- bmalloc::api::free(p, bmalloc::HeapKind::StringGigacage);
-}
-#endif
-
-} // namespace WTF
-
Deleted: trunk/Source/WTF/wtf/text/StringMalloc.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringMalloc.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringMalloc.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,83 +0,0 @@
-/*
- * 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
- * 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/FastMalloc.h>
-
-namespace WTF {
-
-WTF_EXPORT_PRIVATE void* tryStringMalloc(size_t);
-WTF_EXPORT_PRIVATE void* stringMalloc(size_t);
-WTF_EXPORT_PRIVATE void* stringRealloc(void*, size_t);
-WTF_EXPORT_PRIVATE void stringFree(void*);
-
-#define WTF_MAKE_STRING_ALLOCATED \
-public: \
- void* operator new(size_t, void* p) { return p; } \
- void* operator new[](size_t, void* p) { return p; } \
- \
- void* operator new(size_t size) \
- { \
- return ::WTF::stringMalloc(size); \
- } \
- \
- void operator delete(void* p) \
- { \
- ::WTF::stringFree(p); \
- } \
- \
- void* operator new[](size_t size) \
- { \
- return ::WTF::stringMalloc(size); \
- } \
- \
- void operator delete[](void* p) \
- { \
- ::WTF::stringFree(p); \
- } \
- void* operator new(size_t, NotNullTag, void* location) \
- { \
- ASSERT(location); \
- return location; \
- } \
-private: \
-typedef int __thisIsHereToForceASemicolonAfterThisMacro
-
-
-struct StringMalloc {
- static void* malloc(size_t size) { return stringMalloc(size); }
- static void* tryMalloc(size_t size) { return tryStringMalloc(size); }
- static void* realloc(void* p, size_t size) { return stringRealloc(p, size); }
- static void free(void* p) { stringFree(p); }
-};
-
-} // namespace WTF
-
-using WTF::StringMalloc;
-using WTF::stringMalloc;
-using WTF::stringRealloc;
-using WTF::stringFree;
-using WTF::tryStringMalloc;
Deleted: trunk/Source/WTF/wtf/text/StringVector.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/StringVector.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/StringVector.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,37 +0,0 @@
-/*
- * 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
- * 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/Vector.h>
-#include <wtf/text/StringMalloc.h>
-
-namespace WTF {
-
-template<typename T, size_t inlineCapacity = 0, typename OverflowHandler = CrashOnOverflow, size_t minCapacity = 16> using StringVector = Vector<T, inlineCapacity, OverflowHandler, minCapacity, StringMalloc>;
-
-} // namespace WTF
-
-using WTF::StringVector;
Modified: trunk/Source/WTF/wtf/text/SymbolImpl.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/SymbolImpl.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/SymbolImpl.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -202,7 +202,7 @@
#if !ASSERT_DISABLED
// SymbolImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
-// as they are not allocated by stringMalloc.
+// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
// so we ignore the consistency check for all SymbolImpls*.
template<> struct
Modified: trunk/Source/WTF/wtf/text/UniquedStringImpl.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/UniquedStringImpl.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/UniquedStringImpl.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -44,7 +44,7 @@
#if !ASSERT_DISABLED
// UniquedStringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
-// as they are not allocated by stringMalloc.
+// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
// so we ignore the consistency check for all UniquedStringImpls*.
template<> struct
Modified: trunk/Source/WTF/wtf/text/WTFString.h (221401 => 221402)
--- trunk/Source/WTF/wtf/text/WTFString.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -146,8 +146,8 @@
static String adopt(StringBuffer<LChar>&& buffer) { return StringImpl::adopt(WTFMove(buffer)); }
static String adopt(StringBuffer<UChar>&& buffer) { return StringImpl::adopt(WTFMove(buffer)); }
- template<typename CharacterType, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity>
- static String adopt(StringVector<CharacterType, inlineCapacity, OverflowHandler, minCapacity>&& vector) { return StringImpl::adopt(WTFMove(vector)); }
+ template<typename CharacterType, size_t inlineCapacity, typename OverflowHandler>
+ static String adopt(Vector<CharacterType, inlineCapacity, OverflowHandler>&& vector) { return StringImpl::adopt(WTFMove(vector)); }
bool isNull() const { return !m_impl; }
bool isEmpty() const { return !m_impl || !m_impl->length(); }
@@ -499,19 +499,7 @@
if (m_impl && m_impl->hasOneRef())
m_impl = nullptr;
}
-
- void assertCaged() const
- {
- if (m_impl)
- m_impl->assertCaged();
- }
- void releaseAssertCaged() const
- {
- if (m_impl)
- m_impl->releaseAssertCaged();
- }
-
private:
template <typename CharacterType>
void removeInternal(const CharacterType*, unsigned, int);
Modified: trunk/Source/WebCore/ChangeLog (221401 => 221402)
--- trunk/Source/WebCore/ChangeLog 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/ChangeLog 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,3 +1,15 @@
+2017-08-30 Matt Lewis <jlew...@apple.com>
+
+ Unreviewed, rolling out r221384.
+
+ This patch caused multiple 32-bit JSC test failures.
+
+ Reverted changeset:
+
+ "Strings need to be in some kind of gigacage"
+ https://bugs.webkit.org/show_bug.cgi?id=174924
+ http://trac.webkit.org/changeset/221384
+
2017-08-30 Brady Eidson <beid...@apple.com>
Add "Identified" base class to replace a whole bunch of custom identifier generators.
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp (221401 => 221402)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBSerialization.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -326,7 +326,7 @@
if (static_cast<uint64_t>(end - data) < length * 2)
return false;
- StringVector<UChar> buffer;
+ Vector<UChar> buffer;
buffer.reserveInitialCapacity(length);
for (size_t i = 0; i < length; i++) {
uint16_t ch;
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (221401 => 221402)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1950,7 +1950,7 @@
str = String(reinterpret_cast<const UChar*>(ptr), length);
ptr += length * sizeof(UChar);
#else
- StringVector<UChar> buffer;
+ Vector<UChar> buffer;
buffer.reserveCapacity(length);
for (unsigned i = 0; i < length; i++) {
uint16_t ch;
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (221401 => 221402)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -2325,7 +2325,7 @@
return;
unsigned textLength = text.length();
- StringVector<UChar> charVector(textLength);
+ Vector<UChar> charVector(textLength);
StringView(text).getCharactersWithUpconvert(charVector.data());
charVector[i++] = ' ';
Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (221401 => 221402)
--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -205,7 +205,7 @@
String takeRemainingWhitespace()
{
ASSERT(!isEmpty());
- StringVector<LChar, 8> whitespace;
+ Vector<LChar, 8> whitespace;
do {
UChar character = m_text[0];
if (isHTMLSpace(character))
Modified: trunk/Source/WebCore/platform/URLParser.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/URLParser.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -533,7 +533,7 @@
return !isSlashQuestionOrHash(*iterator);
}
-static void percentEncodeByte(uint8_t byte, StringVector<LChar>& buffer)
+static void percentEncodeByte(uint8_t byte, Vector<LChar>& buffer)
{
buffer.append('%');
buffer.append(upperNibbleToASCIIHexDigit(byte));
@@ -2814,7 +2814,7 @@
return output;
}
-static void serializeURLEncodedForm(const String& input, StringVector<LChar>& output)
+static void serializeURLEncodedForm(const String& input, Vector<LChar>& output)
{
auto utf8 = input.utf8(StrictConversion);
const char* data = ""
@@ -2840,7 +2840,7 @@
if (tuples.isEmpty())
return { };
- StringVector<LChar> output;
+ Vector<LChar> output;
for (auto& tuple : tuples) {
if (!output.isEmpty())
output.append('&');
Modified: trunk/Source/WebCore/platform/URLParser.h (221401 => 221402)
--- trunk/Source/WebCore/platform/URLParser.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/URLParser.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -58,7 +58,7 @@
friend std::optional<uint16_t> defaultPortForProtocol(StringView);
URL m_url;
- StringVector<LChar> m_asciiBuffer;
+ Vector<LChar> m_asciiBuffer;
bool m_urlIsSpecial { false };
bool m_urlIsFile { false };
bool m_hostHasPercentOrNonASCII { false };
Modified: trunk/Source/WebCore/platform/graphics/FourCC.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/graphics/FourCC.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/graphics/FourCC.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -42,7 +42,7 @@
String FourCC::toString() const
{
- StringVector<LChar, 4> data = {
+ Vector<LChar, 4> data = {
LChar(value >> 24),
LChar((value >> 16) & 0xFF),
LChar((value >> 8) & 0xFF),
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -2698,7 +2698,7 @@
const size_t bitsPerUChar = sizeof(UChar) * 8;
size_t vectorSize = (depth + bitsPerUChar - 1) / bitsPerUChar;
- StringVector<UChar> result(vectorSize);
+ Vector<UChar> result(vectorSize);
result.fill(0);
// Create a string from the bit sequence which we can use to identify the clone.
Modified: trunk/Source/WebCore/platform/text/LocaleICU.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/text/LocaleICU.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/text/LocaleICU.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -73,7 +73,7 @@
ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
return String();
- StringVector<UChar> buffer(bufferLength);
+ Vector<UChar> buffer(bufferLength);
status = U_ZERO_ERROR;
unum_getSymbol(m_numberFormat, symbol, buffer.data(), bufferLength, &status);
if (U_FAILURE(status))
@@ -88,7 +88,7 @@
ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
return String();
- StringVector<UChar> buffer(bufferLength);
+ Vector<UChar> buffer(bufferLength);
status = U_ZERO_ERROR;
unum_getTextAttribute(m_numberFormat, tag, buffer.data(), bufferLength, &status);
ASSERT(U_SUCCESS(status));
@@ -153,7 +153,7 @@
int32_t length = udat_toPattern(dateFormat, TRUE, 0, 0, &status);
if (status != U_BUFFER_OVERFLOW_ERROR || !length)
return emptyString();
- StringVector<UChar> buffer(length);
+ Vector<UChar> buffer(length);
status = U_ZERO_ERROR;
udat_toPattern(dateFormat, TRUE, buffer.data(), length, &status);
if (U_FAILURE(status))
@@ -175,7 +175,7 @@
int32_t length = udat_getSymbols(dateFormat, type, startIndex + i, 0, 0, &status);
if (status != U_BUFFER_OVERFLOW_ERROR)
return std::make_unique<Vector<String>>();
- StringVector<UChar> buffer(length);
+ Vector<UChar> buffer(length);
status = U_ZERO_ERROR;
udat_getSymbols(dateFormat, type, startIndex + i, buffer.data(), length, &status);
if (U_FAILURE(status))
@@ -266,7 +266,7 @@
status = U_ZERO_ERROR;
int32_t length = udatpg_getBestPattern(patternGenerator, skeleton, skeletonLength, 0, 0, &status);
if (status == U_BUFFER_OVERFLOW_ERROR && length) {
- StringVector<UChar> buffer(length);
+ Vector<UChar> buffer(length);
status = U_ZERO_ERROR;
udatpg_getBestPattern(patternGenerator, skeleton, skeletonLength, buffer.data(), length, &status);
if (U_SUCCESS(status))
Modified: trunk/Source/WebCore/platform/text/mac/TextCodecMac.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/text/mac/TextCodecMac.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/text/mac/TextCodecMac.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -201,7 +201,7 @@
if (!m_converterTEC && createTECConverter() != noErr)
return String();
- StringVector<UChar> result;
+ Vector<UChar> result;
const unsigned char* sourcePointer = reinterpret_cast<const unsigned char*>(bytes);
int sourceLength = length;
Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (221401 => 221402)
--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -185,7 +185,7 @@
String pathByAppendingComponent(const String& path, const String& component)
{
- StringVector<UChar> buffer(MAX_PATH);
+ Vector<UChar> buffer(MAX_PATH);
if (path.length() + 1 > buffer.size())
return String();
@@ -276,7 +276,7 @@
static String storageDirectory(DWORD pathIdentifier)
{
- StringVector<UChar> buffer(MAX_PATH);
+ Vector<UChar> buffer(MAX_PATH);
if (FAILED(SHGetFolderPathW(0, pathIdentifier | CSIDL_FLAG_CREATE, 0, 0, buffer.data())))
return String();
buffer.resize(wcslen(buffer.data()));
Modified: trunk/Source/bmalloc/ChangeLog (221401 => 221402)
--- trunk/Source/bmalloc/ChangeLog 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/bmalloc/ChangeLog 2017-08-30 22:48:08 UTC (rev 221402)
@@ -1,3 +1,15 @@
+2017-08-30 Matt Lewis <jlew...@apple.com>
+
+ Unreviewed, rolling out r221384.
+
+ This patch caused multiple 32-bit JSC test failures.
+
+ Reverted changeset:
+
+ "Strings need to be in some kind of gigacage"
+ https://bugs.webkit.org/show_bug.cgi?id=174924
+ http://trac.webkit.org/changeset/221384
+
2017-08-22 Filip Pizlo <fpi...@apple.com>
Strings need to be in some kind of gigacage
Modified: trunk/Source/bmalloc/bmalloc/Gigacage.cpp (221401 => 221402)
--- trunk/Source/bmalloc/bmalloc/Gigacage.cpp 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/bmalloc/bmalloc/Gigacage.cpp 2017-08-30 22:48:08 UTC (rev 221402)
@@ -36,7 +36,6 @@
// https://bugs.webkit.org/show_bug.cgi?id=174972
void* g_primitiveGigacageBasePtr;
void* g_jsValueGigacageBasePtr;
-void* g_stringGigacageBasePtr;
using namespace bmalloc;
Modified: trunk/Source/bmalloc/bmalloc/Gigacage.h (221401 => 221402)
--- trunk/Source/bmalloc/bmalloc/Gigacage.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/bmalloc/bmalloc/Gigacage.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -34,13 +34,11 @@
#define PRIMITIVE_GIGACAGE_SIZE 0x800000000llu
#define JSVALUE_GIGACAGE_SIZE 0x400000000llu
-#define STRING_GIGACAGE_SIZE 0x400000000llu
#define GIGACAGE_SIZE_TO_MASK(size) ((size) - 1)
#define PRIMITIVE_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(PRIMITIVE_GIGACAGE_SIZE)
#define JSVALUE_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(JSVALUE_GIGACAGE_SIZE)
-#define STRING_GIGACAGE_MASK GIGACAGE_SIZE_TO_MASK(STRING_GIGACAGE_SIZE)
// FIXME: Consider making this 32GB, in case unsigned 32-bit indices find their way into indexed accesses.
// https://bugs.webkit.org/show_bug.cgi?id=175062
@@ -49,7 +47,6 @@
// FIXME: Reconsider this.
// https://bugs.webkit.org/show_bug.cgi?id=175921
#define JSVALUE_GIGACAGE_RUNWAY 0
-#define STRING_GIGACAGE_RUNWAY 0
#if BOS(DARWIN) && BCPU(X86_64)
#define GIGACAGE_ENABLED 1
@@ -59,14 +56,12 @@
extern "C" BEXPORT void* g_primitiveGigacageBasePtr;
extern "C" BEXPORT void* g_jsValueGigacageBasePtr;
-extern "C" BEXPORT void* g_stringGigacageBasePtr;
namespace Gigacage {
enum Kind {
Primitive,
- JSValue,
- String
+ JSValue
};
BEXPORT void ensureGigacage();
@@ -90,8 +85,6 @@
return "Primitive";
case JSValue:
return "JSValue";
- case String:
- return "String";
}
BCRASH();
return nullptr;
@@ -104,8 +97,6 @@
return g_primitiveGigacageBasePtr;
case JSValue:
return g_jsValueGigacageBasePtr;
- case String:
- return g_stringGigacageBasePtr;
}
BCRASH();
return g_primitiveGigacageBasePtr;
@@ -118,8 +109,6 @@
return static_cast<size_t>(PRIMITIVE_GIGACAGE_SIZE);
case JSValue:
return static_cast<size_t>(JSVALUE_GIGACAGE_SIZE);
- case String:
- return static_cast<size_t>(STRING_GIGACAGE_SIZE);
}
BCRASH();
return 0;
@@ -142,8 +131,6 @@
return static_cast<size_t>(PRIMITIVE_GIGACAGE_RUNWAY);
case JSValue:
return static_cast<size_t>(JSVALUE_GIGACAGE_RUNWAY);
- case String:
- return static_cast<size_t>(STRING_GIGACAGE_RUNWAY);
}
BCRASH();
return 0;
@@ -159,7 +146,6 @@
{
func(Primitive);
func(JSValue);
- func(String);
}
template<typename T>
Modified: trunk/Source/bmalloc/bmalloc/HeapKind.h (221401 => 221402)
--- trunk/Source/bmalloc/bmalloc/HeapKind.h 2017-08-30 22:45:26 UTC (rev 221401)
+++ trunk/Source/bmalloc/bmalloc/HeapKind.h 2017-08-30 22:48:08 UTC (rev 221402)
@@ -34,11 +34,10 @@
enum class HeapKind {
Primary,
PrimitiveGigacage,
- JSValueGigacage,
- StringGigacage
+ JSValueGigacage
};
-static constexpr unsigned numHeaps = 4;
+static constexpr unsigned numHeaps = 3;
BINLINE bool isGigacage(HeapKind heapKind)
{
@@ -47,7 +46,6 @@
return false;
case HeapKind::PrimitiveGigacage:
case HeapKind::JSValueGigacage:
- case HeapKind::StringGigacage:
return true;
}
BCRASH();
@@ -64,8 +62,6 @@
return Gigacage::Primitive;
case HeapKind::JSValueGigacage:
return Gigacage::JSValue;
- case HeapKind::StringGigacage:
- return Gigacage::String;
}
BCRASH();
return Gigacage::Primitive;
@@ -78,8 +74,6 @@
return HeapKind::PrimitiveGigacage;
case Gigacage::JSValue:
return HeapKind::JSValueGigacage;
- case Gigacage::String:
- return HeapKind::StringGigacage;
}
BCRASH();
return HeapKind::Primary;
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes