Commit 7e233997 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[serializer] Disable gc-stats during deserialisation

Objects might be in a partially initialized state during deserialization
which makes collecting gc-stats tricky.

Bug: v8:12678
Change-Id: I154328adda432bf8e3588c96455c1bd8d527ef43
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3635722Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80446}
parent 395350c0
......@@ -254,6 +254,25 @@ class Deserializer : public SerializerDeserializer {
const bool should_rehash_;
std::vector<Handle<HeapObject>> to_rehash_;
// Do not collect any gc stats during deserialization since objects might
// be in an invalid state
class V8_NODISCARD DisableGCStats {
public:
explicit DisableGCStats() {
if (V8_LIKELY(!TracingFlags::is_gc_stats_enabled())) return;
was_enabled_ = true;
TracingFlags::gc_stats = false;
}
~DisableGCStats() {
if (V8_LIKELY(!was_enabled_)) return;
TracingFlags::gc_stats = true;
}
private:
bool was_enabled_ = false;
};
DisableGCStats no_gc_stats_;
#ifdef DEBUG
uint32_t num_api_references_;
......
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