Bug 1541404 part 22 - Add BaselineInterpreterGenerator::emitDebugTrap. r=djvj
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 10 May 2019 09:55:47 +0000
changeset 532189 b84d8c19fdea4022e92173ae3cb8b1ab284cf7af
parent 532188 6fabc0c9c2cde56f6921056d3e98500f0f7a47e3
child 532190 8da1d9e605dd7218ced00da67ec09c3e37565147
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdjvj
bugs1541404
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541404 part 22 - Add BaselineInterpreterGenerator::emitDebugTrap. r=djvj Differential Revision: https://phabricator.services.mozilla.com/D29818
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineCompiler.h
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -6611,16 +6611,34 @@ MethodStatus BaselineCompiler::emitBody(
     prevpc = handler.pc();
 #endif
   }
 
   MOZ_ASSERT(JSOp(*prevpc) == JSOP_RETRVAL);
   return Method_Compiled;
 }
 
+bool BaselineInterpreterGenerator::emitDebugTrap() {
+  JitRuntime* jrt = cx->runtime()->jitRuntime();
+
+  JitCode* handlerCode =
+      jrt->debugTrapHandler(cx, DebugTrapHandlerKind::Interpreter);
+  if (!handlerCode) {
+    return false;
+  }
+
+  CodeOffset offset = masm.toggledCall(handlerCode, /* enabled = */ false);
+  if (!debugTrapOffsets_.append(offset.offset())) {
+    ReportOutOfMemory(cx);
+    return false;
+  }
+
+  return true;
+}
+
 JitCode* JitRuntime::generateDebugTrapHandler(JSContext* cx,
                                               DebugTrapHandlerKind kind) {
   StackMacroAssembler masm;
 
   AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
   regs.takeUnchecked(BaselineFrameReg);
   regs.takeUnchecked(ICStubReg);
   regs.takeUnchecked(PCRegAtStart);
--- a/js/src/jit/BaselineCompiler.h
+++ b/js/src/jit/BaselineCompiler.h
@@ -692,16 +692,22 @@ class BaselineInterpreterHandler {
   bool needsEarlyStackCheck() const { return true; }
 
   JSObject* maybeNoCloneSingletonObject() { return nullptr; }
 };
 
 using BaselineInterpreterCodeGen = BaselineCodeGen<BaselineInterpreterHandler>;
 
 class BaselineInterpreterGenerator final : private BaselineInterpreterCodeGen {
+  // Offsets of patchable call instructions for debugger breakpoints/stepping.
+  js::Vector<uint32_t, 0, SystemAllocPolicy> debugTrapOffsets_;
+
  public:
   explicit BaselineInterpreterGenerator(JSContext* cx);
+
+ private:
+  MOZ_MUST_USE bool emitDebugTrap();
 };
 
 }  // namespace jit
 }  // namespace js
 
 #endif /* jit_BaselineCompiler_h */