Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cherry-pick 8b040cb69e96 from v8 #35889

Merged
merged 3 commits into from Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions patches/v8/.patches
Expand Up @@ -11,3 +11,4 @@ revert_runtime_dhceck_terminating_exception_in_microtasks.patch
allow_disabling_of_v8_sandboxed_pointers.patch
chore_disable_is_execution_terminating_dcheck.patch
ext-code-space_fix_coderange_allocation_logic.patch
cherry-pick-8b040cb69e96.patch
47 changes: 47 additions & 0 deletions patches/v8/cherry-pick-8b040cb69e96.patch
@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jakob Kummerow <jkummerow@chromium.org>
Date: Fri, 23 Sep 2022 13:13:37 +0200
Subject: Fix a register reuse corner case

Fixed: chromium:1366399
(cherry picked from commit 6c214db445827707d65be08d177c9a4257a03a7b)

Change-Id: I72cf30cbd31a21acb44b524a194acfb89d8fecbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3925795
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/branch-heads/10.6@{#29}
Cr-Branched-From: 41bc7435693fbce8ef86753cd9239e30550a3e2d-refs/heads/10.6.194@{#1}
Cr-Branched-From: d5f29b929ce7746409201d77f44048f3e9529b40-refs/heads/main@{#82548}

diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc
index 2b269516dd302c06a3eebc1c9d70f4d36612b942..3f768f8f5adcc1bfd1d64e68c638a5bf2e737051 100644
--- a/src/wasm/baseline/liftoff-compiler.cc
+++ b/src/wasm/baseline/liftoff-compiler.cc
@@ -1421,9 +1421,11 @@ class LiftoffCompiler {
__ MergeFullStackWith(c->label_state, *__ cache_state());
__ emit_jump(c->label.get());
}
- // Merge the else state into the end state.
+ // Merge the else state into the end state. Set this state as the current
+ // state first so helper functions know which registers are in use.
__ bind(c->else_state->label.get());
- __ MergeFullStackWith(c->label_state, c->else_state->state);
+ __ cache_state()->Steal(c->else_state->state);
+ __ MergeFullStackWith(c->label_state, *__ cache_state());
__ cache_state()->Steal(c->label_state);
} else if (c->reachable()) {
// No merge yet at the end of the if, but we need to create a merge for
@@ -1435,9 +1437,11 @@ class LiftoffCompiler {
c->stack_depth + c->num_exceptions);
__ MergeFullStackWith(c->label_state, *__ cache_state());
__ emit_jump(c->label.get());
- // Merge the else state into the end state.
+ // Merge the else state into the end state. Set this state as the current
+ // state first so helper functions know which registers are in use.
__ bind(c->else_state->label.get());
- __ MergeFullStackWith(c->label_state, c->else_state->state);
+ __ cache_state()->Steal(c->else_state->state);
+ __ MergeFullStackWith(c->label_state, *__ cache_state());
__ cache_state()->Steal(c->label_state);
} else {
// No merge needed, just continue with the else state.