Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/platform/heap/Heap.cpp

Issue 813883002: replace COMPILE_ASSERT with static_assert in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 index++; 1576 index++;
1577 } 1577 }
1578 return index; 1578 return index;
1579 } 1579 }
1580 1580
1581 template<typename Header> 1581 template<typename Header>
1582 HeapPage<Header>::HeapPage(PageMemory* storage, ThreadHeap<Header>* heap, const GCInfo* gcInfo) 1582 HeapPage<Header>::HeapPage(PageMemory* storage, ThreadHeap<Header>* heap, const GCInfo* gcInfo)
1583 : BaseHeapPage(storage, gcInfo, heap->threadState()) 1583 : BaseHeapPage(storage, gcInfo, heap->threadState())
1584 , m_next(nullptr) 1584 , m_next(nullptr)
1585 { 1585 {
1586 COMPILE_ASSERT(!(sizeof(HeapPage<Header>) & allocationMask), page_header_inc orrectly_aligned); 1586 static_assert(!(sizeof(HeapPage<Header>) & allocationMask), "page header inc orrectly aligned");
1587 m_objectStartBitMapComputed = false; 1587 m_objectStartBitMapComputed = false;
1588 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this))); 1588 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this)));
1589 } 1589 }
1590 1590
1591 template<typename Header> 1591 template<typename Header>
1592 size_t HeapPage<Header>::objectPayloadSizeForTesting() 1592 size_t HeapPage<Header>::objectPayloadSizeForTesting()
1593 { 1593 {
1594 size_t objectPayloadSize = 0; 1594 size_t objectPayloadSize = 0;
1595 Address headerAddress = payload(); 1595 Address headerAddress = payload();
1596 ASSERT(headerAddress != end()); 1596 ASSERT(headerAddress != end());
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 #endif 2105 #endif
2106 return true; 2106 return true;
2107 } 2107 }
2108 2108
2109 #if ENABLE(ASSERT) 2109 #if ENABLE(ASSERT)
2110 #define DEFINE_ENSURE_MARKED_METHOD(Type) \ 2110 #define DEFINE_ENSURE_MARKED_METHOD(Type) \
2111 virtual bool ensureMarked(const Type* objectPointer) override \ 2111 virtual bool ensureMarked(const Type* objectPointer) override \
2112 { \ 2112 { \
2113 if (!objectPointer) \ 2113 if (!objectPointer) \
2114 return false; \ 2114 return false; \
2115 COMPILE_ASSERT(!NeedsAdjustAndMark<Type>::value, CanOnlyUseIsMarkedOnNon AdjustedTypes); \ 2115 static_assert(!NeedsAdjustAndMark<Type>::value, \
2116 "ensureMarked can only be used on non adjusted types"); \
2116 if (Mode == ThreadLocalMarking && !objectInTerminatingThreadHeap(objectP ointer)) \ 2117 if (Mode == ThreadLocalMarking && !objectInTerminatingThreadHeap(objectP ointer)) \
2117 return false; \ 2118 return false; \
2118 if (isMarked(objectPointer)) \ 2119 if (isMarked(objectPointer)) \
2119 return false; \ 2120 return false; \
2120 markNoTracing(objectPointer); \ 2121 markNoTracing(objectPointer); \
2121 return true; \ 2122 return true; \
2122 } 2123 }
2123 #else 2124 #else
2124 #define DEFINE_ENSURE_MARKED_METHOD(Type) \ 2125 #define DEFINE_ENSURE_MARKED_METHOD(Type) \
2125 virtual bool ensureMarked(const Type* objectPointer) override \ 2126 virtual bool ensureMarked(const Type* objectPointer) override \
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 bool Heap::s_shutdownCalled = false; 2947 bool Heap::s_shutdownCalled = false;
2947 bool Heap::s_lastGCWasConservative = false; 2948 bool Heap::s_lastGCWasConservative = false;
2948 FreePagePool* Heap::s_freePagePool; 2949 FreePagePool* Heap::s_freePagePool;
2949 OrphanedPagePool* Heap::s_orphanedPagePool; 2950 OrphanedPagePool* Heap::s_orphanedPagePool;
2950 Heap::RegionTree* Heap::s_regionTree = nullptr; 2951 Heap::RegionTree* Heap::s_regionTree = nullptr;
2951 size_t Heap::s_allocatedObjectSize = 0; 2952 size_t Heap::s_allocatedObjectSize = 0;
2952 size_t Heap::s_allocatedSpace = 0; 2953 size_t Heap::s_allocatedSpace = 0;
2953 size_t Heap::s_markedObjectSize = 0; 2954 size_t Heap::s_markedObjectSize = 0;
2954 2955
2955 } // namespace blink 2956 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698