diff --git a/deps/v8/src/flags/flags-impl.h b/deps/v8/src/flags/flags-impl.h index d2d440c0263876..111b9b5b9c145b 100644 --- a/deps/v8/src/flags/flags-impl.h +++ b/deps/v8/src/flags/flags-impl.h @@ -5,6 +5,8 @@ #ifndef V8_FLAGS_FLAGS_IMPL_H_ #define V8_FLAGS_FLAGS_IMPL_H_ +#include + #include "src/base/macros.h" #include "src/base/optional.h" #include "src/base/vector.h" @@ -91,9 +93,12 @@ struct Flag { #ifdef DEBUG bool ImpliedBy(const void* ptr) const { const Flag* current = this->implied_by_ptr_; + std::unordered_set visited_flags; while (current != nullptr) { + visited_flags.insert(current); if (current->PointsTo(ptr)) return true; current = current->implied_by_ptr_; + if (visited_flags.contains(current)) break; } return false; }