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

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

Issue 803443002: Introduce InlinedGlobalMarkingVisitor 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 unified diff | Download patch
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/Visitor.h » ('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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 } 444 }
445 445
446 private: 446 private:
447 ThreadState* m_state; 447 ThreadState* m_state;
448 ThreadState::SafePointScope m_safePointScope; 448 ThreadState::SafePointScope m_safePointScope;
449 bool m_parkedAllThreads; // False if we fail to park all threads 449 bool m_parkedAllThreads; // False if we fail to park all threads
450 }; 450 };
451 451
452 NO_SANITIZE_ADDRESS inline 452 NO_SANITIZE_ADDRESS inline
453 bool HeapObjectHeader::isMarked() const
454 {
455 checkHeader();
456 return m_size & markBitMask;
457 }
458
459 NO_SANITIZE_ADDRESS inline
460 void HeapObjectHeader::mark()
461 {
462 checkHeader();
463 ASSERT(!isMarked());
464 m_size = m_size | markBitMask;
465 }
466
467 NO_SANITIZE_ADDRESS inline
468 void HeapObjectHeader::unmark() 453 void HeapObjectHeader::unmark()
469 { 454 {
470 checkHeader(); 455 checkHeader();
471 ASSERT(isMarked()); 456 ASSERT(isMarked());
472 m_size &= ~markBitMask; 457 m_size &= ~markBitMask;
473 } 458 }
474 459
475 NO_SANITIZE_ADDRESS inline 460 NO_SANITIZE_ADDRESS inline
476 bool HeapObjectHeader::isDead() const 461 bool HeapObjectHeader::isDead() const
477 { 462 {
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 result.storedValue->value.add(reinterpret_cast<uintptr_t>(objectPoin ter)); 2005 result.storedValue->value.add(reinterpret_cast<uintptr_t>(objectPoin ter));
2021 } 2006 }
2022 ObjectGraph::AddResult result = objectGraph().add(reinterpret_cast<uintp tr_t>(objectPointer), std::make_pair(reinterpret_cast<uintptr_t>(m_hostObject), m_hostName)); 2007 ObjectGraph::AddResult result = objectGraph().add(reinterpret_cast<uintp tr_t>(objectPointer), std::make_pair(reinterpret_cast<uintptr_t>(m_hostObject), m_hostName));
2023 ASSERT(result.isNewEntry); 2008 ASSERT(result.isNewEntry);
2024 // fprintf(stderr, "%s[%p] -> %s[%p]\n", m_hostName.ascii().data(), m_ho stObject, className.ascii().data(), objectPointer); 2009 // fprintf(stderr, "%s[%p] -> %s[%p]\n", m_hostName.ascii().data(), m_ho stObject, className.ascii().data(), objectPointer);
2025 #endif 2010 #endif
2026 if (callback) 2011 if (callback)
2027 Heap::pushTraceCallback(m_markingStack, const_cast<void*>(objectPoin ter), callback); 2012 Heap::pushTraceCallback(m_markingStack, const_cast<void*>(objectPoin ter), callback);
2028 } 2013 }
2029 2014
2015 virtual void pushTraceCallback(void* objectPointer, TraceCallback callback)
2016 {
2017 ASSERT(callback);
2018 Heap::pushTraceCallback(m_markingStack, objectPointer, callback);
2019 }
2020
2030 // We need both HeapObjectHeader and GeneralHeapObjectHeader versions to 2021 // We need both HeapObjectHeader and GeneralHeapObjectHeader versions to
2031 // correctly find the payload. 2022 // correctly find the payload.
2032 virtual void mark(HeapObjectHeader* header, TraceCallback callback) override 2023 virtual void mark(HeapObjectHeader* header, TraceCallback callback) override
2033 { 2024 {
2034 visitHeader(header, header->payload(), callback); 2025 visitHeader(header, header->payload(), callback);
2035 } 2026 }
2036 2027
2037 virtual void mark(GeneralHeapObjectHeader* header, TraceCallback callback) o verride 2028 virtual void mark(GeneralHeapObjectHeader* header, TraceCallback callback) o verride
2038 { 2029 {
2039 visitHeader(header, header->payload(), callback); 2030 visitHeader(header, header->payload(), callback);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 static inline bool objectInTerminatingThreadHeap(const void* objectPointer) 2237 static inline bool objectInTerminatingThreadHeap(const void* objectPointer)
2247 { 2238 {
2248 BaseHeapPage* page = pageFromObject(objectPointer); 2239 BaseHeapPage* page = pageFromObject(objectPointer);
2249 ASSERT(!page->orphaned()); 2240 ASSERT(!page->orphaned());
2250 // When doing a thread local GC, the marker checks if 2241 // When doing a thread local GC, the marker checks if
2251 // the object resides in another thread's heap. The 2242 // the object resides in another thread's heap. The
2252 // object should not be traced, if it does. 2243 // object should not be traced, if it does.
2253 return page->terminating(); 2244 return page->terminating();
2254 } 2245 }
2255 2246
2247 virtual bool isGlobalMarkingVisitor() override { return Mode == GlobalMarkin g; }
2248
2256 protected: 2249 protected:
2257 virtual void registerWeakCell(void** cell, WeakPointerCallback callback) ove rride 2250 virtual void registerWeakCell(void** cell, WeakPointerCallback callback) ove rride
2258 { 2251 {
2259 Heap::pushWeakCellPointerCallback(cell, callback); 2252 Heap::pushWeakCellPointerCallback(cell, callback);
2260 } 2253 }
2261 2254
2262 private: 2255 private:
2263 CallbackStack* m_markingStack; 2256 CallbackStack* m_markingStack;
2264 }; 2257 };
2265 2258
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 bool Heap::s_shutdownCalled = false; 2935 bool Heap::s_shutdownCalled = false;
2943 bool Heap::s_lastGCWasConservative = false; 2936 bool Heap::s_lastGCWasConservative = false;
2944 FreePagePool* Heap::s_freePagePool; 2937 FreePagePool* Heap::s_freePagePool;
2945 OrphanedPagePool* Heap::s_orphanedPagePool; 2938 OrphanedPagePool* Heap::s_orphanedPagePool;
2946 Heap::RegionTree* Heap::s_regionTree = nullptr; 2939 Heap::RegionTree* Heap::s_regionTree = nullptr;
2947 size_t Heap::s_allocatedObjectSize = 0; 2940 size_t Heap::s_allocatedObjectSize = 0;
2948 size_t Heap::s_allocatedSpace = 0; 2941 size_t Heap::s_allocatedSpace = 0;
2949 size_t Heap::s_markedObjectSize = 0; 2942 size_t Heap::s_markedObjectSize = 0;
2950 2943
2951 } // namespace blink 2944 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698