8380ebb277
This reverts commit eb4536797e
.
Reason for revert: Breaks MSAN: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20arm64%20-%20sim%20-%20MSAN/37053
Original change's description:
> cppgc: Rework testing GC infrastructure
>
> Instead of moving the stand-alone logic to the base heap, allows
> specific heaps to override their stand-alone GC behavior. This allows
> CppHeap to reuse the unified heap bottlenecks and visitors for
> testing. This works as long as any v8 references are empty as there is
> no Isolate attached to the heap in this case.
>
> - Reverts parts of https://crrev.com/c/2716291
> - Relands parts of https://crrev.com/c/2718146
>
> In addition, add tests covering v8::CppHeap and cppgc::Heap.
>
> Bug: chromium:1056170
> Change-Id: I47dc88c7f0e4961a1aadd60da9b05bff4dcfb27a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2718612
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#73077}
Bug: chromium:1056170
Change-Id: Ieda44c07d08f837a6632f96b8db6d5bec87dd521
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2723216
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Francis McCabe <fgm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73078}
65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
// Copyright 2021 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.
|
|
|
|
#ifndef INCLUDE_CPPGC_TESTING_H_
|
|
#define INCLUDE_CPPGC_TESTING_H_
|
|
|
|
#include "cppgc/common.h"
|
|
#include "cppgc/macros.h"
|
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
|
|
namespace cppgc {
|
|
|
|
class HeapHandle;
|
|
|
|
/**
|
|
* Namespace contains testing helpers.
|
|
*/
|
|
namespace testing {
|
|
|
|
/**
|
|
* Testing helper used to acces heap internals.
|
|
*/
|
|
class V8_EXPORT Heap final {
|
|
public:
|
|
/**
|
|
* Atomically collects garbage on the C++ heap.
|
|
*
|
|
* \param heap_handle The corresponding heap.
|
|
* \param stack_state The stack state to assume for the garbage collection.
|
|
*/
|
|
void CollectGarbage(HeapHandle& heap_handle, EmbedderStackState stack_state);
|
|
};
|
|
|
|
/**
|
|
* Overrides the state of the stack with the provided value. Takes precedence
|
|
* over other parameters that set the stack state. Must no be nested.
|
|
*/
|
|
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
|
|
CPPGC_STACK_ALLOCATED();
|
|
|
|
public:
|
|
/**
|
|
* Constructs a scoped object that automatically enters and leaves the scope.
|
|
*
|
|
* \param heap_handle The corresponding heap.
|
|
*/
|
|
explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle,
|
|
EmbedderStackState state);
|
|
~OverrideEmbedderStackStateScope();
|
|
|
|
OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) =
|
|
delete;
|
|
OverrideEmbedderStackStateScope& operator=(
|
|
const OverrideEmbedderStackStateScope&) = delete;
|
|
|
|
private:
|
|
HeapHandle& heap_handle_;
|
|
};
|
|
|
|
} // namespace testing
|
|
} // namespace cppgc
|
|
|
|
#endif // INCLUDE_CPPGC_TESTING_H_
|