ae13b85b52
This is a reland of eb4536797e
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: I415c837a7cf275c636172485dc4101c237a7d76b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2723253
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73081}
51 lines
1.3 KiB
C++
51 lines
1.3 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 {
|
|
|
|
/**
|
|
* 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_
|