Skip to content
forked from v8/v8

Commit

Permalink
[regexp][arm64] Fix stack check extra space argument
Browse files Browse the repository at this point in the history
Pass argument in register instead of the stack.

Bug: chromium:1488199, v8:14415
Change-Id: Ic9967c9f2ca5da1981a0138ddb5f0335ab7f1425
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4987306
Commit-Queue: Patrick Thier <[email protected]>
Reviewed-by: Camillo Bruni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#90669}
  • Loading branch information
pthier authored and V8 LUCI CQ committed Oct 30, 2023
1 parent 0eef501 commit ad30a54
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/regexp/arm64/regexp-macro-assembler-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1459,17 +1459,16 @@ void RegExpMacroAssemblerARM64::CallCheckStackGuardState(Register scratch,

// Allocate space on the stack to store the return address. The
// CheckStackGuardState C++ function will override it if the code
// moved. Allocate extra space for 3 arguments (2 for input start/end and 1
// for gap). AAPCS64 requires the stack to be 16 byte aligned.
// moved. Allocate extra space for 2 arguments passed by pointers.
// AAPCS64 requires the stack to be 16 byte aligned.
int alignment = masm_->ActivationFrameAlignment();
DCHECK_EQ(alignment % 16, 0);
int align_mask = (alignment / kXRegSize) - 1;
int xreg_to_claim = (4 + align_mask) & ~align_mask;
int xreg_to_claim = (3 + align_mask) & ~align_mask;

__ Claim(xreg_to_claim);

__ Mov(x0, extra_space);
__ Poke(x0, 3 * kSystemPointerSize);
__ Mov(x6, extra_space);
// CheckStackGuardState needs the end and start addresses of the input string.
__ Poke(input_end(), 2 * kSystemPointerSize);
__ Add(x5, sp, 2 * kSystemPointerSize);
Expand Down

0 comments on commit ad30a54

Please sign in to comment.