Commit b9ccf865 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][liftoff][eh] Fix try info cache state leak

Allocate the TryInfo in a unique_ptr to ensure that its destructor is
called when the corresponding control block is popped from the control
stack.
In particular, the cache state allocates memory on the heap which is
otherwise never freed.

R=clemensb@chromium.org

Bug: chromium:1185127
Change-Id: I3aee5573f99ef94c13d0649413a4e647a32bc555
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2739649
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73431}
parent 26d85ace
......@@ -376,7 +376,7 @@ class LiftoffCompiler {
std::unique_ptr<ElseState> else_state;
LiftoffAssembler::CacheState label_state;
MovableLabel label;
TryInfo* try_info = nullptr;
std::unique_ptr<TryInfo> try_info;
// Number of exceptions on the stack below this control.
int num_exceptions = 0;
......@@ -1064,7 +1064,7 @@ class LiftoffCompiler {
}
void Try(FullDecoder* decoder, Control* block) {
block->try_info = compilation_zone_->New<TryInfo>();
block->try_info = std::make_unique<TryInfo>();
block->try_info->previous_catch = current_catch_;
current_catch_ = static_cast<int32_t>(decoder->control_depth() - 1);
PushControl(block);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment