Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cherry-pick 8b040cb69e96 from v8 (#35889)
* chore: [20-x-y] cherry-pick 8b040cb69e96 from v8 * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b0c881f
commit d8ca287
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |