Skip to content

Commit b887942

Browse files
deps: patch V8 to 12.8.374.32
Refs: v8/v8@12.8.374.31...12.8.374.32 PR-URL: #54884 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e21984b commit b887942

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 12
1212
#define V8_MINOR_VERSION 8
1313
#define V8_BUILD_NUMBER 374
14-
#define V8_PATCH_LEVEL 31
14+
#define V8_PATCH_LEVEL 32
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/execution/isolate.cc

+27-2
Original file line numberDiff line numberDiff line change
@@ -2125,10 +2125,16 @@ Tagged<Object> Isolate::UnwindAndFindHandler() {
21252125
// We reached the base of the wasm stack. Follow the chain of
21262126
// continuations to find the parent stack and reset the iterator.
21272127
DCHECK(!continuation.is_null());
2128-
continuation = Cast<WasmContinuationObject>(continuation->parent());
21292128
wasm::StackMemory* stack =
21302129
reinterpret_cast<wasm::StackMemory*>(continuation->stack());
2131-
iter.Reset(thread_local_top(), stack);
2130+
RetireWasmStack(stack);
2131+
continuation = Cast<WasmContinuationObject>(continuation->parent());
2132+
wasm::StackMemory* parent =
2133+
reinterpret_cast<wasm::StackMemory*>(continuation->stack());
2134+
parent->jmpbuf()->state = wasm::JumpBuffer::Active;
2135+
roots_table().slot(RootIndex::kActiveContinuation).store(continuation);
2136+
SyncStackLimit();
2137+
iter.Reset(thread_local_top(), parent);
21322138
}
21332139
}
21342140
#endif
@@ -3642,6 +3648,25 @@ void Isolate::UpdateCentralStackInfo() {
36423648
}
36433649
}
36443650

3651+
void Isolate::RetireWasmStack(wasm::StackMemory* stack) {
3652+
stack->jmpbuf()->state = wasm::JumpBuffer::Retired;
3653+
size_t index = stack->index();
3654+
// We can only return from a stack that was still in the global list.
3655+
DCHECK_LT(index, wasm_stacks().size());
3656+
std::unique_ptr<wasm::StackMemory> stack_ptr =
3657+
std::move(wasm_stacks()[index]);
3658+
DCHECK_EQ(stack_ptr.get(), stack);
3659+
if (index != wasm_stacks().size() - 1) {
3660+
wasm_stacks()[index] = std::move(wasm_stacks().back());
3661+
wasm_stacks()[index]->set_index(index);
3662+
}
3663+
wasm_stacks().pop_back();
3664+
for (size_t i = 0; i < wasm_stacks().size(); ++i) {
3665+
SLOW_DCHECK(wasm_stacks()[i]->index() == i);
3666+
}
3667+
stack_pool().Add(std::move(stack_ptr));
3668+
}
3669+
36453670
wasm::WasmOrphanedGlobalHandle* Isolate::NewWasmOrphanedGlobalHandle() {
36463671
return wasm::WasmEngine::NewOrphanedGlobalHandle(&wasm_orphaned_handle_);
36473672
}

deps/v8/src/execution/isolate.h

+6
Original file line numberDiff line numberDiff line change
@@ -2173,6 +2173,12 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
21732173
void UpdateCentralStackInfo();
21742174

21752175
void SyncStackLimit();
2176+
2177+
// To be called when returning from {stack}, or when an exception crosses the
2178+
// stack boundary. This updates the {StackMemory} object and the global
2179+
// {wasm_stacks_} list. This does *not* update the ActiveContinuation root and
2180+
// the stack limit.
2181+
void RetireWasmStack(wasm::StackMemory* stack);
21762182
#else
21772183
bool IsOnCentralStack() { return true; }
21782184
#endif

deps/v8/src/wasm/stacks.cc

-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ void StackPool::Add(std::unique_ptr<StackMemory> stack) {
6565
return;
6666
}
6767
size_ += stack->size_;
68-
#if DEBUG
69-
constexpr uint8_t kZapValue = 0xab;
70-
memset(stack->limit_, kZapValue, stack->size_);
71-
#endif
7268
freelist_.push_back(std::move(stack));
7369
}
7470

deps/v8/src/wasm/wasm-external-refs.cc

+3-13
Original file line numberDiff line numberDiff line change
@@ -675,19 +675,9 @@ void return_switch(Isolate* isolate, Address raw_continuation) {
675675

676676
Tagged<WasmContinuationObject> continuation =
677677
Cast<WasmContinuationObject>(Tagged<Object>{raw_continuation});
678-
size_t index = reinterpret_cast<StackMemory*>(continuation->stack())->index();
679-
// We can only return from a stack that was still in the global list.
680-
DCHECK_LT(index, isolate->wasm_stacks().size());
681-
std::unique_ptr<StackMemory> stack = std::move(isolate->wasm_stacks()[index]);
682-
if (index != isolate->wasm_stacks().size() - 1) {
683-
isolate->wasm_stacks()[index] = std::move(isolate->wasm_stacks().back());
684-
isolate->wasm_stacks()[index]->set_index(index);
685-
}
686-
isolate->wasm_stacks().pop_back();
687-
for (size_t i = 0; i < isolate->wasm_stacks().size(); ++i) {
688-
SLOW_DCHECK(isolate->wasm_stacks()[i]->index() == i);
689-
}
690-
isolate->stack_pool().Add(std::move(stack));
678+
wasm::StackMemory* stack =
679+
reinterpret_cast<StackMemory*>(continuation->stack());
680+
isolate->RetireWasmStack(stack);
691681
isolate->SyncStackLimit();
692682
}
693683

0 commit comments

Comments
 (0)