143ad476ef
Track list of all local heaps in the Safepoint class instead of the Heap. Bug: v8:10315 Change-Id: I1a1c847502ab5e8f368d4cc12d3cbaf3672af7cc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2106197 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/master@{#66745}
39 lines
974 B
C++
39 lines
974 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/local-heap.h"
|
|
#include "src/heap/heap.h"
|
|
#include "src/heap/safepoint.h"
|
|
#include "test/unittests/test-utils.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
using LocalHeapTest = TestWithIsolate;
|
|
|
|
TEST_F(LocalHeapTest, Initialize) {
|
|
Heap* heap = i_isolate()->heap();
|
|
|
|
{
|
|
LocalHeap lh1(heap);
|
|
CHECK(heap->safepoint()->ContainsLocalHeap(&lh1));
|
|
LocalHeap lh2(heap);
|
|
CHECK(heap->safepoint()->ContainsLocalHeap(&lh2));
|
|
|
|
{
|
|
LocalHeap lh3(heap);
|
|
CHECK(heap->safepoint()->ContainsLocalHeap(&lh3));
|
|
}
|
|
|
|
CHECK(heap->safepoint()->ContainsLocalHeap(&lh1));
|
|
CHECK(heap->safepoint()->ContainsLocalHeap(&lh2));
|
|
}
|
|
|
|
CHECK(!heap->safepoint()->ContainsAnyLocalHeap());
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|