Diff
Modified: trunk/Source/WTF/ChangeLog (149962 => 149963)
--- trunk/Source/WTF/ChangeLog 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/ChangeLog 2013-05-12 16:45:26 UTC (rev 149963)
@@ -1,3 +1,26 @@
+2013-05-12 Anders Carlsson <[email protected]>
+
+ Move RemoteMemoryReader into FastMalloc.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=115985
+
+ Reviewed by Andreas Kling.
+
+ RemoteMemoryReader is only used in FastMalloc.cpp, and even had one of its member functions
+ implemented there, so move the entire class template there and remove MallocZoneSupport.h.
+
+ * GNUmakefile.list.am:
+ * WTF.pro:
+ * WTF.vcproj/WTF.vcproj:
+ * WTF.vcxproj/WTF.vcxproj:
+ * WTF.vcxproj/WTF.vcxproj.filters:
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/FastMalloc.cpp:
+ (WTF):
+ (PageHeapAllocator):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ * wtf/MallocZoneSupport.h: Removed.
+
2013-05-10 Laszlo Gombos <[email protected]>
Remove USE(OS_RANDOMNESS)
Modified: trunk/Source/WTF/GNUmakefile.list.am (149962 => 149963)
--- trunk/Source/WTF/GNUmakefile.list.am 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/GNUmakefile.list.am 2013-05-12 16:45:26 UTC (rev 149963)
@@ -83,7 +83,6 @@
Source/WTF/wtf/MD5.h \
Source/WTF/wtf/MainThread.cpp \
Source/WTF/wtf/MainThread.h \
- Source/WTF/wtf/MallocZoneSupport.h \
Source/WTF/wtf/MathExtras.h \
Source/WTF/wtf/MediaTime.h \
Source/WTF/wtf/MediaTime.cpp \
Modified: trunk/Source/WTF/WTF.pro (149962 => 149963)
--- trunk/Source/WTF/WTF.pro 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/WTF.pro 2013-05-12 16:45:26 UTC (rev 149963)
@@ -85,7 +85,6 @@
ListHashSet.h \
Locker.h \
MainThread.h \
- MallocZoneSupport.h \
MathExtras.h \
MD5.h \
MediaTime.h \
Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (149962 => 149963)
--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj 2013-05-12 16:45:26 UTC (rev 149963)
@@ -903,10 +903,6 @@
>
</File>
<File
- RelativePath="..\wtf\MallocZoneSupport.h"
- >
- </File>
- <File
RelativePath="..\wtf\MathExtras.h"
>
</File>
Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (149962 => 149963)
--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2013-05-12 16:45:26 UTC (rev 149963)
@@ -161,7 +161,6 @@
<ClInclude Include="..\wtf\ListHashSet.h" />
<ClInclude Include="..\wtf\Locker.h" />
<ClInclude Include="..\wtf\MainThread.h" />
- <ClInclude Include="..\wtf\MallocZoneSupport.h" />
<ClInclude Include="..\wtf\MathExtras.h" />
<ClInclude Include="..\wtf\MD5.h" />
<ClInclude Include="..\wtf\MediaTime.h" />
Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (149962 => 149963)
--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters 2013-05-12 16:45:26 UTC (rev 149963)
@@ -486,9 +486,6 @@
<ClInclude Include="..\wtf\MainThread.h">
<Filter>wtf</Filter>
</ClInclude>
- <ClInclude Include="..\wtf\MallocZoneSupport.h">
- <Filter>wtf</Filter>
- </ClInclude>
<ClInclude Include="..\wtf\MathExtras.h">
<Filter>wtf</Filter>
</ClInclude>
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (149962 => 149963)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-05-12 16:45:26 UTC (rev 149963)
@@ -142,7 +142,6 @@
A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C5151A825A004123FF /* MainThreadMac.mm */; };
A8A473E5151A825B004123FF /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C6151A825A004123FF /* MainThread.cpp */; };
A8A473E6151A825B004123FF /* MainThread.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C7151A825B004123FF /* MainThread.h */; };
- A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C8151A825B004123FF /* MallocZoneSupport.h */; };
A8A473E8151A825B004123FF /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C9151A825B004123FF /* MathExtras.h */; };
A8A473E9151A825B004123FF /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472CA151A825B004123FF /* MD5.cpp */; };
A8A473EA151A825B004123FF /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472CB151A825B004123FF /* MD5.h */; };
@@ -416,7 +415,6 @@
A8A472C5151A825A004123FF /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
A8A472C6151A825A004123FF /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
A8A472C7151A825B004123FF /* MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThread.h; sourceTree = "<group>"; };
- A8A472C8151A825B004123FF /* MallocZoneSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MallocZoneSupport.h; sourceTree = "<group>"; };
A8A472C9151A825B004123FF /* MathExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathExtras.h; sourceTree = "<group>"; };
A8A472CA151A825B004123FF /* MD5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MD5.cpp; sourceTree = "<group>"; };
A8A472CB151A825B004123FF /* MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MD5.h; sourceTree = "<group>"; };
@@ -688,7 +686,6 @@
A8A472C3151A825A004123FF /* Locker.h */,
A8A472C6151A825A004123FF /* MainThread.cpp */,
A8A472C7151A825B004123FF /* MainThread.h */,
- A8A472C8151A825B004123FF /* MallocZoneSupport.h */,
A8A472C9151A825B004123FF /* MathExtras.h */,
A8A472CA151A825B004123FF /* MD5.cpp */,
A8A472CB151A825B004123FF /* MD5.h */,
@@ -999,7 +996,6 @@
A8A473E1151A825B004123FF /* ListHashSet.h in Headers */,
A8A473E3151A825B004123FF /* Locker.h in Headers */,
A8A473E6151A825B004123FF /* MainThread.h in Headers */,
- A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */,
A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
A8A473EA151A825B004123FF /* MD5.h in Headers */,
CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (149962 => 149963)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2013-05-12 16:45:26 UTC (rev 149963)
@@ -45,7 +45,6 @@
Locker.h
MD5.h
MainThread.h
- MallocZoneSupport.h
MathExtras.h
MediaTime.h
MessageQueue.h
Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (149962 => 149963)
--- trunk/Source/WTF/wtf/FastMalloc.cpp 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp 2013-05-12 16:45:26 UTC (rev 149963)
@@ -90,6 +90,10 @@
#include <wtf/StdLibExtras.h>
#include <wtf/UnusedParam.h>
+#if OS(DARWIN)
+#include <malloc/malloc.h>
+#endif
+
#ifndef NO_TCMALLOC_SAMPLES
#ifdef WTF_CHANGES
#define NO_TCMALLOC_SAMPLES
@@ -231,9 +235,7 @@
#if FORCE_SYSTEM_MALLOC
-#if OS(DARWIN)
-#include <malloc/malloc.h>
-#elif OS(WINDOWS)
+#if OS(WINDOWS)
#include <malloc.h>
#endif
@@ -452,7 +454,6 @@
#ifdef WTF_CHANGES
#if OS(DARWIN)
-#include "MallocZoneSupport.h"
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
#endif
@@ -1059,6 +1060,10 @@
return result;
}
+#if defined(WTF_CHANGES) && OS(DARWIN)
+class RemoteMemoryReader;
+#endif
+
template <class T>
class PageHeapAllocator {
private:
@@ -1131,12 +1136,8 @@
int inuse() const { return inuse_; }
#if defined(WTF_CHANGES) && OS(DARWIN)
- template <class Recorder>
- void recordAdministrativeRegions(Recorder& recorder, const RemoteMemoryReader& reader)
- {
- for (HardenedSLL adminAllocation = allocated_regions_; adminAllocation; adminAllocation.setValue(reader.nextEntryInHardenedLinkedList(reinterpret_cast<void**>(adminAllocation.value()), entropy_)))
- recorder.recordRegion(reinterpret_cast<vm_address_t>(adminAllocation.value()), kAllocIncrement);
- }
+ template <typename Recorder>
+ void recordAdministrativeRegions(Recorder&, const RemoteMemoryReader&);
#endif
};
@@ -4681,17 +4682,50 @@
}
#if OS(DARWIN)
+class RemoteMemoryReader {
+ task_t m_task;
+ memory_reader_t* m_reader;
+public:
+ RemoteMemoryReader(task_t task, memory_reader_t* reader)
+ : m_task(task)
+ , m_reader(reader)
+ { }
+
+ void* operator()(vm_address_t address, size_t size) const
+ {
+ void* output;
+ kern_return_t err = (*m_reader)(m_task, address, size, static_cast<void**>(&output));
+ if (err)
+ output = 0;
+ return output;
+ }
+
+ template <typename T>
+ T* operator()(T* address, size_t size = sizeof(T)) const
+ {
+ return static_cast<T*>((*this)(reinterpret_cast<vm_address_t>(address), size));
+ }
+
+ template <typename T>
+ T* nextEntryInHardenedLinkedList(T** remoteAddress, uintptr_t entropy) const
+ {
+ T** localAddress = (*this)(remoteAddress);
+ if (!localAddress)
+ return 0;
+ T* hardenedNext = *localAddress;
+ if (!hardenedNext || hardenedNext == (void*)entropy)
+ return 0;
+ return XOR_MASK_PTR_WITH_KEY(hardenedNext, remoteAddress, entropy);
+ }
+};
+
template <typename T>
-T* RemoteMemoryReader::nextEntryInHardenedLinkedList(T** remoteAddress, uintptr_t entropy) const
+template <typename Recorder>
+void PageHeapAllocator<T>::recordAdministrativeRegions(Recorder& recorder, const RemoteMemoryReader& reader)
{
- T** localAddress = (*this)(remoteAddress);
- if (!localAddress)
- return 0;
- T* hardenedNext = *localAddress;
- if (!hardenedNext || hardenedNext == (void*)entropy)
- return 0;
- return XOR_MASK_PTR_WITH_KEY(hardenedNext, remoteAddress, entropy);
+ for (HardenedSLL adminAllocation = allocated_regions_; adminAllocation; adminAllocation.setValue(reader.nextEntryInHardenedLinkedList(reinterpret_cast<void**>(adminAllocation.value()), entropy_)))
+ recorder.recordRegion(reinterpret_cast<vm_address_t>(adminAllocation.value()), kAllocIncrement);
}
class FreeObjectFinder {
Deleted: trunk/Source/WTF/wtf/MallocZoneSupport.h (149962 => 149963)
--- trunk/Source/WTF/wtf/MallocZoneSupport.h 2013-05-12 16:33:15 UTC (rev 149962)
+++ trunk/Source/WTF/wtf/MallocZoneSupport.h 2013-05-12 16:45:26 UTC (rev 149963)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#ifndef MallocZoneSupport_h
-#define MallocZoneSupport_h
-
-#include <malloc/malloc.h>
-
-namespace WTF {
-
-class RemoteMemoryReader {
- task_t m_task;
- memory_reader_t* m_reader;
-
-public:
- RemoteMemoryReader(task_t task, memory_reader_t* reader)
- : m_task(task)
- , m_reader(reader)
- { }
-
- void* operator()(vm_address_t address, size_t size) const
- {
- void* output;
- kern_return_t err = (*m_reader)(m_task, address, size, static_cast<void**>(&output));
- if (err)
- output = 0;
- return output;
- }
-
- template <typename T>
- T* operator()(T* address, size_t size=sizeof(T)) const
- {
- return static_cast<T*>((*this)(reinterpret_cast<vm_address_t>(address), size));
- }
-
- template <typename T>
- T* nextEntryInHardenedLinkedList(T** address, uintptr_t entropy) const;
-};
-
-} // namespace WTF
-
-#endif // MallocZoneSupport_h