[wasm] Fix stack size estimate
We were just counting the number of stack elements instead of their actual memory usage. This limits recursion a lot more and helps avoiding OOM situations. R=titzer@chromium.org Bug: chromium:938739 Change-Id: I0e0ec2949f9fbad9c9e2c8677ec0223d5cd6a24b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1526006 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#60264}
This commit is contained in:
parent
277736cfd1
commit
c853d114a9
@ -2344,8 +2344,8 @@ class ThreadImpl {
|
||||
// stack actually lies in zone memory.
|
||||
const size_t stack_size_limit = FLAG_stack_size * KB;
|
||||
// Sum up the value stack size and the control stack size.
|
||||
const size_t current_stack_size =
|
||||
(sp_ - stack_.get()) + frames_.size() * sizeof(Frame);
|
||||
const size_t current_stack_size = (sp_ - stack_.get()) * sizeof(*sp_) +
|
||||
frames_.size() * sizeof(frames_[0]);
|
||||
if (V8_LIKELY(current_stack_size <= stack_size_limit)) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user