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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // to disallow a GC during the pre-finalizers. | 1026 // to disallow a GC during the pre-finalizers. |
1027 setGCState(Sweeping); | 1027 setGCState(Sweeping); |
1028 | 1028 |
1029 // Allocation is allowed during the pre-finalizers and destructors. | 1029 // Allocation is allowed during the pre-finalizers and destructors. |
1030 // However, they must not mutate an object graph in a way in which | 1030 // However, they must not mutate an object graph in a way in which |
1031 // a dead object gets resurrected. | 1031 // a dead object gets resurrected. |
1032 invokePreFinalizers(); | 1032 invokePreFinalizers(); |
1033 | 1033 |
1034 m_accumulatedSweepingTime = 0; | 1034 m_accumulatedSweepingTime = 0; |
1035 | 1035 |
1036 #if defined(ADDRESS_SANITIZER) | |
1037 poisonEagerArena(BlinkGC::SetPoison); | |
1038 #endif | |
1039 eagerSweep(); | 1036 eagerSweep(); |
| 1037 |
1040 #if defined(ADDRESS_SANITIZER) | 1038 #if defined(ADDRESS_SANITIZER) |
1041 poisonAllHeaps(); | 1039 poisonAllHeaps(); |
1042 #endif | 1040 #endif |
1043 | |
1044 if (previousGCState == EagerSweepScheduled) { | 1041 if (previousGCState == EagerSweepScheduled) { |
1045 // Eager sweeping should happen only in testing. | 1042 // Eager sweeping should happen only in testing. |
1046 completeSweep(); | 1043 completeSweep(); |
1047 } else { | 1044 } else { |
1048 // The default behavior is lazy sweeping. | 1045 // The default behavior is lazy sweeping. |
1049 scheduleIdleLazySweep(); | 1046 scheduleIdleLazySweep(); |
1050 } | 1047 } |
1051 } | 1048 } |
1052 | 1049 |
1053 #if defined(ADDRESS_SANITIZER) | 1050 #if defined(ADDRESS_SANITIZER) |
1054 void ThreadState::poisonAllHeaps() | 1051 void ThreadState::poisonAllHeaps() |
1055 { | 1052 { |
1056 // TODO(Oilpan): enable the poisoning always. | 1053 // TODO(Oilpan): enable the poisoning always. |
1057 #if ENABLE(OILPAN) | 1054 #if ENABLE(OILPAN) |
1058 // Unpoison the live objects remaining in the eager arenas.. | |
1059 poisonEagerArena(BlinkGC::ClearPoison); | |
1060 // ..along with poisoning all unmarked objects in the other arenas. | 1055 // ..along with poisoning all unmarked objects in the other arenas. |
1061 for (int i = 1; i < BlinkGC::NumberOfArenas; i++) | 1056 for (int i = 1; i < BlinkGC::NumberOfArenas; i++) |
1062 m_arenas[i]->poisonArena(BlinkGC::UnmarkedOnly, BlinkGC::SetPoison); | 1057 m_arenas[i]->poisonArena(); |
1063 #endif | 1058 #endif |
1064 } | 1059 } |
1065 | 1060 |
1066 void ThreadState::poisonEagerArena(BlinkGC::Poisoning poisoning) | 1061 void ThreadState::poisonEagerArena() |
1067 { | 1062 { |
1068 // TODO(Oilpan): enable the poisoning always. | 1063 // TODO(Oilpan): enable the poisoning always. |
1069 #if ENABLE(OILPAN) | 1064 #if ENABLE(OILPAN) |
1070 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonArena(BlinkGC::MarkedAndUnmar
ked, poisoning); | 1065 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonArena(); |
1071 #endif | 1066 #endif |
1072 } | 1067 } |
1073 #endif | 1068 #endif |
1074 | 1069 |
1075 void ThreadState::eagerSweep() | 1070 void ThreadState::eagerSweep() |
1076 { | 1071 { |
| 1072 #if defined(ADDRESS_SANITIZER) |
| 1073 poisonEagerArena(); |
| 1074 #endif |
1077 ASSERT(checkThread()); | 1075 ASSERT(checkThread()); |
1078 // Some objects need to be finalized promptly and cannot be handled | 1076 // Some objects need to be finalized promptly and cannot be handled |
1079 // by lazy sweeping. Keep those in a designated heap and sweep it | 1077 // by lazy sweeping. Keep those in a designated heap and sweep it |
1080 // eagerly. | 1078 // eagerly. |
1081 ASSERT(isSweepingInProgress()); | 1079 ASSERT(isSweepingInProgress()); |
1082 | 1080 |
1083 // Mirroring the completeSweep() condition; see its comment. | 1081 // Mirroring the completeSweep() condition; see its comment. |
1084 if (sweepForbidden()) | 1082 if (sweepForbidden()) |
1085 return; | 1083 return; |
1086 | 1084 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1557 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
1560 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1558 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
1561 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1559 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
1562 | 1560 |
1563 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1561 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
1564 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1562 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
1565 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1563 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
1566 } | 1564 } |
1567 | 1565 |
1568 } // namespace blink | 1566 } // namespace blink |
OLD | NEW |