Commit 64276318 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

heap: Remove MSVC hack for GarbageCollected type

MSVC is unsupported, see
  https://groups.google.com/a/chromium.org/g/chromium-dev/c/fuVUxe1q6EA/m/is1EpDqwBQAJ

Bug: 1053958
Change-Id: Ibd8872d1b3be7509c2eec17f4e7d83cbb7398406
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063131Reviewed-by: default avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742612}
parent e5bbf79a
...@@ -485,31 +485,22 @@ template <typename T> ...@@ -485,31 +485,22 @@ template <typename T>
class GarbageCollected { class GarbageCollected {
IS_GARBAGE_COLLECTED_TYPE(); IS_GARBAGE_COLLECTED_TYPE();
// For now direct allocation of arrays on the heap is not allowed.
void* operator new[](size_t size);
#if defined(OS_WIN) && defined(COMPILER_MSVC)
// Due to some quirkiness in the MSVC compiler we have to provide
// the delete[] operator in the GarbageCollected subclasses as it
// is called when a class is exported in a DLL.
protected:
void operator delete[](void* p) { NOTREACHED(); }
#else
void operator delete[](void* p);
#endif
public: public:
using ParentMostGarbageCollectedType = T; using ParentMostGarbageCollectedType = T;
void* operator new(size_t size) = delete; // Must use MakeGarbageCollected. // Must use MakeGarbageCollected.
void* operator new(size_t) = delete;
void* operator new[](size_t) = delete;
// The garbage collector is taking care of reclaiming the object. Also,
// virtual destructor requires an unambiguous, accessible 'operator delete'.
void operator delete(void*) { NOTREACHED(); }
void operator delete[](void*) = delete;
template <typename Derived> template <typename Derived>
static void* AllocateObject(size_t size) { static void* AllocateObject(size_t size) {
return ThreadHeap::Allocate<GCInfoFoldedType<Derived>>(size); return ThreadHeap::Allocate<GCInfoFoldedType<Derived>>(size);
} }
void operator delete(void* p) { NOTREACHED(); }
protected: protected:
// This trait in theory can be moved to gc_info.h, but that would cause // This trait in theory can be moved to gc_info.h, but that would cause
// significant memory bloat caused by huge number of ThreadHeap::Allocate<> // significant memory bloat caused by huge number of ThreadHeap::Allocate<>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment