Skip to content

Commit 240789f

Browse files
CSharperMantlejandem
authored andcommitted
Bug 1990484 - [arm64] Part 1: Re-acquire scratch register in in ScratchTagScope::reacquire(). r=jandem
This patch also removes explicit ip0 allocation to avoid conflicts in assumeUnreachable debug-only code, as shown in the following stack trace: ```plain-text [24036] Assertion failure: temps.IsAvailable(ScratchReg64), at D:/Workspace/gecko-dev/js/src/jit/arm64/MacroAssembler-arm64.cpp:1624 #1: js::jit::MacroAssembler::call (D:\Workspace\gecko-dev\js\src\jit\arm64\MacroAssembler-arm64.cpp:1624) #2: js::jit::MacroAssembler::callWithABINoProfiler (D:\Workspace\gecko-dev\js\src\jit\MacroAssembler.cpp:4983) #3: js::jit::MacroAssembler::assumeUnreachable (D:\Workspace\gecko-dev\js\src\jit\MacroAssembler.cpp:4038) #4: js::jit::CodeGenerator::testValueTruthyForType (D:\Workspace\gecko-dev\js\src\jit\CodeGenerator.cpp:1358) #5: js::jit::CodeGenerator::testValueTruthy (D:\Workspace\gecko-dev\js\src\jit\CodeGenerator.cpp:1477) #6: js::jit::CodeGenerator::visitTestVAndBranch (D:\Workspace\gecko-dev\js\src\jit\CodeGenerator.cpp:1927) #7: js::jit::CodeGenerator::generateBody (D:\Workspace\gecko-dev\js\src\jit\CodeGenerator.cpp:8347) #8: js::jit::CodeGenerator::generate (D:\Workspace\gecko-dev\js\src\jit\CodeGenerator.cpp:17024) #9: js::jit::CompileBackEnd (D:\Workspace\gecko-dev\js\src\jit\Ion.cpp:1696) #10: js::jit::Compile (D:\Workspace\gecko-dev\js\src\jit\Ion.cpp:2014) #11: js::jit::CanEnterIon (D:\Workspace\gecko-dev\js\src\jit\Ion.cpp:2107) #12: js::jit::MaybeEnterJit (D:\Workspace\gecko-dev\js\src\jit\Jit.cpp:202) #13: js::RunScript (D:\Workspace\gecko-dev\js\src\vm\Interpreter.cpp:462) ``` Differential Revision: https://phabricator.services.mozilla.com/D266948
1 parent f886788 commit 240789f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

js/src/jit/arm64/MacroAssembler-arm64.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,10 +1621,9 @@ void MacroAssembler::call(ImmPtr imm) {
16211621
// eg testcase: asm.js/testTimeout5.js
16221622
syncStackPtr();
16231623
vixl::UseScratchRegisterScope temps(this);
1624-
MOZ_ASSERT(temps.IsAvailable(ScratchReg64)); // ip0
1625-
temps.Exclude(ScratchReg64);
1626-
movePtr(imm, ScratchReg64.asUnsized());
1627-
Blr(ScratchReg64);
1624+
const Register scratch = temps.AcquireX().asUnsized();
1625+
movePtr(imm, scratch);
1626+
Blr(ARMRegister(scratch, 64));
16281627
}
16291628

16301629
void MacroAssembler::call(ImmWord imm) { call(ImmPtr((void*)imm.value)); }

js/src/jit/arm64/MacroAssembler-arm64.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,10 @@ class ScratchTagScope {
21512151
void reacquire() {
21522152
MOZ_ASSERT(released_);
21532153
released_ = false;
2154+
if (!owned_) {
2155+
scratch64_ = temps_.AcquireX();
2156+
owned_ = true;
2157+
}
21542158
}
21552159
};
21562160

0 commit comments

Comments
 (0)