Changeset 179923 in webkit
- Timestamp:
- Feb 11, 2015 4:15:23 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r179251 r179923 5 5 # Default library type 6 6 # ----------------------------------------------------------------------------- 7 set(BMALLOC_DIR "${CMAKE_SOURCE_DIR}/Source/bmalloc") 7 8 set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF") 8 9 set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore") -
trunk/ChangeLog
r179922 r179923 1 2015-02-11 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 3 [EFL][GTK] Use bmalloc instead of tcmalloc 4 https://bugs.webkit.org/show_bug.cgi?id=140162 5 6 Reviewed by Carlos Garcia Campos. 7 8 Add bmalloc directory to build list. 9 10 * CMakeLists.txt: Define BMALLOC_DIR directory. 11 * Source/CMakeLists.txt: Add bmalloc path to sub-directories list. 12 1 13 2015-02-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/Source/CMakeLists.txt
r172902 r179923 2 2 # Add module directories 3 3 # ----------------------------------------------------------------------------- 4 add_subdirectory(bmalloc) 5 4 6 add_subdirectory(WTF) 5 7 … … 27 29 # Set compiler flags for all targets 28 30 # ----------------------------------------------------------------------------- 31 WEBKIT_SET_EXTRA_COMPILER_FLAGS(bmalloc ${ADDITIONAL_COMPILER_FLAGS}) 29 32 WEBKIT_SET_EXTRA_COMPILER_FLAGS(WTF ${ADDITIONAL_COMPILER_FLAGS}) 30 33 WEBKIT_SET_EXTRA_COMPILER_FLAGS(JavaScriptCore ${ADDITIONAL_COMPILER_FLAGS}) -
trunk/Source/WTF/ChangeLog
r179915 r179923 1 2015-02-11 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 3 [EFL][GTK] Use bmalloc instead of tcmalloc 4 https://bugs.webkit.org/show_bug.cgi?id=140162 5 6 Reviewed by Carlos Garcia Campos. 7 8 * wtf/CMakeLists.txt: 9 * wtf/FastMalloc.cpp: 10 Enable bmalloc on GTK ports, but EFL port will enable it when bmalloc supports 11 memory statistics. 12 1 13 2015-02-10 Darin Adler <darin@apple.com> 2 14 -
trunk/Source/WTF/wtf/CMakeLists.txt
r177455 r179923 214 214 215 215 set(WTF_INCLUDE_DIRECTORIES 216 "${BMALLOC_DIR}" 216 217 "${WTF_DIR}" 217 218 "${WTF_DIR}/wtf" … … 227 228 set(WTF_LIBRARIES 228 229 ${CMAKE_DL_LIBS} 230 bmalloc 229 231 ) 230 232 -
trunk/Source/WTF/wtf/FastMalloc.cpp
r179915 r179923 101 101 #endif 102 102 103 #if PLATFORM(COCOA) 103 #if PLATFORM(COCOA) || PLATFORM(GTK) 104 104 #define USE_BMALLOC 1 105 105 #endif -
trunk/Source/bmalloc/ChangeLog
r179450 r179923 1 2015-02-11 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 3 [EFL][GTK] Use bmalloc instead of tcmalloc 4 https://bugs.webkit.org/show_bug.cgi?id=140162 5 6 Reviewed by Carlos Garcia Campos. 7 8 Support to use bmalloc on EFL and GTK ports. 9 10 * CMakeLists.txt: Added. 11 * bmalloc/Allocator.cpp: 12 (bmalloc::Allocator::allocate): 13 Fix unused return value caused by posix_memalign(). 14 * bmalloc/AsyncTask.h: 15 * bmalloc/BoundaryTag.h: 16 (bmalloc::BoundaryTag::clear): 17 * bmalloc/Chunk.h: 18 Change Traits::Page with Traits::PageType in order to fix 19 -fpermitive build error on EFL and GTK port. 20 * bmalloc/EndTag.h: 21 (bmalloc::EndTag::operator=): 22 * bmalloc/Line.h: ditto. 23 * bmalloc/MediumTraits.h: 24 * bmalloc/Page.h: ditto. 25 * bmalloc/PerThread.h: 26 EFL port doesn't support __has_include definition yet. 27 Define HAVE_PTHREAD_MACHDEP_H according to check if __has_include is supported. 28 * bmalloc/SmallTraits.h: ditto. 29 * bmalloc/VMAllocate.h: 30 (bmalloc::vmDeallocatePhysicalPages): 31 (bmalloc::vmAllocatePhysicalPages): 32 * bmalloc/Vector.h: 33 (bmalloc::Vector<T>::push): 34 (bmalloc::Vector<T>::reallocateBuffer): 35 1 36 2015-01-31 Sam Weinig <sam@webkit.org> 2 37 -
trunk/Source/bmalloc/bmalloc/Allocator.cpp
r178861 r179923 57 57 if (!m_isBmallocEnabled) { 58 58 void* result = nullptr; 59 posix_memalign(&result, alignment, size); 59 if (posix_memalign(&result, alignment, size)) 60 return nullptr; 60 61 return result; 61 62 } -
trunk/Source/bmalloc/bmalloc/AsyncTask.h
r167540 r179923 65 65 }; 66 66 67 template<typename Object, typename Function> const std::chrono::seconds AsyncTask<Object, Function>::exitDelay;67 template<typename Object, typename Function> const constexpr std::chrono::seconds AsyncTask<Object, Function>::exitDelay; 68 68 69 69 template<typename Object, typename Function> -
trunk/Source/bmalloc/bmalloc/BoundaryTag.h
r178861 r179923 30 30 #include "Range.h" 31 31 #include "Sizes.h" 32 #include <cstring> 32 33 33 34 namespace bmalloc { … … 55 56 56 57 bool isNull() { return !m_size; } 57 void clear() { memset(this, 0, sizeof(*this)); }58 void clear() { std::memset(this, 0, sizeof(*this)); } 58 59 59 60 size_t size() { return m_size; } -
trunk/Source/bmalloc/bmalloc/Chunk.h
r175751 r179923 36 36 class Chunk { 37 37 public: 38 typedef typename Traits::Page Page; 39 typedef typename Traits::Line Line; 38 typedef typename Traits::PageType Page; 39 typedef typename Traits::LineType Line; 40 40 41 static const size_t lineSize = Traits::lineSize; 41 42 static const size_t chunkSize = Traits::chunkSize; … … 63 64 // Align to vmPageSize to avoid sharing physical pages with metadata. 64 65 // Otherwise, we'll confuse the scavenger into trying to scavenge metadata. 65 alignas(vmPageSize) char m_memory[]; 66 #if BPLATFORM(IOS) 67 char m_memory[] __attribute__((aligned(16384))); 68 static_assert(vmPageSize == 16384, "vmPageSize and alignment must be same"); 69 #else 70 char m_memory[] __attribute__((aligned(4096))); 71 static_assert(vmPageSize == 4096, "vmPageSize and alignment must be same"); 72 #endif 66 73 }; 67 74 -
trunk/Source/bmalloc/bmalloc/EndTag.h
r166893 r179923 38 38 inline EndTag& EndTag::operator=(const BeginTag& other) 39 39 { 40 memcpy(this, &other, sizeof(BoundaryTag));40 std::memcpy(this, &other, sizeof(BoundaryTag)); 41 41 setEnd(true); 42 42 return *this; -
trunk/Source/bmalloc/bmalloc/LargeChunk.h
r175751 r179923 68 68 // Align to vmPageSize to avoid sharing physical pages with metadata. 69 69 // Otherwise, we'll confuse the scavenger into trying to scavenge metadata. 70 alignas(vmPageSize) char m_memory[]; 70 #if BPLATFORM(IOS) 71 char m_memory[] __attribute__((aligned(16384))); 72 static_assert(vmPageSize == 16384, "vmPageSize and alignment must be same"); 73 #else 74 char m_memory[] __attribute__((aligned(4096))); 75 static_assert(vmPageSize == 4096, "vmPageSize and alignment must be same"); 76 #endif 71 77 }; 72 78 -
trunk/Source/bmalloc/bmalloc/Line.h
r173881 r179923 37 37 class Line { 38 38 public: 39 typedef typename Traits::Chunk Chunk; 39 typedef typename Traits::ChunkType Chunk; 40 40 41 static const size_t minimumObjectSize = Traits::minimumObjectSize; 41 42 static const size_t lineSize = Traits::lineSize; -
trunk/Source/bmalloc/bmalloc/MediumTraits.h
r166893 r179923 37 37 38 38 struct MediumTraits { 39 typedef Chunk<MediumTraits> Chunk ;40 typedef Line<MediumTraits> Line ;41 typedef Page<MediumTraits> Page ;39 typedef Chunk<MediumTraits> ChunkType; 40 typedef Line<MediumTraits> LineType; 41 typedef Page<MediumTraits> PageType; 42 42 43 43 static const size_t lineSize = mediumLineSize; -
trunk/Source/bmalloc/bmalloc/Page.h
r173881 r179923 37 37 class Page { 38 38 public: 39 typedef typename Traits::Chunk Chunk; 40 typedef typename Traits::Line Line; 39 typedef typename Traits::ChunkType Chunk; 40 typedef typename Traits::LineType Line; 41 41 42 static const size_t lineSize = Traits::lineSize; 42 43 static const size_t lineCount = vmPageSize / lineSize; -
trunk/Source/bmalloc/bmalloc/PerThread.h
r177931 r179923 31 31 #include <mutex> 32 32 #include <pthread.h> 33 #if defined(__has_include) && __has_include(<System/pthread_machdep.h>) 33 34 #if defined(__has_include) 35 #if __has_include(<System/pthread_machdep.h>) 34 36 #include <System/pthread_machdep.h> 37 #define HAVE_PTHREAD_MACHDEP_H 1 38 #else 39 #define HAVE_PTHREAD_MACHDEP_H 0 40 #endif 41 #else 42 #define HAVE_PTHREAD_MACHDEP_H 0 35 43 #endif 36 44 … … 51 59 }; 52 60 53 #if defined(__has_include) && __has_include(<System/pthread_machdep.h>)61 #if HAVE_PTHREAD_MACHDEP_H 54 62 55 63 class Cache; … … 101 109 template<typename T> std::once_flag PerThreadStorage<T>::s_onceFlag; 102 110 103 #endif // defined(__has_include) && __has_include(<System/pthread_machdep.h>)111 #endif 104 112 105 113 template<typename T> -
trunk/Source/bmalloc/bmalloc/SmallTraits.h
r167546 r179923 36 36 37 37 struct SmallTraits { 38 typedef Chunk<SmallTraits> Chunk ;39 typedef Line<SmallTraits> Line ;40 typedef Page<SmallTraits> Page ;38 typedef Chunk<SmallTraits> ChunkType; 39 typedef Line<SmallTraits> LineType; 40 typedef Page<SmallTraits> PageType; 41 41 42 42 static const size_t lineSize = smallLineSize; -
trunk/Source/bmalloc/bmalloc/VMAllocate.h
r178861 r179923 32 32 #include "Syscall.h" 33 33 #include <algorithm> 34 #include <mach/vm_statistics.h>35 34 #include <sys/mman.h> 36 35 #include <unistd.h> 37 36 37 #if BOS(DARWIN) 38 #include <mach/vm_statistics.h> 39 #endif 40 38 41 namespace bmalloc { 39 42 43 #if BOS(DARWIN) 40 44 #define BMALLOC_VM_TAG VM_MAKE_TAG(VM_MEMORY_TCMALLOC) 45 #else 46 #define BMALLOC_VM_TAG -1 47 #endif 41 48 42 49 inline size_t vmSize(size_t size) … … 108 115 { 109 116 vmValidate(p, vmSize); 117 #if BOS(DARWIN) 110 118 SYSCALL(madvise(p, vmSize, MADV_FREE_REUSABLE)); 119 #else 120 SYSCALL(madvise(p, vmSize, MADV_DONTNEED)); 121 #endif 111 122 } 112 123 … … 114 125 { 115 126 vmValidate(p, vmSize); 127 #if BOS(DARWIN) 116 128 SYSCALL(madvise(p, vmSize, MADV_FREE_REUSE)); 129 #else 130 SYSCALL(madvise(p, vmSize, MADV_NORMAL)); 131 #endif 117 132 } 118 133 -
trunk/Source/bmalloc/bmalloc/Vector.h
r173589 r179923 30 30 #include "VMAllocate.h" 31 31 #include <cstddef> 32 #include < string>32 #include <cstring> 33 33 34 34 namespace bmalloc { … … 113 113 if (newSize > m_capacity) 114 114 growCapacity(newSize); 115 memcpy(this->end(), begin, (end - begin) * sizeof(T));115 std::memcpy(this->end(), begin, (end - begin) * sizeof(T)); 116 116 m_size = newSize; 117 117 } … … 149 149 T* newBuffer = static_cast<T*>(vmAllocate(vmSize)); 150 150 if (m_buffer) { 151 memcpy(newBuffer, m_buffer, m_size * sizeof(T));151 std::memcpy(newBuffer, m_buffer, m_size * sizeof(T)); 152 152 vmDeallocate(m_buffer, bmalloc::vmSize(m_capacity * sizeof(T))); 153 153 }
Note: See TracChangeset
for help on using the changeset viewer.