872e315b34
This CL adds basic infrastructure for: - MakeGarbageCollected - GarbageCollected and related type traits - Heap (API / internal) - Basic allocation based on malloc - CollectGarbage without marking This allows for allocation and reclamation through an explicit GC call. No objects are held alive from any source (stack, globals, refs), yet. The exact wiring of platform is future work. Change-Id: I81b7c0ba7b525188f8c0bf9de3b7af35d34322af Bug: chromium:1056170 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120538 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Hannes Payer <hpayer@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/master@{#66887}
40 lines
956 B
C++
40 lines
956 B
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_CPPGC_TESTS_H_
|
|
#define V8_UNITTESTS_HEAP_CPPGC_TESTS_H_
|
|
|
|
#include "include/cppgc/heap.h"
|
|
#include "include/cppgc/platform.h"
|
|
#include "src/base/page-allocator.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace cppgc {
|
|
namespace testing {
|
|
|
|
class TestWithPlatform : public ::testing::Test {
|
|
protected:
|
|
static void SetUpTestSuite();
|
|
static void TearDownTestSuite();
|
|
|
|
private:
|
|
static std::unique_ptr<cppgc::PageAllocator> page_allocator_;
|
|
};
|
|
|
|
class TestWithHeap : public TestWithPlatform {
|
|
protected:
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
|
|
Heap* GetHeap() const { return heap_.get(); }
|
|
|
|
private:
|
|
std::unique_ptr<cppgc::Heap> heap_;
|
|
};
|
|
|
|
} // namespace testing
|
|
} // namespace cppgc
|
|
|
|
#endif // V8_UNITTESTS_HEAP_CPPGC_TESTS_H_
|