Skip to content

Commit

Permalink
deps: patch V8 to 12.8.374.32
Browse files Browse the repository at this point in the history
Refs: v8/v8@12.8.374.31...12.8.374.32
PR-URL: nodejs#54884
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
nodejs-github-bot authored Sep 13, 2024
1 parent e21984b commit b887942
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 12
#define V8_MINOR_VERSION 8
#define V8_BUILD_NUMBER 374
#define V8_PATCH_LEVEL 31
#define V8_PATCH_LEVEL 32

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
29 changes: 27 additions & 2 deletions deps/v8/src/execution/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2125,10 +2125,16 @@ Tagged<Object> Isolate::UnwindAndFindHandler() {
// We reached the base of the wasm stack. Follow the chain of
// continuations to find the parent stack and reset the iterator.
DCHECK(!continuation.is_null());
continuation = Cast<WasmContinuationObject>(continuation->parent());
wasm::StackMemory* stack =
reinterpret_cast<wasm::StackMemory*>(continuation->stack());
iter.Reset(thread_local_top(), stack);
RetireWasmStack(stack);
continuation = Cast<WasmContinuationObject>(continuation->parent());
wasm::StackMemory* parent =
reinterpret_cast<wasm::StackMemory*>(continuation->stack());
parent->jmpbuf()->state = wasm::JumpBuffer::Active;
roots_table().slot(RootIndex::kActiveContinuation).store(continuation);
SyncStackLimit();
iter.Reset(thread_local_top(), parent);
}
}
#endif
Expand Down Expand Up @@ -3642,6 +3648,25 @@ void Isolate::UpdateCentralStackInfo() {
}
}

void Isolate::RetireWasmStack(wasm::StackMemory* stack) {
stack->jmpbuf()->state = wasm::JumpBuffer::Retired;
size_t index = stack->index();
// We can only return from a stack that was still in the global list.
DCHECK_LT(index, wasm_stacks().size());
std::unique_ptr<wasm::StackMemory> stack_ptr =
std::move(wasm_stacks()[index]);
DCHECK_EQ(stack_ptr.get(), stack);
if (index != wasm_stacks().size() - 1) {
wasm_stacks()[index] = std::move(wasm_stacks().back());
wasm_stacks()[index]->set_index(index);
}
wasm_stacks().pop_back();
for (size_t i = 0; i < wasm_stacks().size(); ++i) {
SLOW_DCHECK(wasm_stacks()[i]->index() == i);
}
stack_pool().Add(std::move(stack_ptr));
}

wasm::WasmOrphanedGlobalHandle* Isolate::NewWasmOrphanedGlobalHandle() {
return wasm::WasmEngine::NewOrphanedGlobalHandle(&wasm_orphaned_handle_);
}
Expand Down
6 changes: 6 additions & 0 deletions deps/v8/src/execution/isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,12 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
void UpdateCentralStackInfo();

void SyncStackLimit();

// To be called when returning from {stack}, or when an exception crosses the
// stack boundary. This updates the {StackMemory} object and the global
// {wasm_stacks_} list. This does *not* update the ActiveContinuation root and
// the stack limit.
void RetireWasmStack(wasm::StackMemory* stack);
#else
bool IsOnCentralStack() { return true; }
#endif
Expand Down
4 changes: 0 additions & 4 deletions deps/v8/src/wasm/stacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ void StackPool::Add(std::unique_ptr<StackMemory> stack) {
return;
}
size_ += stack->size_;
#if DEBUG
constexpr uint8_t kZapValue = 0xab;
memset(stack->limit_, kZapValue, stack->size_);
#endif
freelist_.push_back(std::move(stack));
}

Expand Down
16 changes: 3 additions & 13 deletions deps/v8/src/wasm/wasm-external-refs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,19 +675,9 @@ void return_switch(Isolate* isolate, Address raw_continuation) {

Tagged<WasmContinuationObject> continuation =
Cast<WasmContinuationObject>(Tagged<Object>{raw_continuation});
size_t index = reinterpret_cast<StackMemory*>(continuation->stack())->index();
// We can only return from a stack that was still in the global list.
DCHECK_LT(index, isolate->wasm_stacks().size());
std::unique_ptr<StackMemory> stack = std::move(isolate->wasm_stacks()[index]);
if (index != isolate->wasm_stacks().size() - 1) {
isolate->wasm_stacks()[index] = std::move(isolate->wasm_stacks().back());
isolate->wasm_stacks()[index]->set_index(index);
}
isolate->wasm_stacks().pop_back();
for (size_t i = 0; i < isolate->wasm_stacks().size(); ++i) {
SLOW_DCHECK(isolate->wasm_stacks()[i]->index() == i);
}
isolate->stack_pool().Add(std::move(stack));
wasm::StackMemory* stack =
reinterpret_cast<StackMemory*>(continuation->stack());
isolate->RetireWasmStack(stack);
isolate->SyncStackLimit();
}

Expand Down

0 comments on commit b887942

Please sign in to comment.