[heap] Add safepoints in Heap GC methods
Add safepoints to GC methods in Heap. There is still stuff in Heap::CollectGarbage which might work better or more precise in a global safepoint. Be conservative here and move everything into the safepoint, eventually we can start to move code out that is fine to run outside the safepoint. Bug: v8:10315 Change-Id: I656dfd72f032eff6f386cec63a02777506650aa7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335192 Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#69228}
This commit is contained in:
parent
64c52438ed
commit
1742d2561f
@ -1268,6 +1268,8 @@ TimedHistogram* Heap::GCTypeTimer(GarbageCollector collector) {
|
||||
|
||||
void Heap::CollectAllGarbage(int flags, GarbageCollectionReason gc_reason,
|
||||
const v8::GCCallbackFlags gc_callback_flags) {
|
||||
SafepointScope scope(this);
|
||||
|
||||
// Since we are ignoring the return value, the exact choice of space does
|
||||
// not matter, so long as we do not specify NEW_SPACE, which would not
|
||||
// cause a full GC.
|
||||
@ -1337,6 +1339,8 @@ void ReportDuplicates(int size, std::vector<HeapObject>* objects) {
|
||||
} // anonymous namespace
|
||||
|
||||
void Heap::CollectAllAvailableGarbage(GarbageCollectionReason gc_reason) {
|
||||
SafepointScope scope(this);
|
||||
|
||||
// Since we are ignoring the return value, the exact choice of space does
|
||||
// not matter, so long as we do not specify NEW_SPACE, which would not
|
||||
// cause a full GC.
|
||||
@ -1486,6 +1490,7 @@ Heap::DevToolsTraceEventScope::~DevToolsTraceEventScope() {
|
||||
bool Heap::CollectGarbage(AllocationSpace space,
|
||||
GarbageCollectionReason gc_reason,
|
||||
const v8::GCCallbackFlags gc_callback_flags) {
|
||||
SafepointScope scope(this);
|
||||
const char* collector_reason = nullptr;
|
||||
GarbageCollector collector = SelectGarbageCollector(space, &collector_reason);
|
||||
is_current_gc_forced_ = gc_callback_flags & v8::kGCCallbackFlagForced ||
|
||||
|
Loading…
Reference in New Issue
Block a user