[heap] Ensure that ArrayBufferSweeper is not active

Add CHECKs to make sure that ArrayBufferSweeper is only active when
v8_enable_array_buffer_extension is set to true.

Bug: v8:10064
Change-Id: I609d5e1230dca52fd8555d4401c3f60faf4c266c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2047047
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66209}
This commit is contained in:
Dominik Inführ 2020-02-10 16:35:41 +01:00 committed by Commit Bot
parent 55a01ec751
commit ffdece642c

View File

@ -67,6 +67,7 @@ size_t ArrayBufferList::BytesSlow() {
void ArrayBufferSweeper::EnsureFinished() {
if (!sweeping_in_progress_) return;
CHECK(V8_ARRAY_BUFFER_EXTENSION_BOOL);
TryAbortResult abort_result =
heap_->isolate()->cancelable_task_manager()->TryAbort(job_.id);
@ -128,6 +129,8 @@ void ArrayBufferSweeper::RequestSweep(SweepingScope scope) {
if (young_.IsEmpty() && (old_.IsEmpty() || scope == SweepingScope::Young))
return;
CHECK(V8_ARRAY_BUFFER_EXTENSION_BOOL);
if (!heap_->IsTearingDown() && !heap_->ShouldReduceMemory() &&
!heap_->is_current_gc_forced() && FLAG_concurrent_array_buffer_sweeping) {
Prepare(scope);
@ -196,6 +199,7 @@ void ArrayBufferSweeper::ReleaseAll(ArrayBufferList* list) {
void ArrayBufferSweeper::Append(JSArrayBuffer object,
ArrayBufferExtension* extension) {
CHECK(V8_ARRAY_BUFFER_EXTENSION_BOOL);
size_t bytes = extension->accounting_length();
if (Heap::InYoungGeneration(object)) {