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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 template<typename Header> | 676 template<typename Header> |
677 void ThreadHeap<Header>::getScannedStats(HeapStats& scannedStats) | 677 void ThreadHeap<Header>::getScannedStats(HeapStats& scannedStats) |
678 { | 678 { |
679 for (HeapPage<Header>* page = m_firstPage; page; page = page->next()) | 679 for (HeapPage<Header>* page = m_firstPage; page; page = page->next()) |
680 page->getStats(scannedStats); | 680 page->getStats(scannedStats); |
681 for (LargeHeapObject<Header>* current = m_firstLargeHeapObject; current; cur
rent = current->next()) | 681 for (LargeHeapObject<Header>* current = m_firstLargeHeapObject; current; cur
rent = current->next()) |
682 current->getStats(scannedStats); | 682 current->getStats(scannedStats); |
683 } | 683 } |
684 #endif | 684 #endif |
685 | 685 |
| 686 // STRICT_ASAN_FINALIZATION_CHECKING turns on poisoning of all objects during |
| 687 // sweeping to catch cases where dead objects touch eachother. This is not |
| 688 // turned on by default because it also triggers for cases that are safe. |
| 689 // Examples of such safe cases are context life cycle observers and timers |
| 690 // embedded in garbage collected objects. |
| 691 #define STRICT_ASAN_FINALIZATION_CHECKING 0 |
| 692 |
686 template<typename Header> | 693 template<typename Header> |
687 void ThreadHeap<Header>::sweep() | 694 void ThreadHeap<Header>::sweep() |
688 { | 695 { |
689 ASSERT(isConsistentForGC()); | 696 ASSERT(isConsistentForGC()); |
690 #if defined(ADDRESS_SANITIZER) | 697 #if defined(ADDRESS_SANITIZER) && STRICT_ASAN_FINALIZATION_CHECKING |
691 // When using ASAN do a pre-sweep where all unmarked objects are poisoned be
fore | 698 // When using ASAN do a pre-sweep where all unmarked objects are poisoned be
fore |
692 // calling their finalizer methods. This can catch the cases where one objec
ts | 699 // calling their finalizer methods. This can catch the cases where one objec
ts |
693 // finalizer tries to modify another object as part of finalization. | 700 // finalizer tries to modify another object as part of finalization. |
694 for (HeapPage<Header>* page = m_firstPage; page; page = page->next()) | 701 for (HeapPage<Header>* page = m_firstPage; page; page = page->next()) |
695 page->poisonUnmarkedObjects(); | 702 page->poisonUnmarkedObjects(); |
696 #endif | 703 #endif |
697 HeapPage<Header>* page = m_firstPage; | 704 HeapPage<Header>* page = m_firstPage; |
698 HeapPage<Header>** previous = &m_firstPage; | 705 HeapPage<Header>** previous = &m_firstPage; |
699 bool pagesRemoved = false; | 706 bool pagesRemoved = false; |
700 while (page) { | 707 while (page) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 // Force template instantiations for the types that we need. | 1383 // Force template instantiations for the types that we need. |
1377 template class HeapPage<FinalizedHeapObjectHeader>; | 1384 template class HeapPage<FinalizedHeapObjectHeader>; |
1378 template class HeapPage<HeapObjectHeader>; | 1385 template class HeapPage<HeapObjectHeader>; |
1379 template class ThreadHeap<FinalizedHeapObjectHeader>; | 1386 template class ThreadHeap<FinalizedHeapObjectHeader>; |
1380 template class ThreadHeap<HeapObjectHeader>; | 1387 template class ThreadHeap<HeapObjectHeader>; |
1381 | 1388 |
1382 Visitor* Heap::s_markingVisitor; | 1389 Visitor* Heap::s_markingVisitor; |
1383 CallbackStack* Heap::s_markingStack; | 1390 CallbackStack* Heap::s_markingStack; |
1384 CallbackStack* Heap::s_weakCallbackStack; | 1391 CallbackStack* Heap::s_weakCallbackStack; |
1385 } | 1392 } |
OLD | NEW |