Commit adb44ba6 authored by Jon Coppeard's avatar Jon Coppeard
Browse files

Bug 1555935 - Remove some unnecessary use of FreeOp where plain old js_delete will do r=pbone?

Carrying on from the last patch, there is one place where we use FreeOp unnecessarily when we're not finalizing.

Depends on D33276

Differential Revision: https://phabricator.services.mozilla.com/D33313

--HG--
extra : moz-landing-system : lando
parent 4a475af2
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -2531,11 +2531,10 @@ extern bool js::IsValidBytecodeOffset(JSContext* cx, JSScript* script,
 * PurgePCCounts            None      None      None
 */

static void ReleaseScriptCounts(FreeOp* fop) {
  JSRuntime* rt = fop->runtime();
static void ReleaseScriptCounts(JSRuntime* rt) {
  MOZ_ASSERT(rt->scriptAndCountsVector);

  fop->delete_(rt->scriptAndCountsVector.ref());
  js_delete(rt->scriptAndCountsVector.ref());
  rt->scriptAndCountsVector = nullptr;
}

@@ -2547,7 +2546,7 @@ JS_FRIEND_API void js::StartPCCountProfiling(JSContext* cx) {
  }

  if (rt->scriptAndCountsVector) {
    ReleaseScriptCounts(rt->defaultFreeOp());
    ReleaseScriptCounts(rt);
  }

  ReleaseAllJITCode(rt->defaultFreeOp());
@@ -2566,7 +2565,7 @@ JS_FRIEND_API void js::StopPCCountProfiling(JSContext* cx) {
  ReleaseAllJITCode(rt->defaultFreeOp());

  auto* vec = cx->new_<PersistentRooted<ScriptAndCountsVector>>(
      cx, ScriptAndCountsVector(SystemAllocPolicy()));
      cx, ScriptAndCountsVector());
  if (!vec) {
    return;
  }
@@ -2594,7 +2593,7 @@ JS_FRIEND_API void js::PurgePCCounts(JSContext* cx) {
  }
  MOZ_ASSERT(!rt->profilingScripts);

  ReleaseScriptCounts(rt->defaultFreeOp());
  ReleaseScriptCounts(rt);
}

JS_FRIEND_API size_t js::GetPCCountScriptCount(JSContext* cx) {