tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Probes-inl.h (1275B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: set ts=8 sts=2 et sw=2 tw=80:
      3 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef vm_Probes_inl_h
      8 #define vm_Probes_inl_h
      9 
     10 #include "vm/Probes.h"
     11 
     12 #include "vm/JSContext.h"
     13 #include "vm/JSScript.h"
     14 
     15 namespace js {
     16 
     17 /*
     18 * Many probe handlers are implemented inline for minimal performance impact,
     19 * especially important when no backends are enabled.
     20 */
     21 
     22 inline bool probes::EnterScript(JSContext* cx, JSScript* script,
     23                                JSFunction* maybeFun, InterpreterFrame* fp) {
     24  JSRuntime* rt = cx->runtime();
     25  if (rt->geckoProfiler().enabled()) {
     26    if (!cx->geckoProfiler().enter(cx, script)) {
     27      return false;
     28    }
     29    MOZ_ASSERT(!fp->hasPushedGeckoProfilerFrame());
     30    fp->setPushedGeckoProfilerFrame();
     31  }
     32 
     33  return true;
     34 }
     35 
     36 inline void probes::ExitScript(JSContext* cx, JSScript* script,
     37                               JSFunction* maybeFun, bool popProfilerFrame) {
     38  if (popProfilerFrame) {
     39    cx->geckoProfiler().exit(cx, script);
     40  }
     41 }
     42 
     43 } /* namespace js */
     44 
     45 #endif /* vm_Probes_inl_h */