Commit 79855db4 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[builtins][x64] Using AllocateStackSpace instead of subtracting RSP

Subtracting RSP to allocate stack space is not safe on Windows, where we could subtract several pages away and the value could not be committed yet in memory yielding a segfault. We use the macro assembler AllocateStackSpace instead.

Change-Id: I69ac9d96c57af57276b480a33c7cefa81fc018a7
Bug: v8:10201
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2166169
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67442}
parent 6bb3f0c0
......@@ -2217,10 +2217,8 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
Label copy, check;
Register src = r8, dest = rsp, num = r9, current = r11;
__ movq(src, rsp);
__ movq(kScratchRegister, rcx);
__ negq(kScratchRegister);
__ leaq(rsp, Operand(rsp, kScratchRegister, times_system_pointer_size,
0)); // Update stack pointer.
__ leaq(kScratchRegister, Operand(rcx, times_system_pointer_size, 0));
__ AllocateStackSpace(kScratchRegister);
__ leaq(num, Operand(rax, 2)); // Number of words to copy.
// +2 for receiver and return address.
__ Set(current, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment