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

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

Issue 1055193004: Oilpan: Enable lazy sweeping on non-oilpan builds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 // to be not reachable during the marking phase, but it has yet to be swept 873 // to be not reachable during the marking phase, but it has yet to be swept
874 // and finalized. The predicate returns false in all other cases. 874 // and finalized. The predicate returns false in all other cases.
875 // 875 //
876 // Holding a reference to an already-dead object is not a valid state 876 // Holding a reference to an already-dead object is not a valid state
877 // to be in; willObjectBeLazilySwept() has undefined behavior if passed 877 // to be in; willObjectBeLazilySwept() has undefined behavior if passed
878 // such a reference. 878 // such a reference.
879 template<typename T> 879 template<typename T>
880 static bool willObjectBeLazilySwept(const T* objectPointer) 880 static bool willObjectBeLazilySwept(const T* objectPointer)
881 { 881 {
882 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f rom GarbageCollected can be used."); 882 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f rom GarbageCollected can be used.");
883 #if ENABLE(OILPAN)
884 BasePage* page = pageFromObject(objectPointer); 883 BasePage* page = pageFromObject(objectPointer);
885 if (page->hasBeenSwept()) 884 if (page->hasBeenSwept())
886 return false; 885 return false;
887 ASSERT(page->heap()->threadState()->isSweepingInProgress()); 886 ASSERT(page->heap()->threadState()->isSweepingInProgress());
888 887
889 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c ast<T*>(objectPointer)); 888 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c ast<T*>(objectPointer));
890 #else
891 // FIXME: remove when lazy sweeping is always on
892 // (cf. ThreadState::preSweep()).
893 return false;
894 #endif
895 } 889 }
896 890
897 // Push a trace callback on the marking stack. 891 // Push a trace callback on the marking stack.
898 static void pushTraceCallback(void* containerObject, TraceCallback); 892 static void pushTraceCallback(void* containerObject, TraceCallback);
899 893
900 // Push a trace callback on the post-marking callback stack. These 894 // Push a trace callback on the post-marking callback stack. These
901 // callbacks are called after normal marking (including ephemeron 895 // callbacks are called after normal marking (including ephemeron
902 // iteration). 896 // iteration).
903 static void pushPostMarkingCallback(void*, TraceCallback); 897 static void pushPostMarkingCallback(void*, TraceCallback);
904 898
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 template<typename T, size_t i, typename U> 1777 template<typename T, size_t i, typename U>
1784 inline void swap(HeapListHashSet<T, i, U>& a, HeapListHashSet<T, i, U>& b) { a.s wap(b); } 1778 inline void swap(HeapListHashSet<T, i, U>& a, HeapListHashSet<T, i, U>& b) { a.s wap(b); }
1785 template<typename T, typename U, typename V> 1779 template<typename T, typename U, typename V>
1786 inline void swap(HeapLinkedHashSet<T, U, V>& a, HeapLinkedHashSet<T, U, V>& b) { a.swap(b); } 1780 inline void swap(HeapLinkedHashSet<T, U, V>& a, HeapLinkedHashSet<T, U, V>& b) { a.swap(b); }
1787 template<typename T, typename U, typename V> 1781 template<typename T, typename U, typename V>
1788 inline void swap(HeapHashCountedSet<T, U, V>& a, HeapHashCountedSet<T, U, V>& b) { a.swap(b); } 1782 inline void swap(HeapHashCountedSet<T, U, V>& a, HeapHashCountedSet<T, U, V>& b) { a.swap(b); }
1789 1783
1790 } // namespace blink 1784 } // namespace blink
1791 1785
1792 #endif // Heap_h 1786 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698