| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 **s_threadSpecific = this; | 118 **s_threadSpecific = this; |
| 119 | 119 |
| 120 if (isMainThread()) { | 120 if (isMainThread()) { |
| 121 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); | 121 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s
izeof(void*); |
| 122 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack
Size(); | 122 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack
Size(); |
| 123 if (underestimatedStackSize > sizeof(void*)) | 123 if (underestimatedStackSize > sizeof(void*)) |
| 124 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size
of(void*); | 124 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size
of(void*); |
| 125 } | 125 } |
| 126 | 126 |
| 127 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI
ndex++) | 127 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI
ndex++) |
| 128 m_arenas[arenaIndex] = new NormalPageHeap(this, arenaIndex); | 128 m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); |
| 129 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectHeap(this, BlinkGC
::LargeObjectArenaIndex); | 129 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkG
C::LargeObjectArenaIndex); |
| 130 | 130 |
| 131 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr
aySize]); | 131 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr
aySize]); |
| 132 clearArenaAges(); | 132 clearArenaAges(); |
| 133 | 133 |
| 134 // There is little use of weak references and collections off the main threa
d; | 134 // There is little use of weak references and collections off the main threa
d; |
| 135 // use a much lower initial block reservation. | 135 // use a much lower initial block reservation. |
| 136 size_t initialBlockSize = isMainThread() ? CallbackStack::kDefaultBlockSize
: CallbackStack::kMinimalBlockSize; | 136 size_t initialBlockSize = isMainThread() ? CallbackStack::kDefaultBlockSize
: CallbackStack::kMinimalBlockSize; |
| 137 m_threadLocalWeakCallbackStack = new CallbackStack(initialBlockSize); | 137 m_threadLocalWeakCallbackStack = new CallbackStack(initialBlockSize); |
| 138 } | 138 } |
| 139 | 139 |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1040 |
| 1041 #if defined(ADDRESS_SANITIZER) | 1041 #if defined(ADDRESS_SANITIZER) |
| 1042 void ThreadState::poisonAllHeaps() | 1042 void ThreadState::poisonAllHeaps() |
| 1043 { | 1043 { |
| 1044 // TODO(Oilpan): enable the poisoning always. | 1044 // TODO(Oilpan): enable the poisoning always. |
| 1045 #if ENABLE(OILPAN) | 1045 #if ENABLE(OILPAN) |
| 1046 // Unpoison the live objects remaining in the eager arenas.. | 1046 // Unpoison the live objects remaining in the eager arenas.. |
| 1047 poisonEagerArena(BlinkGC::ClearPoison); | 1047 poisonEagerArena(BlinkGC::ClearPoison); |
| 1048 // ..along with poisoning all unmarked objects in the other arenas. | 1048 // ..along with poisoning all unmarked objects in the other arenas. |
| 1049 for (int i = 1; i < BlinkGC::NumberOfArenas; i++) | 1049 for (int i = 1; i < BlinkGC::NumberOfArenas; i++) |
| 1050 m_arenas[i]->poisonHeap(BlinkGC::UnmarkedOnly, BlinkGC::SetPoison); | 1050 m_arenas[i]->poisonArena(BlinkGC::UnmarkedOnly, BlinkGC::SetPoison); |
| 1051 #endif | 1051 #endif |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 void ThreadState::poisonEagerArena(BlinkGC::Poisoning poisoning) | 1054 void ThreadState::poisonEagerArena(BlinkGC::Poisoning poisoning) |
| 1055 { | 1055 { |
| 1056 // TODO(Oilpan): enable the poisoning always. | 1056 // TODO(Oilpan): enable the poisoning always. |
| 1057 #if ENABLE(OILPAN) | 1057 #if ENABLE(OILPAN) |
| 1058 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonHeap(BlinkGC::MarkedAndUnmark
ed, poisoning); | 1058 m_arenas[BlinkGC::EagerSweepArenaIndex]->poisonArena(BlinkGC::MarkedAndUnmar
ked, poisoning); |
| 1059 #endif | 1059 #endif |
| 1060 } | 1060 } |
| 1061 #endif | 1061 #endif |
| 1062 | 1062 |
| 1063 void ThreadState::eagerSweep() | 1063 void ThreadState::eagerSweep() |
| 1064 { | 1064 { |
| 1065 ASSERT(checkThread()); | 1065 ASSERT(checkThread()); |
| 1066 // Some objects need to be finalized promptly and cannot be handled | 1066 // Some objects need to be finalized promptly and cannot be handled |
| 1067 // by lazy sweeping. Keep those in a designated heap and sweep it | 1067 // by lazy sweeping. Keep those in a designated heap and sweep it |
| 1068 // eagerly. | 1068 // eagerly. |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 for (int arenaIndex = beginArenaIndex + 1; arenaIndex <= endArenaIndex; aren
aIndex++) { | 1442 for (int arenaIndex = beginArenaIndex + 1; arenaIndex <= endArenaIndex; aren
aIndex++) { |
| 1443 if (m_arenaAges[arenaIndex] < minArenaAge) { | 1443 if (m_arenaAges[arenaIndex] < minArenaAge) { |
| 1444 minArenaAge = m_arenaAges[arenaIndex]; | 1444 minArenaAge = m_arenaAges[arenaIndex]; |
| 1445 arenaIndexWithMinArenaAge = arenaIndex; | 1445 arenaIndexWithMinArenaAge = arenaIndex; |
| 1446 } | 1446 } |
| 1447 } | 1447 } |
| 1448 ASSERT(isVectorArenaIndex(arenaIndexWithMinArenaAge)); | 1448 ASSERT(isVectorArenaIndex(arenaIndexWithMinArenaAge)); |
| 1449 return arenaIndexWithMinArenaAge; | 1449 return arenaIndexWithMinArenaAge; |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 BaseArena* ThreadState::expandedVectorBackingHeap(size_t gcInfoIndex) | 1452 BaseArena* ThreadState::expandedVectorBackingArena(size_t gcInfoIndex) |
| 1453 { | 1453 { |
| 1454 ASSERT(checkThread()); | 1454 ASSERT(checkThread()); |
| 1455 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask; | 1455 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask; |
| 1456 --m_likelyToBePromptlyFreed[entryIndex]; | 1456 --m_likelyToBePromptlyFreed[entryIndex]; |
| 1457 int arenaIndex = m_vectorBackingArenaIndex; | 1457 int arenaIndex = m_vectorBackingArenaIndex; |
| 1458 m_arenaAges[arenaIndex] = ++m_currentArenaAges; | 1458 m_arenaAges[arenaIndex] = ++m_currentArenaAges; |
| 1459 m_vectorBackingArenaIndex = arenaIndexOfVectorArenaLeastRecentlyExpanded(Bli
nkGC::Vector1ArenaIndex, BlinkGC::Vector4ArenaIndex); | 1459 m_vectorBackingArenaIndex = arenaIndexOfVectorArenaLeastRecentlyExpanded(Bli
nkGC::Vector1ArenaIndex, BlinkGC::Vector4ArenaIndex); |
| 1460 return m_arenas[arenaIndex]; | 1460 return m_arenas[arenaIndex]; |
| 1461 } | 1461 } |
| 1462 | 1462 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1539 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1540 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1540 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1541 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1541 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1542 | 1542 |
| 1543 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1543 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1544 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1544 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1545 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1545 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1546 } | 1546 } |
| 1547 | 1547 |
| 1548 } // namespace blink | 1548 } // namespace blink |
| OLD | NEW |