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

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

Issue 2703713003: Remove SafePointBarrier (Closed)
Patch Set: temp 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1118
1119 // 256 is as good an approximation as any else. 1119 // 256 is as good an approximation as any else.
1120 const size_t bytesToCopy = sizeof(Address) * 256; 1120 const size_t bytesToCopy = sizeof(Address) * 256;
1121 if (static_cast<size_t>(start - end) < bytesToCopy) 1121 if (static_cast<size_t>(start - end) < bytesToCopy)
1122 return start; 1122 return start;
1123 1123
1124 return end + bytesToCopy; 1124 return end + bytesToCopy;
1125 } 1125 }
1126 #endif 1126 #endif
1127 1127
1128 // TODO(haraken): The first void* pointer is unused. Remove it.
1129 using PushAllRegistersCallback = void (*)(void*, ThreadState*, intptr_t*);
1130 extern "C" void pushAllRegisters(void*, ThreadState*, PushAllRegistersCallback);
1131
1132 static void enterSafePointAfterPushRegisters(void*,
1133 ThreadState* state,
1134 intptr_t* stackEnd) {
1135 state->recordStackEnd(stackEnd);
1136 state->copyStackUntilSafePointScope();
1137 }
1138
1128 void ThreadState::enterSafePoint(BlinkGC::StackState stackState, 1139 void ThreadState::enterSafePoint(BlinkGC::StackState stackState,
1129 void* scopeMarker) { 1140 void* scopeMarker) {
1130 ASSERT(checkThread()); 1141 ASSERT(checkThread());
1131 #ifdef ADDRESS_SANITIZER 1142 #ifdef ADDRESS_SANITIZER
1132 if (stackState == BlinkGC::HeapPointersOnStack) 1143 if (stackState == BlinkGC::HeapPointersOnStack)
1133 scopeMarker = adjustScopeMarkerForAdressSanitizer(scopeMarker); 1144 scopeMarker = adjustScopeMarkerForAdressSanitizer(scopeMarker);
1134 #endif 1145 #endif
1135 ASSERT(stackState == BlinkGC::NoHeapPointersOnStack || scopeMarker); 1146 ASSERT(stackState == BlinkGC::NoHeapPointersOnStack || scopeMarker);
1136 runScheduledGC(stackState); 1147 runScheduledGC(stackState);
1137 m_stackState = stackState; 1148 m_stackState = stackState;
1138 m_safePointScopeMarker = scopeMarker; 1149 m_safePointScopeMarker = scopeMarker;
1139 m_heap->enterSafePoint(this); 1150 pushAllRegisters(nullptr, this, enterSafePointAfterPushRegisters);
1140 } 1151 }
1141 1152
1142 void ThreadState::leaveSafePoint() { 1153 void ThreadState::leaveSafePoint() {
1143 ASSERT(checkThread()); 1154 ASSERT(checkThread());
1144 m_heap->leaveSafePoint();
1145 m_stackState = BlinkGC::HeapPointersOnStack; 1155 m_stackState = BlinkGC::HeapPointersOnStack;
1146 clearSafePointScopeMarker(); 1156 clearSafePointScopeMarker();
1147 } 1157 }
1148 1158
1149 void ThreadState::reportMemoryToV8() { 1159 void ThreadState::reportMemoryToV8() {
1150 if (!m_isolate) 1160 if (!m_isolate)
1151 return; 1161 return;
1152 1162
1153 size_t currentHeapSize = m_allocatedObjectSize + m_markedObjectSize; 1163 size_t currentHeapSize = m_allocatedObjectSize + m_markedObjectSize;
1154 int64_t diff = static_cast<int64_t>(currentHeapSize) - 1164 int64_t diff = static_cast<int64_t>(currentHeapSize) -
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, 1556 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep,
1547 BlinkGC::ForcedGC); 1557 BlinkGC::ForcedGC);
1548 size_t liveObjects = heap().heapStats().markedObjectSize(); 1558 size_t liveObjects = heap().heapStats().markedObjectSize();
1549 if (liveObjects == previousLiveObjects) 1559 if (liveObjects == previousLiveObjects)
1550 break; 1560 break;
1551 previousLiveObjects = liveObjects; 1561 previousLiveObjects = liveObjects;
1552 } 1562 }
1553 } 1563 }
1554 1564
1555 } // namespace blink 1565 } // 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