Commit b5e3fb5b authored by tzik's avatar tzik Committed by Commit Bot

Fix code generation failures on MIPS

On MIPS and MIPS64, UseScratchRegisterScope has only one register for the scratch register [1,2],
and TurboAssembler::CallCFunctionHelper runs out of it as fast_c_call_caller_fp_address
uses the register. That causes code generation failures.

As a workaround, this CL reduces the number of nested UseScratchRegisterScope where
the code generation is failing.

[1]: https://chromium.googlesource.com/v8/v8.git/+/dde25872f58951bb0148cf43d6a504ab2f280485/src/mips/assembler-mips.cc#310
[2]: https://chromium.googlesource.com/v8/v8.git/+/dde25872f58951bb0148cf43d6a504ab2f280485/src/mips64/assembler-mips64.cc#287

Change-Id: I0813c656cafdb09ccd6f53d51f3620385e00022f
Reviewed-on: https://chromium-review.googlesource.com/c/1379590Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58344}
parent 5c0e5a5b
......@@ -5422,9 +5422,8 @@ void TurboAssembler::CallCFunctionHelper(Register function_base,
// Save the frame pointer and PC so that the stack layout remains iterable,
// even without an ExitFrame which normally exists between JS and C frames.
if (isolate() != nullptr) {
UseScratchRegisterScope temps(this);
Register scratch1 = temps.Acquire();
// 't' registers are caller-saved so this is safe as a scratch register.
Register scratch1 = t4;
Register scratch2 = t5;
DCHECK(!AreAliased(scratch1, scratch2, function_base));
......@@ -5446,8 +5445,7 @@ void TurboAssembler::CallCFunctionHelper(Register function_base,
if (isolate() != nullptr) {
// We don't unset the PC; the FP is the source of truth.
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
Register scratch = t4;
li(scratch, ExternalReference::fast_c_call_caller_fp_address(isolate()));
sw(zero_reg, MemOperand(scratch));
}
......
......@@ -5787,9 +5787,8 @@ void TurboAssembler::CallCFunctionHelper(Register function,
// Save the frame pointer and PC so that the stack layout remains iterable,
// even without an ExitFrame which normally exists between JS and C frames.
if (isolate() != nullptr) {
UseScratchRegisterScope temps(this);
Register scratch1 = temps.Acquire();
// 't' registers are caller-saved so this is safe as a scratch register.
Register scratch1 = t1;
Register scratch2 = t2;
DCHECK(!AreAliased(scratch1, scratch2, function));
......@@ -5811,8 +5810,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
if (isolate() != nullptr) {
// We don't unset the PC; the FP is the source of truth.
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
Register scratch = t1;
li(scratch, ExternalReference::fast_c_call_caller_fp_address(isolate()));
Sd(zero_reg, MemOperand(scratch));
}
......
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