js/src/vm/Probes-inl.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef vm_Probes_inl_h
michael@0 8 #define vm_Probes_inl_h
michael@0 9
michael@0 10 #include "vm/Probes.h"
michael@0 11
michael@0 12 #include "jscntxt.h"
michael@0 13
michael@0 14 namespace js {
michael@0 15
michael@0 16 /*
michael@0 17 * Many probe handlers are implemented inline for minimal performance impact,
michael@0 18 * especially important when no backends are enabled.
michael@0 19 */
michael@0 20
michael@0 21 inline bool
michael@0 22 probes::CallTrackingActive(JSContext *cx)
michael@0 23 {
michael@0 24 #ifdef INCLUDE_MOZILLA_DTRACE
michael@0 25 if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
michael@0 26 return true;
michael@0 27 #endif
michael@0 28 #ifdef MOZ_TRACE_JSCALLS
michael@0 29 if (cx->functionCallback)
michael@0 30 return true;
michael@0 31 #endif
michael@0 32 return false;
michael@0 33 }
michael@0 34
michael@0 35 inline bool
michael@0 36 probes::WantNativeAddressInfo(JSContext *cx)
michael@0 37 {
michael@0 38 return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
michael@0 39 JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION);
michael@0 40 }
michael@0 41
michael@0 42 inline bool
michael@0 43 probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
michael@0 44 InterpreterFrame *fp)
michael@0 45 {
michael@0 46 #ifdef INCLUDE_MOZILLA_DTRACE
michael@0 47 if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
michael@0 48 DTraceEnterJSFun(cx, maybeFun, script);
michael@0 49 #endif
michael@0 50 #ifdef MOZ_TRACE_JSCALLS
michael@0 51 cx->doFunctionCallback(maybeFun, script, 1);
michael@0 52 #endif
michael@0 53
michael@0 54 JSRuntime *rt = cx->runtime();
michael@0 55 if (rt->spsProfiler.enabled()) {
michael@0 56 if (!rt->spsProfiler.enter(script, maybeFun))
michael@0 57 return false;
michael@0 58 JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame());
michael@0 59 fp->setPushedSPSFrame();
michael@0 60 }
michael@0 61
michael@0 62 return true;
michael@0 63 }
michael@0 64
michael@0 65 inline void
michael@0 66 probes::ExitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, bool popSPSFrame)
michael@0 67 {
michael@0 68 #ifdef INCLUDE_MOZILLA_DTRACE
michael@0 69 if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
michael@0 70 DTraceExitJSFun(cx, maybeFun, script);
michael@0 71 #endif
michael@0 72 #ifdef MOZ_TRACE_JSCALLS
michael@0 73 cx->doFunctionCallback(maybeFun, script, 0);
michael@0 74 #endif
michael@0 75
michael@0 76 if (popSPSFrame)
michael@0 77 cx->runtime()->spsProfiler.exit(script, maybeFun);
michael@0 78 }
michael@0 79
michael@0 80 inline bool
michael@0 81 probes::StartExecution(JSScript *script)
michael@0 82 {
michael@0 83 bool ok = true;
michael@0 84
michael@0 85 #ifdef INCLUDE_MOZILLA_DTRACE
michael@0 86 if (JAVASCRIPT_EXECUTE_START_ENABLED())
michael@0 87 JAVASCRIPT_EXECUTE_START((script->filename() ? (char *)script->filename() : nullName),
michael@0 88 script->lineno());
michael@0 89 #endif
michael@0 90
michael@0 91 return ok;
michael@0 92 }
michael@0 93
michael@0 94 inline bool
michael@0 95 probes::StopExecution(JSScript *script)
michael@0 96 {
michael@0 97 bool ok = true;
michael@0 98
michael@0 99 #ifdef INCLUDE_MOZILLA_DTRACE
michael@0 100 if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
michael@0 101 JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char *)script->filename() : nullName),
michael@0 102 script->lineno());
michael@0 103 #endif
michael@0 104
michael@0 105 return ok;
michael@0 106 }
michael@0 107
michael@0 108 } /* namespace js */
michael@0 109
michael@0 110 #endif /* vm_Probes_inl_h */

mercurial