46a1fa1a2c
GetHeapFromPayload returned the page header address instead of the value of the first field of the header. Bug: chromium:1056170 Change-Id: I4de5be975accced32460d6fab91543e6a5b07ba0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143825 Auto-Submit: Omer Katz <omerkatz@chromium.org> Reviewed-by: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#67079}
34 lines
869 B
C++
34 lines
869 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.
|
|
|
|
#include "src/heap/cppgc/heap-page.h"
|
|
#include "include/cppgc/allocation.h"
|
|
#include "include/cppgc/internal/accessors.h"
|
|
#include "test/unittests/heap/cppgc/tests.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace cppgc {
|
|
namespace internal {
|
|
|
|
namespace {
|
|
|
|
class PageTest : public testing::TestWithHeap {};
|
|
|
|
class GCed : public GarbageCollected<GCed> {};
|
|
|
|
} // namespace
|
|
|
|
TEST_F(PageTest, PageLayout) {
|
|
auto* np = NormalPage::Create(Heap::From(GetHeap()));
|
|
NormalPage::Destroy(np);
|
|
}
|
|
|
|
TEST_F(PageTest, GetHeapForAllocatedObject) {
|
|
GCed* gced = MakeGarbageCollected<GCed>(GetHeap());
|
|
EXPECT_EQ(GetHeap(), GetHeapFromPayload(gced));
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace cppgc
|