Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 2694243003: Remove ThreadState::m_isAtSafePoint (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 return "<Unknown>"; 99 return "<Unknown>";
100 } 100 }
101 101
102 ThreadState::ThreadState() 102 ThreadState::ThreadState()
103 : m_thread(currentThread()), 103 : m_thread(currentThread()),
104 m_persistentRegion(WTF::makeUnique<PersistentRegion>()), 104 m_persistentRegion(WTF::makeUnique<PersistentRegion>()),
105 m_startOfStack(reinterpret_cast<intptr_t*>(WTF::getStackStart())), 105 m_startOfStack(reinterpret_cast<intptr_t*>(WTF::getStackStart())),
106 m_endOfStack(reinterpret_cast<intptr_t*>(WTF::getStackStart())), 106 m_endOfStack(reinterpret_cast<intptr_t*>(WTF::getStackStart())),
107 m_safePointScopeMarker(nullptr), 107 m_safePointScopeMarker(nullptr),
108 m_atSafePoint(false),
109 m_interruptors(), 108 m_interruptors(),
110 m_sweepForbidden(false), 109 m_sweepForbidden(false),
111 m_noAllocationCount(0), 110 m_noAllocationCount(0),
112 m_gcForbiddenCount(0), 111 m_gcForbiddenCount(0),
113 m_mixinsBeingConstructedCount(0), 112 m_mixinsBeingConstructedCount(0),
114 m_accumulatedSweepingTime(0), 113 m_accumulatedSweepingTime(0),
115 m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex), 114 m_vectorBackingArenaIndex(BlinkGC::Vector1ArenaIndex),
116 m_currentArenaAges(0), 115 m_currentArenaAges(0),
117 m_gcMixinMarker(nullptr), 116 m_gcMixinMarker(nullptr),
118 m_shouldFlushHeapDoesNotContainCache(false), 117 m_shouldFlushHeapDoesNotContainCache(false),
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) 1096 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
1098 objectPayloadSize += m_arenas[i]->objectPayloadSizeForTesting(); 1097 objectPayloadSize += m_arenas[i]->objectPayloadSizeForTesting();
1099 return objectPayloadSize; 1098 return objectPayloadSize;
1100 } 1099 }
1101 1100
1102 void ThreadState::safePoint(BlinkGC::StackState stackState) { 1101 void ThreadState::safePoint(BlinkGC::StackState stackState) {
1103 ASSERT(checkThread()); 1102 ASSERT(checkThread());
1104 ThreadHeap::reportMemoryUsageForTracing(); 1103 ThreadHeap::reportMemoryUsageForTracing();
1105 1104
1106 runScheduledGC(stackState); 1105 runScheduledGC(stackState);
1107 ASSERT(!m_atSafePoint);
1108 m_stackState = BlinkGC::HeapPointersOnStack; 1106 m_stackState = BlinkGC::HeapPointersOnStack;
1109 } 1107 }
1110 1108
1111 #ifdef ADDRESS_SANITIZER 1109 #ifdef ADDRESS_SANITIZER
1112 // When we are running under AddressSanitizer with 1110 // When we are running under AddressSanitizer with
1113 // detect_stack_use_after_return=1 then stack marker obtained from 1111 // detect_stack_use_after_return=1 then stack marker obtained from
1114 // SafePointScope will point into a fake stack. Detect this case by checking if 1112 // SafePointScope will point into a fake stack. Detect this case by checking if
1115 // it falls in between current stack frame and stack start and use an arbitrary 1113 // it falls in between current stack frame and stack start and use an arbitrary
1116 // high enough value for it. Don't adjust stack marker in any other case to 1114 // high enough value for it. Don't adjust stack marker in any other case to
1117 // match behavior of code running without AddressSanitizer. 1115 // match behavior of code running without AddressSanitizer.
(...skipping 17 matching lines...) Expand all
1135 1133
1136 void ThreadState::enterSafePoint(BlinkGC::StackState stackState, 1134 void ThreadState::enterSafePoint(BlinkGC::StackState stackState,
1137 void* scopeMarker) { 1135 void* scopeMarker) {
1138 ASSERT(checkThread()); 1136 ASSERT(checkThread());
1139 #ifdef ADDRESS_SANITIZER 1137 #ifdef ADDRESS_SANITIZER
1140 if (stackState == BlinkGC::HeapPointersOnStack) 1138 if (stackState == BlinkGC::HeapPointersOnStack)
1141 scopeMarker = adjustScopeMarkerForAdressSanitizer(scopeMarker); 1139 scopeMarker = adjustScopeMarkerForAdressSanitizer(scopeMarker);
1142 #endif 1140 #endif
1143 ASSERT(stackState == BlinkGC::NoHeapPointersOnStack || scopeMarker); 1141 ASSERT(stackState == BlinkGC::NoHeapPointersOnStack || scopeMarker);
1144 runScheduledGC(stackState); 1142 runScheduledGC(stackState);
1145 ASSERT(!m_atSafePoint);
1146 m_atSafePoint = true;
1147 m_stackState = stackState; 1143 m_stackState = stackState;
1148 m_safePointScopeMarker = scopeMarker; 1144 m_safePointScopeMarker = scopeMarker;
1149 m_heap->enterSafePoint(this); 1145 m_heap->enterSafePoint(this);
1150 } 1146 }
1151 1147
1152 void ThreadState::leaveSafePoint() { 1148 void ThreadState::leaveSafePoint() {
1153 ASSERT(checkThread()); 1149 ASSERT(checkThread());
1154 ASSERT(m_atSafePoint);
1155 m_heap->leaveSafePoint(); 1150 m_heap->leaveSafePoint();
sof 2017/02/15 09:00:04 dead code.
haraken 2017/02/15 09:02:29 yeah, let me remove this when I remove SafePointSc
1156 m_atSafePoint = false;
1157 m_stackState = BlinkGC::HeapPointersOnStack; 1151 m_stackState = BlinkGC::HeapPointersOnStack;
1158 clearSafePointScopeMarker(); 1152 clearSafePointScopeMarker();
1159 } 1153 }
1160 1154
1161 void ThreadState::reportMemoryToV8() { 1155 void ThreadState::reportMemoryToV8() {
1162 if (!m_isolate) 1156 if (!m_isolate)
1163 return; 1157 return;
1164 1158
1165 size_t currentHeapSize = m_allocatedObjectSize + m_markedObjectSize; 1159 size_t currentHeapSize = m_allocatedObjectSize + m_markedObjectSize;
1166 int64_t diff = static_cast<int64_t>(currentHeapSize) - 1160 int64_t diff = static_cast<int64_t>(currentHeapSize) -
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, 1562 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep,
1569 BlinkGC::ForcedGC); 1563 BlinkGC::ForcedGC);
1570 size_t liveObjects = heap().heapStats().markedObjectSize(); 1564 size_t liveObjects = heap().heapStats().markedObjectSize();
1571 if (liveObjects == previousLiveObjects) 1565 if (liveObjects == previousLiveObjects)
1572 break; 1566 break;
1573 previousLiveObjects = liveObjects; 1567 previousLiveObjects = liveObjects;
1574 } 1568 }
1575 } 1569 }
1576 1570
1577 } // namespace blink 1571 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698