Skip to content

Commit a0d8ea4

Browse files
authored
deps: V8: cherry-pick aa0b288f87cc
Original commit message: PPC/S390: [wasm] Fix jump table offset when patching ... need to make sure patching of target occurs at the correct spot based on what `EmitFarJumpSlot` emits. Also mask the branch offset in PPC64 EmitJumpSlot to match `Assembler::b()`. Change-Id: I5a8079d0079d8ad427034761d42c90b64d5746dd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7642190 Reviewed-by: John <junyan1@ibm.com> Commit-Queue: Milad Farazmand <mfarazma@ibm.com> Reviewed-by: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#105646} Refs: v8/v8@aa0b288 PR-URL: #62136 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent f82525e commit a0d8ea4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.12',
41+
'v8_embedder_string': '-node.13',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/wasm/jump-table-assembler.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ void JumpTableAssembler::EmitFarJumpSlot(Address target) {
426426
// static
427427
void JumpTableAssembler::PatchFarJumpSlot(WritableJitAllocation& jit_allocation,
428428
Address slot, Address target) {
429-
Address target_addr = slot + 8;
429+
// See {EmitFarJumpSlot} for the offset of the target.
430+
Address target_addr = slot + kFarJumpTableSlotSize - kSystemPointerSize;
430431
jit_allocation.WriteValue(target_addr, target, kRelaxedStore);
431432
}
432433

@@ -636,7 +637,7 @@ bool JumpTableAssembler::EmitJumpSlot(Address target) {
636637

637638
CHECK_EQ(0, relative_target & (kAAMask | kLKMask));
638639
// The jump table is updated live, so the write has to be atomic.
639-
emit<uint32_t>(inst[0] | relative_target, kRelaxedStore);
640+
emit<uint32_t>(inst[0] | (relative_target & kImm26Mask), kRelaxedStore);
640641
return true;
641642
}
642643

@@ -671,7 +672,9 @@ void JumpTableAssembler::EmitFarJumpSlot(Address target) {
671672
// static
672673
void JumpTableAssembler::PatchFarJumpSlot(WritableJitAllocation& jit_allocation,
673674
Address slot, Address target) {
674-
Address target_addr = slot + kFarJumpTableSlotSize - 8;
675+
// See {EmitFarJumpSlot} for the offset of the target.
676+
Address target_addr =
677+
slot + kFarJumpTableSlotSize - (2 * kInstrSize) - kSystemPointerSize;
675678
jit_allocation.WriteValue(target_addr, target, kRelaxedStore);
676679
}
677680

0 commit comments

Comments
 (0)