Commit fff219bf authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap,cppgc: Update StackState enum values

This CL adds 2 new values to the EmbedderStackState enum with more
explicit names. The old values are updated as aliases to the new
values and marked as soon to be deprecated. This CL also moves the
enum to v8-platform.h so that it can be reused by cppgc.

Depracating individual values in an enum is supported by GCC only
since version 6. Thus new macros were needed for the deprecation
(which delegate to the existing macros when supported). GCC versions
older than 6 are still used by the CQ bots.

Bug: chromium:1056170
Change-Id: Id1ea73edfbbae282b0d8a3bb103dbbbf8ebd417e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2188971
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67744}
parent 040e8324
......@@ -2107,6 +2107,7 @@ v8_source_set("v8_base_without_compiler") {
### gcmole(all) ###
"$target_gen_dir/builtins-generated/bytecodes-builtins-list.h",
"include/cppgc/common.h",
"include/v8-fast-api-calls.h",
"include/v8-inspector-protocol.h",
"include/v8-inspector.h",
......@@ -4030,6 +4031,7 @@ v8_source_set("cppgc_base") {
sources = [
"include/cppgc/allocation.h",
"include/cppgc/common.h",
"include/cppgc/custom-space.h",
"include/cppgc/garbage-collected.h",
"include/cppgc/heap.h",
......
include_rules = [
# v8-inspector-protocol.h depends on generated files under include/inspector.
"+inspector",
"+cppgc/common.h",
]
// 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 INCLUDE_CPPGC_COMMON_H_
#define INCLUDE_CPPGC_COMMON_H_
// TODO(chromium:1056170): Remove dependency on v8.
#include "v8config.h" // NOLINT(build/include_directory)
namespace cppgc {
// Indicator for the stack state of the embedder.
enum class EmbedderStackState {
kMayContainHeapPointers,
kNoHeapPointers,
kUnknown V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") =
kMayContainHeapPointers,
kNonEmpty V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") =
kMayContainHeapPointers,
kEmpty V8_ENUM_DEPRECATE_SOON("Use kNoHeapPointers") = kNoHeapPointers,
};
} // namespace cppgc
#endif // INCLUDE_CPPGC_COMMON_H_
......@@ -8,6 +8,7 @@
#include <memory>
#include <vector>
#include "cppgc/common.h"
#include "cppgc/custom-space.h"
#include "v8config.h" // NOLINT(build/include_directory)
......@@ -21,22 +22,7 @@ class V8_EXPORT Heap {
/**
* Specifies the stack state the embedder is in.
*/
enum class StackState : uint8_t {
/**
* The embedder does not know anything about it's stack.
*/
kUnknown,
/**
* The stack is empty, i.e., it does not contain any raw pointers
* to garbage-collected objects.
*/
kEmpty,
/**
* The stack is non-empty, i.e., it may contain raw pointers to
* garabge-collected objects.
*/
kNonEmpty,
};
using StackState = EmbedderStackState;
struct HeapOptions {
static HeapOptions Default() { return {}; }
......@@ -64,7 +50,7 @@ class V8_EXPORT Heap {
*/
void ForceGarbageCollectionSlow(
const char* source, const char* reason,
StackState stack_state = StackState::kUnknown);
StackState stack_state = StackState::kMayContainHeapPointers);
private:
Heap() = default;
......
......@@ -18,12 +18,14 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "cppgc/common.h"
#include "v8-internal.h" // NOLINT(build/include_directory)
#include "v8-version.h" // NOLINT(build/include_directory)
#include "v8config.h" // NOLINT(build/include_directory)
......@@ -7843,19 +7845,14 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical };
*/
class V8_EXPORT EmbedderHeapTracer {
public:
using EmbedderStackState = cppgc::EmbedderStackState;
enum TraceFlags : uint64_t {
kNoFlags = 0,
kReduceMemory = 1 << 0,
kForced = 1 << 2,
};
// Indicator for the stack state of the embedder.
enum EmbedderStackState {
kUnknown,
kNonEmpty,
kEmpty,
};
/**
* Interface for iterating through TracedGlobal handles.
*/
......
......@@ -405,6 +405,15 @@
#endif
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
# define V8_ENUM_DEPRECATED(message)
# define V8_ENUM_DEPRECATE_SOON(message)
#else
# define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
# define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
#endif
// A macro to provide the compiler with branch prediction information.
#if V8_HAS_BUILTIN_EXPECT
# define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
......
......@@ -105,7 +105,7 @@ class AsyncGC final : public CancelableTask {
void RunInternal() final {
v8::HandleScope scope(isolate_);
InvokeGC(isolate_, type_,
v8::EmbedderHeapTracer::EmbedderStackState::kEmpty);
v8::EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers);
auto resolver = v8::Local<v8::Promise::Resolver>::New(isolate_, resolver_);
auto ctx = Local<v8::Context>::New(isolate_, ctx_);
resolver->Resolve(ctx, v8::Undefined(isolate_)).ToChecked();
......@@ -132,9 +132,9 @@ void GCExtension::GC(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Immediate bailout if no arguments are provided.
if (args.Length() == 0) {
InvokeGC(isolate,
v8::Isolate::GarbageCollectionType::kFullGarbageCollection,
v8::EmbedderHeapTracer::EmbedderStackState::kUnknown);
InvokeGC(
isolate, v8::Isolate::GarbageCollectionType::kFullGarbageCollection,
v8::EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
return;
}
......@@ -143,8 +143,9 @@ void GCExtension::GC(const v8::FunctionCallbackInfo<v8::Value>& args) {
GCOptions options = maybe_options.ToChecked();
switch (options.execution) {
case ExecutionType::kSync:
InvokeGC(isolate, options.type,
v8::EmbedderHeapTracer::EmbedderStackState::kUnknown);
InvokeGC(
isolate, options.type,
v8::EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
break;
case ExecutionType::kAsync: {
v8::HandleScope scope(isolate);
......
......@@ -67,9 +67,9 @@ class V8_EXPORT_PRIVATE Heap final : public cppgc::Heap {
struct GCConfig {
using StackState = Heap::StackState;
static GCConfig Default() { return {StackState::kUnknown}; }
static GCConfig Default() { return {StackState::kMayContainHeapPointers}; }
StackState stack_state = StackState::kUnknown;
StackState stack_state = StackState::kMayContainHeapPointers;
};
static Heap* From(cppgc::Heap* heap) { return static_cast<Heap*>(heap); }
......
......@@ -44,7 +44,7 @@ Marker::~Marker() {
// and should thus already be marked.
if (!not_fully_constructed_worklist_.IsEmpty()) {
#if DEBUG
DCHECK_NE(MarkingConfig::StackState::kEmpty, config_.stack_state_);
DCHECK_NE(MarkingConfig::StackState::kNoHeapPointers, config_.stack_state_);
NotFullyConstructedItem item;
NotFullyConstructedWorklist::View view(&not_fully_constructed_worklist_,
kMutatorThreadId);
......@@ -68,7 +68,7 @@ void Marker::StartMarking(MarkingConfig config) {
}
void Marker::FinishMarking() {
if (config_.stack_state_ == MarkingConfig::StackState::kEmpty) {
if (config_.stack_state_ == MarkingConfig::StackState::kNoHeapPointers) {
FlushNotFullyConstructedObjects();
}
AdvanceMarkingWithDeadline(v8::base::TimeDelta::Max());
......@@ -90,7 +90,7 @@ void Marker::ProcessWeakness() {
void Marker::VisitRoots() {
heap_->GetStrongPersistentRegion().Trace(marking_visitor_.get());
if (config_.stack_state_ != MarkingConfig::StackState::kEmpty)
if (config_.stack_state_ != MarkingConfig::StackState::kNoHeapPointers)
heap_->stack()->IteratePointers(marking_visitor_.get());
}
......
......@@ -48,8 +48,8 @@ class V8_EXPORT_PRIVATE Marker {
enum class ConcurrentMarking : uint8_t { kDisabled };
static MarkingConfig Default() {
return {StackState::kUnknown, IncrementalMarking::kDisabled,
ConcurrentMarking::kDisabled};
return {StackState::kMayContainHeapPointers,
IncrementalMarking::kDisabled, ConcurrentMarking::kDisabled};
}
explicit MarkingConfig(StackState stack_state)
......
......@@ -50,7 +50,8 @@ void LocalEmbedderHeapTracer::EnterFinalPause() {
remote_tracer_->EnterFinalPause(embedder_stack_state_);
// Resetting to state unknown as there may be follow up garbage collections
// triggered from callbacks that have a different stack state.
embedder_stack_state_ = EmbedderHeapTracer::kUnknown;
embedder_stack_state_ =
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers;
}
bool LocalEmbedderHeapTracer::Trace(double deadline) {
......@@ -68,7 +69,7 @@ void LocalEmbedderHeapTracer::SetEmbedderStackStateForNextFinalization(
if (!InUse()) return;
embedder_stack_state_ = stack_state;
if (EmbedderHeapTracer::EmbedderStackState::kEmpty == stack_state) {
if (EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers == stack_state) {
remote_tracer()->NotifyEmptyEmbedderStack();
}
}
......
......@@ -109,7 +109,7 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
EmbedderHeapTracer* remote_tracer_ = nullptr;
EmbedderHeapTracer::EmbedderStackState embedder_stack_state_ =
EmbedderHeapTracer::kUnknown;
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers;
// Indicates whether the embedder worklist was observed empty on the main
// thread. This is opportunistic as concurrent marking tasks may hold local
// segments of potential embedder fields to move to the main thread.
......@@ -138,7 +138,8 @@ class V8_EXPORT_PRIVATE EmbedderStackStateScope final {
: local_tracer_(local_tracer),
old_stack_state_(local_tracer_->embedder_stack_state_) {
local_tracer_->embedder_stack_state_ = stack_state;
if (EmbedderHeapTracer::EmbedderStackState::kEmpty == stack_state) {
if (EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers ==
stack_state) {
if (local_tracer->remote_tracer())
local_tracer->remote_tracer()->NotifyEmptyEmbedderStack();
}
......
......@@ -1594,7 +1594,7 @@ bool Heap::CollectGarbage(AllocationSpace space,
// their own state on the stack and recursively trigger GC.
EmbedderStackStateScope embedder_scope(
local_embedder_heap_tracer(),
EmbedderHeapTracer::EmbedderStackState::kUnknown);
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
if (scope.CheckReenter()) {
AllowHeapAllocation allow_allocation;
AllowJavascriptExecution allow_js(isolate());
......
......@@ -58,8 +58,8 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) {
V8::GetCurrentPlatform()->GetForegroundTaskRunner(isolate);
const EmbedderHeapTracer::EmbedderStackState stack_state =
taskrunner->NonNestableTasksEnabled()
? EmbedderHeapTracer::EmbedderStackState::kEmpty
: EmbedderHeapTracer::EmbedderStackState::kUnknown;
? EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers
: EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers;
auto task =
std::make_unique<Task>(heap->isolate(), this, stack_state, task_type);
if (task_type == TaskType::kNormal) {
......
......@@ -281,7 +281,8 @@ TEST(GarbageCollectionForTesting) {
heap::TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
int saved_gc_counter = i_isolate->heap()->gc_count();
tracer.GarbageCollectionForTesting(EmbedderHeapTracer::kUnknown);
tracer.GarbageCollectionForTesting(
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
CHECK_GT(i_isolate->heap()->gc_count(), saved_gc_counter);
}
......
......@@ -37,8 +37,9 @@ class TestWithHeapWithCustomSpaces : public testing::TestWithPlatform {
}
void PreciseGC() {
heap_->ForceGarbageCollectionSlow("TestWithHeapWithCustomSpaces", "Testing",
Heap::GCConfig::StackState::kEmpty);
heap_->ForceGarbageCollectionSlow(
"TestWithHeapWithCustomSpaces", "Testing",
Heap::GCConfig::StackState::kNoHeapPointers);
}
cppgc::Heap* GetHeap() const { return heap_.get(); }
......
......@@ -22,11 +22,11 @@ class GCHeapTest : public testing::TestWithHeap {
public:
void ConservativeGC() {
internal::Heap::From(GetHeap())->CollectGarbage(
{Heap::GCConfig::StackState::kNonEmpty});
{Heap::GCConfig::StackState::kMayContainHeapPointers});
}
void PreciseGC() {
internal::Heap::From(GetHeap())->CollectGarbage(
{Heap::GCConfig::StackState::kEmpty});
{Heap::GCConfig::StackState::kNoHeapPointers});
}
};
......@@ -64,7 +64,7 @@ namespace {
const void* ConservativeGCReturningObject(cppgc::Heap* heap,
const void* volatile object) {
internal::Heap::From(heap)->CollectGarbage(
{Heap::GCConfig::StackState::kNonEmpty});
{Heap::GCConfig::StackState::kMayContainHeapPointers});
return object;
}
......
......@@ -55,7 +55,7 @@ TEST_F(MarkerTest, PersistentIsMarked) {
Persistent<GCed> object = MakeGarbageCollected<GCed>(GetHeap());
HeapObjectHeader& header = HeapObjectHeader::FromPayload(object);
EXPECT_FALSE(header.IsMarked());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(header.IsMarked());
}
......@@ -64,7 +64,7 @@ TEST_F(MarkerTest, ReachableMemberIsMarked) {
parent->SetChild(MakeGarbageCollected<GCed>(GetHeap()));
HeapObjectHeader& header = HeapObjectHeader::FromPayload(parent->child());
EXPECT_FALSE(header.IsMarked());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(header.IsMarked());
}
......@@ -72,14 +72,14 @@ TEST_F(MarkerTest, UnreachableMemberIsNotMarked) {
Member<GCed> object = MakeGarbageCollected<GCed>(GetHeap());
HeapObjectHeader& header = HeapObjectHeader::FromPayload(object);
EXPECT_FALSE(header.IsMarked());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_FALSE(header.IsMarked());
}
TEST_F(MarkerTest, ObjectReachableFromStackIsMarked) {
GCed* object = MakeGarbageCollected<GCed>(GetHeap());
EXPECT_FALSE(HeapObjectHeader::FromPayload(object).IsMarked());
DoMarking(MarkingConfig(MarkingConfig::StackState::kNonEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kMayContainHeapPointers));
EXPECT_TRUE(HeapObjectHeader::FromPayload(object).IsMarked());
access(object);
}
......@@ -88,7 +88,7 @@ TEST_F(MarkerTest, ObjectReachableOnlyFromStackIsNotMarkedIfStackIsEmpty) {
GCed* object = MakeGarbageCollected<GCed>(GetHeap());
HeapObjectHeader& header = HeapObjectHeader::FromPayload(object);
EXPECT_FALSE(header.IsMarked());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_FALSE(header.IsMarked());
access(object);
}
......@@ -97,14 +97,14 @@ TEST_F(MarkerTest, WeakReferenceToUnreachableObjectIsCleared) {
{
WeakPersistent<GCed> weak_object = MakeGarbageCollected<GCed>(GetHeap());
EXPECT_TRUE(weak_object);
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_FALSE(weak_object);
}
{
Persistent<GCed> parent = MakeGarbageCollected<GCed>(GetHeap());
parent->SetWeakChild(MakeGarbageCollected<GCed>(GetHeap()));
EXPECT_TRUE(parent->weak_child());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_FALSE(parent->weak_child());
}
}
......@@ -115,7 +115,7 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
Persistent<GCed> object = MakeGarbageCollected<GCed>(GetHeap());
WeakPersistent<GCed> weak_object(object);
EXPECT_TRUE(weak_object);
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(weak_object);
}
{
......@@ -123,7 +123,7 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
Persistent<GCed> parent = MakeGarbageCollected<GCed>(GetHeap());
parent->SetWeakChild(object);
EXPECT_TRUE(parent->weak_child());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(parent->weak_child());
}
// Reachable from Member
......@@ -132,7 +132,7 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
WeakPersistent<GCed> weak_object(MakeGarbageCollected<GCed>(GetHeap()));
parent->SetChild(weak_object);
EXPECT_TRUE(weak_object);
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(weak_object);
}
{
......@@ -140,7 +140,7 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
parent->SetChild(MakeGarbageCollected<GCed>(GetHeap()));
parent->SetWeakChild(parent->child());
EXPECT_TRUE(parent->weak_child());
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(parent->weak_child());
}
// Reachable from stack
......@@ -148,7 +148,8 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
GCed* object = MakeGarbageCollected<GCed>(GetHeap());
WeakPersistent<GCed> weak_object(object);
EXPECT_TRUE(weak_object);
DoMarking(MarkingConfig(MarkingConfig::StackState::kNonEmpty));
DoMarking(
MarkingConfig(MarkingConfig::StackState::kMayContainHeapPointers));
EXPECT_TRUE(weak_object);
access(object);
}
......@@ -157,7 +158,8 @@ TEST_F(MarkerTest, WeakReferenceToReachableObjectIsNotCleared) {
Persistent<GCed> parent = MakeGarbageCollected<GCed>(GetHeap());
parent->SetWeakChild(object);
EXPECT_TRUE(parent->weak_child());
DoMarking(MarkingConfig(MarkingConfig::StackState::kNonEmpty));
DoMarking(
MarkingConfig(MarkingConfig::StackState::kMayContainHeapPointers));
EXPECT_TRUE(parent->weak_child());
access(object);
}
......@@ -172,7 +174,7 @@ TEST_F(MarkerTest, DeepHierarchyIsMarked) {
parent->SetWeakChild(parent->child());
parent = parent->child();
}
DoMarking(MarkingConfig(MarkingConfig::StackState::kEmpty));
DoMarking(MarkingConfig(MarkingConfig::StackState::kNoHeapPointers));
EXPECT_TRUE(HeapObjectHeader::FromPayload(root).IsMarked());
parent = root;
for (int i = 0; i < kHierarchyDepth; ++i) {
......
......@@ -29,8 +29,8 @@ class TestWithHeap : public TestWithPlatform {
TestWithHeap();
void PreciseGC() {
heap_->ForceGarbageCollectionSlow("TestWithHeap", "Testing",
Heap::GCConfig::StackState::kEmpty);
heap_->ForceGarbageCollectionSlow(
"TestWithHeap", "Testing", Heap::GCConfig::StackState::kNoHeapPointers);
}
cppgc::Heap* GetHeap() const { return heap_.get(); }
......
......@@ -33,7 +33,7 @@ class MockEmbedderHeapTracer : public EmbedderHeapTracer {
public:
MOCK_METHOD1(TracePrologue, void(EmbedderHeapTracer::TraceFlags));
MOCK_METHOD1(TraceEpilogue, void(EmbedderHeapTracer::TraceSummary*));
MOCK_METHOD1(EnterFinalPause, void(EmbedderHeapTracer::EmbedderStackState));
MOCK_METHOD1(EnterFinalPause, void(EmbedderStackState));
MOCK_METHOD0(IsTracingDone, bool());
MOCK_METHOD1(RegisterV8References,
void(const std::vector<std::pair<void*, void*> >&));
......@@ -105,7 +105,10 @@ TEST(LocalEmbedderHeapTracer, EnterFinalPauseDefaultStackStateUnkown) {
LocalEmbedderHeapTracer local_tracer(nullptr);
local_tracer.SetRemoteTracer(&remote_tracer);
// The default stack state is expected to be unkown.
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kUnknown));
EXPECT_CALL(
remote_tracer,
EnterFinalPause(
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers));
local_tracer.EnterFinalPause();
}
......@@ -115,8 +118,10 @@ TEST_F(LocalEmbedderHeapTracerWithIsolate,
LocalEmbedderHeapTracer local_tracer(isolate());
local_tracer.SetRemoteTracer(&remote_tracer);
local_tracer.SetEmbedderStackStateForNextFinalization(
EmbedderHeapTracer::kEmpty);
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers);
EXPECT_CALL(
remote_tracer,
EnterFinalPause(EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers));
local_tracer.EnterFinalPause();
}
......@@ -126,8 +131,11 @@ TEST_F(LocalEmbedderHeapTracerWithIsolate, TemporaryEmbedderStackState) {
local_tracer.SetRemoteTracer(&remote_tracer);
// Default is unknown, see above.
{
EmbedderStackStateScope scope(&local_tracer, EmbedderHeapTracer::kEmpty);
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
EmbedderStackStateScope scope(
&local_tracer, EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers);
EXPECT_CALL(remote_tracer,
EnterFinalPause(
EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers));
local_tracer.EnterFinalPause();
}
}
......@@ -139,14 +147,21 @@ TEST_F(LocalEmbedderHeapTracerWithIsolate,
local_tracer.SetRemoteTracer(&remote_tracer);
// Default is unknown, see above.
{
EmbedderStackStateScope scope(&local_tracer, EmbedderHeapTracer::kEmpty);
EmbedderStackStateScope scope(
&local_tracer, EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers);
{
EmbedderStackStateScope scope(&local_tracer,
EmbedderHeapTracer::kUnknown);
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kUnknown));
EmbedderStackStateScope scope(
&local_tracer,
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers);
EXPECT_CALL(
remote_tracer,
EnterFinalPause(
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers));
local_tracer.EnterFinalPause();
}
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
EXPECT_CALL(remote_tracer,
EnterFinalPause(
EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers));
local_tracer.EnterFinalPause();
}
}
......@@ -156,10 +171,15 @@ TEST_F(LocalEmbedderHeapTracerWithIsolate, EnterFinalPauseStackStateResets) {
LocalEmbedderHeapTracer local_tracer(isolate());
local_tracer.SetRemoteTracer(&remote_tracer);
local_tracer.SetEmbedderStackStateForNextFinalization(
EmbedderHeapTracer::kEmpty);
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers);
EXPECT_CALL(
remote_tracer,
EnterFinalPause(EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers));
local_tracer.EnterFinalPause();
EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kUnknown));
EXPECT_CALL(
remote_tracer,
EnterFinalPause(
EmbedderHeapTracer::EmbedderStackState::kMayContainHeapPointers));
local_tracer.EnterFinalPause();
}
......
......@@ -27,6 +27,9 @@ config("external_config") {
if (is_component_build) {
defines = [ "USING_V8_DEBUG_HELPER" ]
}
configs = [ "../..:external_config" ]
include_dirs = [ "." ]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment