Bumping manifests a=b2g-bump
[gecko.git] / js / src / vm / Probes-inl.h
blob7b3b05cca4285ccdd43dbcfb341ad6063af4e9e1
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
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/. */
7 #ifndef vm_Probes_inl_h
8 #define vm_Probes_inl_h
10 #include "vm/Probes.h"
12 #include "jscntxt.h"
14 namespace js {
17 * Many probe handlers are implemented inline for minimal performance impact,
18 * especially important when no backends are enabled.
21 inline bool
22 probes::CallTrackingActive(JSContext* cx)
24 #ifdef INCLUDE_MOZILLA_DTRACE
25 if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
26 return true;
27 #endif
28 return false;
31 inline bool
32 probes::WantNativeAddressInfo(JSContext* cx)
34 return cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
35 JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION;
38 inline bool
39 probes::EnterScript(JSContext* cx, JSScript* script, JSFunction* maybeFun,
40 InterpreterFrame* fp)
42 #ifdef INCLUDE_MOZILLA_DTRACE
43 if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
44 DTraceEnterJSFun(cx, maybeFun, script);
45 #endif
47 JSRuntime* rt = cx->runtime();
48 if (rt->spsProfiler.enabled()) {
49 if (!rt->spsProfiler.enter(script, maybeFun))
50 return false;
51 MOZ_ASSERT_IF(!fp->script()->isGenerator(), !fp->hasPushedSPSFrame());
52 fp->setPushedSPSFrame();
55 return true;
58 inline void
59 probes::ExitScript(JSContext* cx, JSScript* script, JSFunction* maybeFun, bool popSPSFrame)
61 #ifdef INCLUDE_MOZILLA_DTRACE
62 if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
63 DTraceExitJSFun(cx, maybeFun, script);
64 #endif
66 if (popSPSFrame)
67 cx->runtime()->spsProfiler.exit(script, maybeFun);
70 inline bool
71 probes::StartExecution(JSScript* script)
73 bool ok = true;
75 #ifdef INCLUDE_MOZILLA_DTRACE
76 if (JAVASCRIPT_EXECUTE_START_ENABLED())
77 JAVASCRIPT_EXECUTE_START((script->filename() ? (char*)script->filename() : nullName),
78 script->lineno());
79 #endif
81 return ok;
84 inline bool
85 probes::StopExecution(JSScript* script)
87 bool ok = true;
89 #ifdef INCLUDE_MOZILLA_DTRACE
90 if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
91 JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char*)script->filename() : nullName),
92 script->lineno());
93 #endif
95 return ok;
98 } /* namespace js */
100 #endif /* vm_Probes_inl_h */