Changeset 164261 in webkit
- Timestamp:
- Feb 17, 2014 5:32:18 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r164245 r164261 1 2014-02-17 Anders Carlsson <andersca@apple.com> 2 3 Remove ENABLE_GLOBAL_FASTMALLOC_NEW 4 https://bugs.webkit.org/show_bug.cgi?id=127067 5 6 Reviewed by Geoffrey Garen. 7 8 * parser/Nodes.h: 9 1 10 2014-02-17 Sergio Correia <sergio.correia@openbossa.org> 2 11 -
trunk/Source/JavaScriptCore/parser/Nodes.h
r164139 r164261 113 113 114 114 class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> { 115 WTF_ FASTMALLOC_OPERATORS;115 WTF_MAKE_FAST_ALLOCATED; 116 116 protected: 117 117 ParserArenaRefCounted(VM*); -
trunk/Source/WTF/ChangeLog
r164220 r164261 1 2014-02-17 Anders Carlsson <andersca@apple.com> 2 3 Remove ENABLE_GLOBAL_FASTMALLOC_NEW 4 https://bugs.webkit.org/show_bug.cgi?id=127067 5 6 Reviewed by Geoffrey Garen. 7 8 Remove the global operator new/operator delete overrides. Having ALWAYS_INLINE operators 9 like we do is really undefined behavior according to the C++ standard and we've been lucky enough 10 to get away with it so far, but any code that calls operator new/operator delete inside from the C++ standard 11 library (not from headers that are included) will be mismatched and potentially crash. libc++ calls 12 delete in it's std::thread implementation for example. 13 14 The only supported way to override operator new and operator delete globally is to not use inline 15 functions, but that would mean that any application using WebKit would not be able to provide custom 16 operator new/operator delete functions so we'll just reuse the already existing infrastructure consisting 17 of the WTF_MAKE_FAST_ALLOCATED macro. 18 19 * wtf/FastMalloc.cpp: 20 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): 21 * wtf/FastMalloc.h: 22 * wtf/Platform.h: 23 1 24 2014-02-17 Ryan Lortie <desrt@desrt.ca> 2 25 -
trunk/Source/WTF/wtf/FastMalloc.cpp
r157474 r164261 4532 4532 } 4533 4533 4534 #if ENABLE(GLOBAL_FASTMALLOC_NEW)4535 4536 void* operator new(size_t size) {4537 void* p = cpp_alloc(size, false);4538 // We keep this next instruction out of cpp_alloc for a reason: when4539 // it's in, and new just calls cpp_alloc, the optimizer may fold the4540 // new call into cpp_alloc, which messes up our whole section-based4541 // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc4542 // isn't the last thing this fn calls, and prevents the folding.4543 MallocHook::InvokeNewHook(p, size);4544 return p;4545 }4546 4547 void* operator new(size_t size, const std::nothrow_t&) __THROW {4548 void* p = cpp_alloc(size, true);4549 MallocHook::InvokeNewHook(p, size);4550 return p;4551 }4552 4553 void operator delete(void* p) __THROW {4554 MallocHook::InvokeDeleteHook(p);4555 do_free(p);4556 }4557 4558 void operator delete(void* p, const std::nothrow_t&) __THROW {4559 MallocHook::InvokeDeleteHook(p);4560 do_free(p);4561 }4562 4563 void* operator new[](size_t size) {4564 void* p = cpp_alloc(size, false);4565 // We keep this next instruction out of cpp_alloc for a reason: when4566 // it's in, and new just calls cpp_alloc, the optimizer may fold the4567 // new call into cpp_alloc, which messes up our whole section-based4568 // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc4569 // isn't the last thing this fn calls, and prevents the folding.4570 MallocHook::InvokeNewHook(p, size);4571 return p;4572 }4573 4574 void* operator new[](size_t size, const std::nothrow_t&) __THROW {4575 void* p = cpp_alloc(size, true);4576 MallocHook::InvokeNewHook(p, size);4577 return p;4578 }4579 4580 void operator delete[](void* p) __THROW {4581 MallocHook::InvokeDeleteHook(p);4582 do_free(p);4583 }4584 4585 void operator delete[](void* p, const std::nothrow_t&) __THROW {4586 MallocHook::InvokeDeleteHook(p);4587 do_free(p);4588 }4589 4590 #endif4591 4592 4534 extern "C" void* memalign(size_t align, size_t size) __THROW { 4593 4535 void* result = do_memalign(align, size); -
trunk/Source/WTF/wtf/FastMalloc.h
r160838 r164261 249 249 #endif 250 250 251 #if !defined(_CRTDBG_MAP_ALLOC) && !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) 252 253 // The nothrow functions here are actually not all that helpful, because fastMalloc will 254 // call CRASH() rather than returning 0, and returning 0 is what nothrow is all about. 255 // But since WebKit code never uses exceptions or nothrow at all, this is probably OK. 256 // Long term we will adopt FastAllocBase.h everywhere, and and replace this with 257 // debug-only code to make sure we don't use the system malloc via the default operator 258 // new by accident. 259 260 #if ENABLE(GLOBAL_FASTMALLOC_NEW) 261 262 #if COMPILER(MSVC) 263 #pragma warning(push) 264 #pragma warning(disable: 4290) // Disable the C++ exception specification ignored warning. 265 #elif COMPILER(CLANG) && defined(__has_warning) 266 #pragma clang diagnostic push 267 #if __has_warning("-Winline-new-delete") 268 // FIXME: The operator new, delete definitions cannot be inline per replacement.functions (17.6.4.6/3) of the C++ 269 // standard. As a workaround, disable warnings for such usage. See <https://bugs.webkit.org/show_bug.cgi?id=124186>. 270 #pragma clang diagnostic ignored "-Winline-new-delete" 271 #endif 272 #endif 273 WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); } 274 WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } 275 WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); } 276 WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); } 277 WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); } 278 WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } 279 WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); } 280 WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); } 281 #if COMPILER(MSVC) 282 #pragma warning(pop) 283 #elif COMPILER(CLANG) && defined(__has_warning) 284 #pragma clang diagnostic pop 285 #endif 286 287 #endif // ENABLE(GLOBAL_FASTMALLOC_NEW) 288 #endif // !defined(_CRTDBG_MAP_ALLOC) && !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) 289 290 #define WTF_FASTMALLOC_OPERATORS \ 251 #define WTF_MAKE_FAST_ALLOCATED \ 291 252 public: \ 292 253 void* operator new(size_t, void* p) { return p; } \ … … 326 287 typedef int __thisIsHereToForceASemicolonAfterThisMacro 327 288 328 #if ENABLE(GLOBAL_FASTMALLOC_NEW)329 #define WTF_MAKE_FAST_ALLOCATED330 #else331 #define WTF_MAKE_FAST_ALLOCATED WTF_FASTMALLOC_OPERATORS332 #endif333 334 335 289 #endif /* WTF_FastMalloc_h */ -
trunk/Source/WTF/wtf/Platform.h
r164220 r164261 450 450 #define WTF_USE_SOUP 1 451 451 #define WTF_USE_WEBP 1 452 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0453 452 #endif 454 453 … … 602 601 #include <wtf/FeatureDefines.h> 603 602 604 #if PLATFORM(EFL)605 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0606 #endif607 608 603 #if OS(WINDOWS) 609 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0610 604 #define USE_SYSTEM_MALLOC 1 611 #endif612 613 #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)614 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1615 605 #endif 616 606 -
trunk/Source/WebCore/ChangeLog
r164259 r164261 1 2014-02-17 Anders Carlsson <andersca@apple.com> 2 3 Remove ENABLE_GLOBAL_FASTMALLOC_NEW 4 https://bugs.webkit.org/show_bug.cgi?id=127067 5 6 Reviewed by Geoffrey Garen. 7 8 * platform/Timer.h: 9 1 10 2014-02-17 Sam Weinig <sam@webkit.org> 2 11 -
trunk/Source/WebCore/platform/Timer.h
r162716 r164261 45 45 class TimerBase { 46 46 WTF_MAKE_NONCOPYABLE(TimerBase); 47 WTF_ FASTMALLOC_OPERATORS;47 WTF_MAKE_FAST_ALLOCATED; 48 48 public: 49 49 TimerBase();
Note: See TracChangeset
for help on using the changeset viewer.