Commit 1461e092 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

cppgc-js: Explicitly initialize a moved-away struct

The struct is reused across various GC cycles and std::move() may leave
the vector in valid but unspecified state.

Change-Id: I3c40795be7397d015b96116d3549953024b98808
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3160197
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76811}
parent b2c5afb9
...@@ -254,6 +254,7 @@ void CppHeap::MetricRecorderAdapter::AddMainThreadEvent( ...@@ -254,6 +254,7 @@ void CppHeap::MetricRecorderAdapter::AddMainThreadEvent(
if (incremental_mark_batched_events_.events.size() == kMaxBatchedEvents) { if (incremental_mark_batched_events_.events.size() == kMaxBatchedEvents) {
recorder->AddMainThreadEvent(std::move(incremental_mark_batched_events_), recorder->AddMainThreadEvent(std::move(incremental_mark_batched_events_),
GetContextId()); GetContextId());
incremental_mark_batched_events_ = {};
} }
} }
...@@ -272,6 +273,7 @@ void CppHeap::MetricRecorderAdapter::AddMainThreadEvent( ...@@ -272,6 +273,7 @@ void CppHeap::MetricRecorderAdapter::AddMainThreadEvent(
if (incremental_sweep_batched_events_.events.size() == kMaxBatchedEvents) { if (incremental_sweep_batched_events_.events.size() == kMaxBatchedEvents) {
recorder->AddMainThreadEvent(std::move(incremental_sweep_batched_events_), recorder->AddMainThreadEvent(std::move(incremental_sweep_batched_events_),
GetContextId()); GetContextId());
incremental_sweep_batched_events_ = {};
} }
} }
...@@ -282,10 +284,12 @@ void CppHeap::MetricRecorderAdapter::FlushBatchedIncrementalEvents() { ...@@ -282,10 +284,12 @@ void CppHeap::MetricRecorderAdapter::FlushBatchedIncrementalEvents() {
if (!incremental_mark_batched_events_.events.empty()) { if (!incremental_mark_batched_events_.events.empty()) {
recorder->AddMainThreadEvent(std::move(incremental_mark_batched_events_), recorder->AddMainThreadEvent(std::move(incremental_mark_batched_events_),
GetContextId()); GetContextId());
incremental_mark_batched_events_ = {};
} }
if (!incremental_sweep_batched_events_.events.empty()) { if (!incremental_sweep_batched_events_.events.empty()) {
recorder->AddMainThreadEvent(std::move(incremental_sweep_batched_events_), recorder->AddMainThreadEvent(std::move(incremental_sweep_batched_events_),
GetContextId()); GetContextId());
incremental_sweep_batched_events_ = {};
} }
} }
......
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