Bug 1647342 - Part 6: Simplfy code in onResumeFrame. r=arai! draft
authorLogan Smyth <loganfsmyth@gmail.com>
Wed, 24 Jun 2020 00:01:23 +0000
changeset 3000029 f701648007f0f043ecaa39fe2a97c1ee3dbc2ebc
parent 3000028 eac2af143b772e992e4bc02a3115160cc721813e
child 3000030 0356802761ce8ed9491ad8528814ecaab7ae6d44
push id558604
push userreviewbot
push dateWed, 24 Jun 2020 00:01:54 +0000
treeherdertry@997f6b6c671f [default view] [failures only]
reviewersarai
bugs1647342
milestone79.0a1
Bug 1647342 - Part 6: Simplfy code in onResumeFrame. r=arai! Summary: There's no reason to create this FrameIter over and over again inside the loop. Similarly, ensureExecutionObservabilityOfFrame is a no-op if "frame.isDebuggee()", and slowPathOnResumeFrame asserts that to be true, so there is no reason to ensure observability here because it already is guaranteed. Differential Revision: https://phabricator.services.mozilla.com/D80739 Depends on D80738 Test Plan: Reviewers: Subscribers: Bug #: 1647342 Differential Diff: PHID-DIFF-2etpvuglsvkdx4kgm2nr
js/src/debugger/Debugger.cpp
--- a/js/src/debugger/Debugger.cpp
+++ b/js/src/debugger/Debugger.cpp
@@ -891,35 +891,31 @@ bool DebugAPI::slowPathOnResumeFrame(JSC
 
   Rooted<AbstractGeneratorObject*> genObj(
       cx, GetGeneratorObjectForFrame(cx, frame));
   MOZ_ASSERT(genObj);
 
   // For each debugger, if there is an existing Debugger.Frame object for the
   // resumed `frame`, update it with the new frame pointer and make sure the
   // frame is observable.
+  FrameIter iter(cx);
+  MOZ_ASSERT(iter.abstractFramePtr() == frame);
   for (Realm::DebuggerVectorEntry& entry : frame.global()->getDebuggers()) {
     Debugger* dbg = entry.dbg;
     if (Debugger::GeneratorWeakMap::Ptr generatorEntry =
             dbg->generatorFrames.lookup(genObj)) {
       DebuggerFrame* frameObj = generatorEntry->value();
       MOZ_ASSERT(&frameObj->unwrappedGenerator() == genObj);
       if (!dbg->frames.putNew(frame, frameObj)) {
         ReportOutOfMemory(cx);
         return false;
       }
-
-      FrameIter iter(cx);
-      MOZ_ASSERT(iter.abstractFramePtr() == frame);
       if (!frameObj->resume(iter)) {
         return false;
       }
-      if (!Debugger::ensureExecutionObservabilityOfFrame(cx, frame)) {
-        return false;
-      }
     }
   }
 
   return slowPathOnEnterFrame(cx, frame);
 }
 
 /* static */
 NativeResumeMode DebugAPI::slowPathOnNativeCall(JSContext* cx,