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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 782223002: [NotForCommit] inline ensureMarked. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index fb1a833c8c2c7da6c11f3b5ee493babcfdd50e0c..78c95534b14855dae7fe892f1107ba567506fcbf 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -452,21 +452,6 @@ private:
};
NO_SANITIZE_ADDRESS inline
-bool HeapObjectHeader::isMarked() const
-{
- checkHeader();
- return m_size & markBitMask;
-}
-
-NO_SANITIZE_ADDRESS inline
-void HeapObjectHeader::mark()
-{
- checkHeader();
- ASSERT(!isMarked());
- m_size = m_size | markBitMask;
-}
-
-NO_SANITIZE_ADDRESS inline
void HeapObjectHeader::unmark()
{
checkHeader();
@@ -498,14 +483,6 @@ void HeapObjectHeader::zapMagic()
}
#endif
-HeapObjectHeader* HeapObjectHeader::fromPayload(const void* payload)
-{
- Address addr = reinterpret_cast<Address>(const_cast<void*>(payload));
- HeapObjectHeader* header =
- reinterpret_cast<HeapObjectHeader*>(addr - sizeof(HeapObjectHeader));
- return header;
-}
-
void HeapObjectHeader::finalize(const GCInfo* gcInfo, Address object, size_t objectSize)
{
ASSERT(gcInfo);
@@ -626,14 +603,6 @@ void LargeObject<HeapObjectHeader>::finalize()
HeapObjectHeader::finalize(gcInfo(), payload(), payloadSize());
}
-GeneralHeapObjectHeader* GeneralHeapObjectHeader::fromPayload(const void* payload)
-{
- Address addr = reinterpret_cast<Address>(const_cast<void*>(payload));
- GeneralHeapObjectHeader* header =
- reinterpret_cast<GeneralHeapObjectHeader*>(addr - sizeof(GeneralHeapObjectHeader));
- return header;
-}
-
template<typename Header>
ThreadHeap<Header>::ThreadHeap(ThreadState* state, int index)
: m_currentAllocationPoint(0)
@@ -1972,11 +1941,6 @@ static void markNoTracingCallback(Visitor* visitor, void* object)
visitor->markNoTracing(object);
}
-enum MarkingMode {
- GlobalMarking,
- ThreadLocalMarking,
-};
-
template<MarkingMode Mode>
class MarkingVisitor final : public Visitor {
public:
@@ -1987,7 +1951,8 @@ public:
#endif
explicit MarkingVisitor(CallbackStack* markingStack)
- : m_markingStack(markingStack)
+ : Visitor(Mode)
+ , m_markingStack(markingStack)
{
}
@@ -2078,29 +2043,7 @@ public:
return GeneralHeapObjectHeader::fromPayload(objectPointer)->isMarked();
}
- virtual bool ensureMarked(const void* objectPointer) override
- {
- if (!objectPointer)
- return false;
- if (Mode == ThreadLocalMarking && !objectInTerminatingThreadHeap(objectPointer))
- return false;
-#if ENABLE(ASSERT)
- if (isMarked(objectPointer))
- return false;
-
- markNoTracing(objectPointer);
-#else
- // Inline what the above markNoTracing() call expands to,
- // so as to make sure that we do get all the benefits.
- GeneralHeapObjectHeader* header =
- GeneralHeapObjectHeader::fromPayload(objectPointer);
- if (header->isMarked())
- return false;
- header->mark();
-#endif
- return true;
- }
-
+ /*
#if ENABLE(ASSERT)
#define DEFINE_ENSURE_MARKED_METHOD(Type) \
virtual bool ensureMarked(const Type* objectPointer) override \
@@ -2131,6 +2074,7 @@ public:
return true; \
}
#endif
+*/
// This macro defines the necessary visitor methods for typed heaps
#define DEFINE_VISITOR_METHODS(Type) \
@@ -2145,8 +2089,7 @@ public:
virtual bool isMarked(const Type* objectPointer) override \
{ \
return HeapObjectHeader::fromPayload(objectPointer)->isMarked(); \
- } \
- DEFINE_ENSURE_MARKED_METHOD(Type)
+ }
FOR_EACH_TYPED_HEAP(DEFINE_VISITOR_METHODS)
#undef DEFINE_VISITOR_METHODS
@@ -2247,16 +2190,6 @@ public:
}
#endif
- static inline bool objectInTerminatingThreadHeap(const void* objectPointer)
- {
- BaseHeapPage* page = pageFromObject(objectPointer);
- ASSERT(!page->orphaned());
- // When doing a thread local GC, the marker checks if
- // the object resides in another thread's heap. The
- // object should not be traced, if it does.
- return page->terminating();
- }
-
protected:
virtual void registerWeakCell(void** cell, WeakPointerCallback callback) override
{
« 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