mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
deps: V8: partially cherry-pick 8953e49478
Very partial cherry-pick of upstream commit v8/v8@8953e49478 that fixes a hang that shows up in debug builds because of a buggy sanity check when computing relationships between command line flags. Example of the hang: #include "v8.h" #include "libplatform/libplatform.h" int main(void) { // works: v8::V8::SetFlagsFromString("--gc-global --noincremental-marking"); v8::V8::SetFlagsFromString("--gc-global"); v8::V8::SetFlagsFromString("--noincremental-marking"); v8::V8::InitializePlatform(v8::platform::NewDefaultPlatform().release()); v8::V8::Initialize(); // hangs in ComputeFlagListHash when defined(DEBUG) } PR-URL: https://github.com/nodejs/node/pull/55274 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
09999491bf
commit
2f65b3fd07
1 file changed
+5
Vendored
+5
@@ -5,6 +5,8 @@
|
||||
#ifndef V8_FLAGS_FLAGS_IMPL_H_
|
||||
#define V8_FLAGS_FLAGS_IMPL_H_
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#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<const Flag*> 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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user