js/src/vm/Probes-inl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 {
    16 /*
    17  * Many probe handlers are implemented inline for minimal performance impact,
    18  * especially important when no backends are enabled.
    19  */
    21 inline bool
    22 probes::CallTrackingActive(JSContext *cx)
    23 {
    24 #ifdef INCLUDE_MOZILLA_DTRACE
    25     if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
    26         return true;
    27 #endif
    28 #ifdef MOZ_TRACE_JSCALLS
    29     if (cx->functionCallback)
    30         return true;
    31 #endif
    32     return false;
    33 }
    35 inline bool
    36 probes::WantNativeAddressInfo(JSContext *cx)
    37 {
    38     return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
    39             JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION);
    40 }
    42 inline bool
    43 probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
    44                     InterpreterFrame *fp)
    45 {
    46 #ifdef INCLUDE_MOZILLA_DTRACE
    47     if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
    48         DTraceEnterJSFun(cx, maybeFun, script);
    49 #endif
    50 #ifdef MOZ_TRACE_JSCALLS
    51     cx->doFunctionCallback(maybeFun, script, 1);
    52 #endif
    54     JSRuntime *rt = cx->runtime();
    55     if (rt->spsProfiler.enabled()) {
    56         if (!rt->spsProfiler.enter(script, maybeFun))
    57             return false;
    58         JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame());
    59         fp->setPushedSPSFrame();
    60     }
    62     return true;
    63 }
    65 inline void
    66 probes::ExitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, bool popSPSFrame)
    67 {
    68 #ifdef INCLUDE_MOZILLA_DTRACE
    69     if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
    70         DTraceExitJSFun(cx, maybeFun, script);
    71 #endif
    72 #ifdef MOZ_TRACE_JSCALLS
    73     cx->doFunctionCallback(maybeFun, script, 0);
    74 #endif
    76     if (popSPSFrame)
    77         cx->runtime()->spsProfiler.exit(script, maybeFun);
    78 }
    80 inline bool
    81 probes::StartExecution(JSScript *script)
    82 {
    83     bool ok = true;
    85 #ifdef INCLUDE_MOZILLA_DTRACE
    86     if (JAVASCRIPT_EXECUTE_START_ENABLED())
    87         JAVASCRIPT_EXECUTE_START((script->filename() ? (char *)script->filename() : nullName),
    88                                  script->lineno());
    89 #endif
    91     return ok;
    92 }
    94 inline bool
    95 probes::StopExecution(JSScript *script)
    96 {
    97     bool ok = true;
    99 #ifdef INCLUDE_MOZILLA_DTRACE
   100     if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
   101         JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char *)script->filename() : nullName),
   102                                 script->lineno());
   103 #endif
   105     return ok;
   106 }
   108 } /* namespace js */
   110 #endif /* vm_Probes_inl_h */

mercurial