Skip to content

Commit

Permalink
[wasm] Reload cached instance fields in catch handler
Browse files Browse the repository at this point in the history
The memory start and size are reloaded after a call in case the call
grows the memory. We should also reload them when the call throws.

We don't need to reload in the 'delegate' case since this will be
handled by the catch handler that it delegates to.

R=jkummerow@chromium.org

Bug: chromium:1377816
Change-Id: Ied1cdb6ed83c1de6a5992df21d776aca9ccf02e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3982115
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83959}
  • Loading branch information
thibaudmichaud authored and V8 LUCI CQ committed Oct 27, 2022
1 parent 648958b commit f517e51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wasm/graph-builder-interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class WasmGraphBuildingInterface {
struct TryInfo : public ZoneObject {
SsaEnv* catch_env;
TFNode* exception = nullptr;
bool first_catch = true;

bool might_throw() const { return exception != nullptr; }

Expand Down Expand Up @@ -936,6 +937,10 @@ class WasmGraphBuildingInterface {

TFNode* exception = block->try_info->exception;
SetEnv(block->try_info->catch_env);
if (block->try_info->first_catch) {
LoadContextIntoSsa(ssa_env_, decoder);
block->try_info->first_catch = false;
}

TFNode* if_catch = nullptr;
TFNode* if_no_catch = nullptr;
Expand Down Expand Up @@ -1013,6 +1018,9 @@ class WasmGraphBuildingInterface {
}

SetEnv(block->try_info->catch_env);
if (block->try_info->first_catch) {
LoadContextIntoSsa(ssa_env_, decoder);
}
}

void AtomicOp(FullDecoder* decoder, WasmOpcode opcode,
Expand Down

0 comments on commit f517e51

Please sign in to comment.