[+] v8::DisableHeapGC
[+] v8::EnableHeapGC
(high level heap gc request filters, not safepoint assertions)
Last aurora commit: 65aae12e
*amended to include commit link*
This commit is contained in:
parent
65aae12e09
commit
e9f848d445
@ -1164,6 +1164,16 @@ V8_EXPORT void SafepointUnparkIsolate(v8::Isolate* pIsolate) {
|
||||
reinterpret_cast<i::Isolate*>(pIsolate)->heap()->safepoint()->NotifyUnpark();
|
||||
}
|
||||
|
||||
// Reece:
|
||||
V8_EXPORT void DisableHeapGC(v8::Isolate* pIsolate) {
|
||||
reinterpret_cast<i::Isolate*>(pIsolate)->heap()->is_forcing_no_gc = true;
|
||||
}
|
||||
|
||||
// Reece:
|
||||
V8_EXPORT void EnableHeapGC(v8::Isolate* pIsolate) {
|
||||
reinterpret_cast<i::Isolate*>(pIsolate)->heap()->is_forcing_no_gc = false;
|
||||
}
|
||||
|
||||
void Context::Enter() {
|
||||
i::DisallowGarbageCollection no_gc;
|
||||
i::Context env = *Utils::OpenHandle(this);
|
||||
|
@ -1652,6 +1652,22 @@ void Heap::CollectGarbage(AllocationSpace space,
|
||||
FatalProcessOutOfMemory("GC during deserialization");
|
||||
}
|
||||
|
||||
if (V8_UNLIKELY(is_forcing_no_gc)) {
|
||||
if (!(((int)gc_callback_flags &
|
||||
((int)v8::GCCallbackFlags::kGCCallbackFlagForced) |
|
||||
0))) {
|
||||
if (gc_reason != GarbageCollectionReason::kLastResort &&
|
||||
gc_reason != GarbageCollectionReason::kFinalizeMarkingViaTask &&
|
||||
gc_reason != GarbageCollectionReason::kFinalizeMarkingViaStackGuard &&
|
||||
gc_reason != GarbageCollectionReason::kFinalizeMinorMC &&
|
||||
gc_reason != GarbageCollectionReason::kExternalFinalize &&
|
||||
gc_reason != GarbageCollectionReason::kAllocationFailure &&
|
||||
gc_reason != GarbageCollectionReason::kAllocationLimit) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CollectGarbage consists of three parts:
|
||||
// 1. The prologue part which may execute callbacks. These callbacks may
|
||||
// allocate and trigger another garbage collection.
|
||||
|
@ -2413,6 +2413,11 @@ class Heap {
|
||||
// This field is used only when not running with MinorMC.
|
||||
ResizeNewSpaceMode resize_new_space_mode_ = ResizeNewSpaceMode::kNone;
|
||||
|
||||
// Reece: (another hack)
|
||||
public:
|
||||
bool is_forcing_no_gc = false;
|
||||
private:
|
||||
|
||||
// Classes in "heap" can be friends.
|
||||
friend class AlwaysAllocateScope;
|
||||
friend class ArrayBufferCollector;
|
||||
|
Loading…
Reference in New Issue
Block a user