| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 159 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
| 160 // such a reference. | 160 // such a reference. |
| 161 template<typename T> | 161 template<typename T> |
| 162 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 162 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 163 static bool willObjectBeLazilySwept(const T* objectPointer) | 163 static bool willObjectBeLazilySwept(const T* objectPointer) |
| 164 { | 164 { |
| 165 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); | 165 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); |
| 166 BasePage* page = pageFromObject(objectPointer); | 166 BasePage* page = pageFromObject(objectPointer); |
| 167 if (page->hasBeenSwept()) | 167 if (page->hasBeenSwept()) |
| 168 return false; | 168 return false; |
| 169 ASSERT(page->arena()->threadState()->isSweepingInProgress()); | 169 ASSERT(page->arena()->getThreadState()->isSweepingInProgress()); |
| 170 | 170 |
| 171 return !Heap::isHeapObjectAlive(const_cast<T*>(objectPointer)); | 171 return !Heap::isHeapObjectAlive(const_cast<T*>(objectPointer)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Push a trace callback on the marking stack. | 174 // Push a trace callback on the marking stack. |
| 175 static void pushTraceCallback(void* containerObject, TraceCallback); | 175 static void pushTraceCallback(void* containerObject, TraceCallback); |
| 176 | 176 |
| 177 // Push a trace callback on the post-marking callback stack. These | 177 // Push a trace callback on the post-marking callback stack. These |
| 178 // callbacks are called after normal marking (including ephemeron | 178 // callbacks are called after normal marking (including ephemeron |
| 179 // iteration). | 179 // iteration). |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 static void postGC(BlinkGC::GCType); | 245 static void postGC(BlinkGC::GCType); |
| 246 | 246 |
| 247 // Conservatively checks whether an address is a pointer in any of the | 247 // Conservatively checks whether an address is a pointer in any of the |
| 248 // thread heaps. If so marks the object pointed to as live. | 248 // thread heaps. If so marks the object pointed to as live. |
| 249 static Address checkAndMarkPointer(Visitor*, Address); | 249 static Address checkAndMarkPointer(Visitor*, Address); |
| 250 | 250 |
| 251 static size_t objectPayloadSizeForTesting(); | 251 static size_t objectPayloadSizeForTesting(); |
| 252 | 252 |
| 253 static void flushHeapDoesNotContainCache(); | 253 static void flushHeapDoesNotContainCache(); |
| 254 | 254 |
| 255 static FreePagePool* freePagePool() { return s_freePagePool; } | 255 static FreePagePool* getFreePagePool() { return s_freePagePool; } |
| 256 static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } | 256 static OrphanedPagePool* getOrphanedPagePool() { return s_orphanedPagePool;
} |
| 257 | 257 |
| 258 // This look-up uses the region search tree and a negative contains cache to | 258 // This look-up uses the region search tree and a negative contains cache to |
| 259 // provide an efficient mapping from arbitrary addresses to the containing | 259 // provide an efficient mapping from arbitrary addresses to the containing |
| 260 // heap-page if one exists. | 260 // heap-page if one exists. |
| 261 static BasePage* lookup(Address); | 261 static BasePage* lookup(Address); |
| 262 static void addPageMemoryRegion(PageMemoryRegion*); | 262 static void addPageMemoryRegion(PageMemoryRegion*); |
| 263 static void removePageMemoryRegion(PageMemoryRegion*); | 263 static void removePageMemoryRegion(PageMemoryRegion*); |
| 264 | 264 |
| 265 static const GCInfo* gcInfo(size_t gcInfoIndex) | 265 static const GCInfo* gcInfo(size_t gcInfoIndex) |
| 266 { | 266 { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 532 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
| 533 { | 533 { |
| 534 T** cell = reinterpret_cast<T**>(object); | 534 T** cell = reinterpret_cast<T**>(object); |
| 535 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 535 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 536 *cell = nullptr; | 536 *cell = nullptr; |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace blink | 539 } // namespace blink |
| 540 | 540 |
| 541 #endif // Heap_h | 541 #endif // Heap_h |
| OLD | NEW |