From 260f1f4608b191537f404cee01d35ffbb1e3be54 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 17 Sep 2024 08:29:34 +0200 Subject: [PATCH] deps: patch V8 to 12.8.374.33 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/v8/v8/compare/12.8.374.32...12.8.374.33 PR-URL: https://github.com/nodejs/node/pull/54952 Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca Reviewed-By: Rafael Gonzaga --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/deoptimizer/deoptimizer.cc | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 827a71f9ac63f2..ac33d3075e472c 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 12 #define V8_MINOR_VERSION 8 #define V8_BUILD_NUMBER 374 -#define V8_PATCH_LEVEL 32 +#define V8_PATCH_LEVEL 33 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/deoptimizer/deoptimizer.cc b/deps/v8/src/deoptimizer/deoptimizer.cc index ec8c82d7e020af..ce883f712e1e8c 100644 --- a/deps/v8/src/deoptimizer/deoptimizer.cc +++ b/deps/v8/src/deoptimizer/deoptimizer.cc @@ -338,6 +338,21 @@ class ActivationsFinder : public ThreadVisitor { // for the trampoline to the deoptimizer call respective to each code, and use // it to replace the current pc on the stack. void VisitThread(Isolate* isolate, ThreadLocalTop* top) override { +#if V8_ENABLE_WEBASSEMBLY + // Also visit the ancestors of the active stack for wasm stack switching. + // We don't need to visit suspended stacks at the moment, because 1) they + // only contain wasm frames and 2) wasm does not do lazy deopt. Revisit this + // if one of these assumptions changes. + Tagged continuation; + if (top == isolate->thread_local_top()) { + Tagged maybe_continuation = + isolate->root(RootIndex::kActiveContinuation); + if (!IsUndefined(maybe_continuation)) { + continuation = Cast(maybe_continuation); + } + } +#endif + for (StackFrameIterator it(isolate, top); !it.done(); it.Advance()) { if (it.frame()->is_optimized()) { Tagged code = it.frame()->GcSafeLookupCode(); @@ -371,6 +386,19 @@ class ActivationsFinder : public ThreadVisitor { } } } + +#if V8_ENABLE_WEBASSEMBLY + // We reached the base of the wasm stack. Follow the chain of + // continuations to find the parent stack and reset the iterator. + if (it.frame()->type() == StackFrame::STACK_SWITCH) { + CHECK_EQ(top, isolate->thread_local_top()); + DCHECK(!continuation.is_null()); + continuation = Cast(continuation->parent()); + wasm::StackMemory* parent = + reinterpret_cast(continuation->stack()); + it.Reset(top, parent); + } +#endif } }