From 2d2df9761ea1669cad5565f24e0d06ec02cc8fe1 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 5 Dec 2019 12:54:34 +0000 Subject: [PATCH] Bug 1598548 part 7 - Add a RetAddrEntry::Kind for interrupt check callVM. r=tcampbell This is necessary for the next patch: it will merge JSOP_LOOPHEAD and JSOP_LOOPENTRY but that means there can be multiple callVMs for that op and this confuses DebugModeOSR (interrupts can trigger debugger recompilation). Differential Revision: https://phabricator.services.mozilla.com/D55631 --HG-- extra : moz-landing-system : lando --- js/src/jit/BaselineCodeGen.cpp | 6 +++++- js/src/jit/BaselineDebugModeOSR.cpp | 4 ++++ js/src/jit/BaselineJIT.h | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/src/jit/BaselineCodeGen.cpp b/js/src/jit/BaselineCodeGen.cpp index 194df45cc569..6604d99b48a0 100644 --- a/js/src/jit/BaselineCodeGen.cpp +++ b/js/src/jit/BaselineCodeGen.cpp @@ -1259,8 +1259,12 @@ bool BaselineCodeGen::emitInterruptCheck() { prepareVMCall(); + // Use a custom RetAddrEntry::Kind so DebugModeOSR can distinguish this call + // from other callVMs that might happen at this pc. + const RetAddrEntry::Kind kind = RetAddrEntry::Kind::InterruptCheck; + using Fn = bool (*)(JSContext*); - if (!callVM()) { + if (!callVM(kind)) { return false; } diff --git a/js/src/jit/BaselineDebugModeOSR.cpp b/js/src/jit/BaselineDebugModeOSR.cpp index 9676fdb40b33..f251d25a8f6f 100644 --- a/js/src/jit/BaselineDebugModeOSR.cpp +++ b/js/src/jit/BaselineDebugModeOSR.cpp @@ -182,6 +182,8 @@ static const char* RetAddrEntryKindToString(RetAddrEntry::Kind kind) { return "warmup counter"; case RetAddrEntry::Kind::StackCheck: return "stack check"; + case RetAddrEntry::Kind::InterruptCheck: + return "interrupt check"; case RetAddrEntry::Kind::DebugTrap: return "debug trap"; case RetAddrEntry::Kind::DebugPrologue: @@ -284,6 +286,7 @@ static void PatchBaselineFramesForDebugMode( switch (kind) { case RetAddrEntry::Kind::IC: case RetAddrEntry::Kind::CallVM: + case RetAddrEntry::Kind::InterruptCheck: case RetAddrEntry::Kind::WarmupCounter: case RetAddrEntry::Kind::StackCheck: { // Cases A, B, C, D above. @@ -298,6 +301,7 @@ static void PatchBaselineFramesForDebugMode( switch (kind) { case RetAddrEntry::Kind::IC: case RetAddrEntry::Kind::CallVM: + case RetAddrEntry::Kind::InterruptCheck: retAddrEntry = &bl->retAddrEntryFromPCOffset(pcOffset, kind); break; case RetAddrEntry::Kind::WarmupCounter: diff --git a/js/src/jit/BaselineJIT.h b/js/src/jit/BaselineJIT.h index 4db6d89d1b1b..9a876d1b3a5d 100644 --- a/js/src/jit/BaselineJIT.h +++ b/js/src/jit/BaselineJIT.h @@ -110,6 +110,9 @@ class RetAddrEntry { // A callVM for the over-recursion check on function entry. StackCheck, + // A callVM for an interrupt check. + InterruptCheck, + // DebugTrapHandler (for debugger breakpoints/stepping). DebugTrap,