diff --git a/src/logging/code-events.h b/src/logging/code-events.h index 01d1c5ea5e..cb815cc022 100644 --- a/src/logging/code-events.h +++ b/src/logging/code-events.h @@ -124,10 +124,6 @@ class Logger { if (position != listeners_.end()) return false; // Add the listener to the end and update the element listeners_.push_back(listener); - if (!_is_listening_to_code_events) { - _is_listening_to_code_events |= listener->is_listening_to_code_events(); - } - DCHECK_EQ(_is_listening_to_code_events, IsListeningToCodeEvents()); return true; } void RemoveListener(LogEventListener* listener) { @@ -135,15 +131,13 @@ class Logger { auto position = std::find(listeners_.begin(), listeners_.end(), listener); if (position == listeners_.end()) return; listeners_.erase(position); - if (listener->is_listening_to_code_events()) { - _is_listening_to_code_events = IsListeningToCodeEvents(); - } - DCHECK_EQ(_is_listening_to_code_events, IsListeningToCodeEvents()); } bool is_listening_to_code_events() const { - DCHECK_EQ(_is_listening_to_code_events, IsListeningToCodeEvents()); - return _is_listening_to_code_events; + for (auto listener : listeners_) { + if (listener->is_listening_to_code_events()) return true; + } + return false; } void CodeCreateEvent(CodeTag tag, Handle code, @@ -264,16 +258,8 @@ class Logger { } private: - bool IsListeningToCodeEvents() const { - for (auto listener : listeners_) { - if (listener->is_listening_to_code_events()) return true; - } - return false; - } - std::vector listeners_; base::Mutex mutex_; - bool _is_listening_to_code_events = false; }; } // namespace internal diff --git a/test/mjsunit/regress-1400809.js b/test/mjsunit/regress-1400809.js new file mode 100644 index 0000000000..4b559fdca1 --- /dev/null +++ b/test/mjsunit/regress-1400809.js @@ -0,0 +1,11 @@ +// Copyright 2022 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. + +// Flags: --expose-gc --logfile='+' --log + +const log = d8.log.getAndStop(); +gc(); +function __f_6() { +} +__v_1 = __f_6();