538522d0c8
This reverts commit f300a01a63
.
Reason for revert: Makes TSAN unhappy: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20stress-incremental-marking/5299/overview
Original change's description:
> unittests: Provide Context in TestWithHeapInternals
>
> Change-Id: I54e658325dfbfb425c41cab2fd7b32253b380e37
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3247038
> 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/main@{#77577}
Change-Id: I3806a40847d327cc86e2816e00a74c80ba7b512e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3247633
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Owners-Override: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#77578}
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
// Copyright 2020 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 V8_UNITTESTS_HEAP_HEAP_UTILS_H_
|
|
#define V8_UNITTESTS_HEAP_HEAP_UTILS_H_
|
|
|
|
#include "src/base/macros.h"
|
|
#include "src/common/globals.h"
|
|
#include "test/unittests/test-utils.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
class HeapInternalsBase {
|
|
protected:
|
|
void SimulateIncrementalMarking(Heap* heap, bool force_completion);
|
|
};
|
|
|
|
template <typename TMixin>
|
|
class WithHeapInternals : public TMixin, HeapInternalsBase {
|
|
public:
|
|
WithHeapInternals() = default;
|
|
WithHeapInternals(const WithHeapInternals&) = delete;
|
|
WithHeapInternals& operator=(const WithHeapInternals&) = delete;
|
|
|
|
void CollectGarbage(i::AllocationSpace space) {
|
|
heap()->CollectGarbage(space, i::GarbageCollectionReason::kTesting);
|
|
}
|
|
|
|
Heap* heap() const { return this->i_isolate()->heap(); }
|
|
|
|
void SimulateIncrementalMarking(bool force_completion = true) {
|
|
return HeapInternalsBase::SimulateIncrementalMarking(heap(),
|
|
force_completion);
|
|
}
|
|
};
|
|
|
|
using TestWithHeapInternals = //
|
|
WithHeapInternals< //
|
|
WithInternalIsolateMixin< //
|
|
WithIsolateScopeMixin< //
|
|
WithIsolateMixin< //
|
|
::testing::Test>>>>;
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_UNITTESTS_HEAP_HEAP_UTILS_H_
|