OLD | NEW |
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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // If a lazy sweep is in progress, returns true if the object was found | 869 // If a lazy sweep is in progress, returns true if the object was found |
870 // to be not reachable during the marking phase, but it has yet to be swept | 870 // to be not reachable during the marking phase, but it has yet to be swept |
871 // and finalized. The predicate returns false in all other cases. | 871 // and finalized. The predicate returns false in all other cases. |
872 // | 872 // |
873 // Holding a reference to an already-dead object is not a valid state | 873 // Holding a reference to an already-dead object is not a valid state |
874 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 874 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
875 // such a reference. | 875 // such a reference. |
876 template<typename T> | 876 template<typename T> |
877 static bool willObjectBeLazilySwept(const T* objectPointer) | 877 static bool willObjectBeLazilySwept(const T* objectPointer) |
878 { | 878 { |
| 879 #if ENABLE(OILPAN) |
| 880 // Restricted to Oilpan. |
879 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); | 881 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); |
880 #if ENABLE(OILPAN) | 882 #endif |
881 BasePage* page = pageFromObject(objectPointer); | 883 BasePage* page = pageFromObject(objectPointer); |
882 if (page->hasBeenSwept()) | 884 if (page->hasBeenSwept()) |
883 return false; | 885 return false; |
884 ASSERT(page->heap()->threadState()->isSweepingInProgress()); | 886 ASSERT(page->heap()->threadState()->isSweepingInProgress()); |
885 | 887 |
886 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); | 888 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); |
887 #else | |
888 // FIXME: remove when lazy sweeping is always on | |
889 // (cf. ThreadState::preSweep()). | |
890 return false; | |
891 #endif | |
892 } | 889 } |
893 | 890 |
894 // Push a trace callback on the marking stack. | 891 // Push a trace callback on the marking stack. |
895 static void pushTraceCallback(void* containerObject, TraceCallback); | 892 static void pushTraceCallback(void* containerObject, TraceCallback); |
896 | 893 |
897 // Push a trace callback on the post-marking callback stack. These | 894 // Push a trace callback on the post-marking callback stack. These |
898 // callbacks are called after normal marking (including ephemeron | 895 // callbacks are called after normal marking (including ephemeron |
899 // iteration). | 896 // iteration). |
900 static void pushPostMarkingCallback(void*, TraceCallback); | 897 static void pushPostMarkingCallback(void*, TraceCallback); |
901 | 898 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 size_t copySize = previousHeader->payloadSize(); | 1282 size_t copySize = previousHeader->payloadSize(); |
1286 if (copySize > size) | 1283 if (copySize > size) |
1287 copySize = size; | 1284 copySize = size; |
1288 memcpy(address, previous, copySize); | 1285 memcpy(address, previous, copySize); |
1289 return address; | 1286 return address; |
1290 } | 1287 } |
1291 | 1288 |
1292 } // namespace blink | 1289 } // namespace blink |
1293 | 1290 |
1294 #endif // Heap_h | 1291 #endif // Heap_h |
OLD | NEW |