Bug 879831, part 5 - Factor out js::Probes functions that depend on "inlines" headers into vm/Probes-inl.h. r=njn.

--HG--
rename : js/src/jsprobes.h => js/src/vm/Probes-inl.h
rename : js/src/jsprobes.cpp => js/src/vm/Probes.cpp
This commit is contained in:
Jason Orendorff 2013-06-06 22:48:45 -05:00
parent d9ab0a4b94
commit c707c0de2f
20 changed files with 187 additions and 194 deletions

View File

@ -608,7 +608,7 @@ ifdef MOZ_ETW
ETWProvider.h ETWProvider.rc ETWProvider.mof: ETWProvider.man
$(MC) -um -mof $^
jsprobes.$(OBJ_SUFFIX): ETWProvider.h
Probes.$(OBJ_SUFFIX): ETWProvider.h
ETWProvider.res: ETWProvider.rc
$(RC) -r -i "$(SDKDIR)Include" $^
@ -629,7 +629,7 @@ $(CURDIR)/javascript-trace.h: $(srcdir)/devtools/javascript-trace.d
# We can't automatically generate dependencies on auto-generated headers;
# we have to list them explicitly.
$(addsuffix .$(OBJ_SUFFIX),jsprobes jsinterp jsobj): $(CURDIR)/javascript-trace.h
$(addsuffix .$(OBJ_SUFFIX),Probes jsinterp jsobj): $(CURDIR)/javascript-trace.h
endif
ifdef HAVE_LINUX_PERF_EVENT_H

View File

@ -11,9 +11,9 @@
#include "Profilers.h"
#include "jsapi.h"
#include "jscntxt.h"
#include "jsprobes.h"
#include "jscntxtinlines.h"
#include "vm/Probes-inl.h"
#include "vm/Stack-inl.h"
#ifdef MOZ_CALLGRIND

View File

@ -6,9 +6,7 @@
#include "frontend/BytecodeCompiler.h"
#include "jsprobes.h"
#include "jsscript.h"
#include "frontend/BytecodeEmitter.h"
#include "frontend/FoldConstants.h"
#include "frontend/NameFunctions.h"
@ -16,11 +14,11 @@
#include "vm/GlobalObject.h"
#include "jsinferinlines.h"
#include "frontend/ParseMaps-inl.h"
#include "frontend/ParseNode-inl.h"
#include "frontend/Parser-inl.h"
#include "frontend/SharedContext-inl.h"
#include "vm/Probes-inl.h"
using namespace js;
using namespace js::frontend;

View File

@ -4,6 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gc/Statistics.h"
#include <stdio.h>
#include <stdarg.h>
@ -14,15 +16,13 @@
#include "jscrashformat.h"
#include "jscrashreport.h"
#include "jsprf.h"
#include "jsprobes.h"
#include "jsutil.h"
#include "prmjtime.h"
#include "gc/Memory.h"
#include "gc/Statistics.h"
#include "jscntxtinlines.h"
#include "gc/Barrier-inl.h"
#include "vm/Probes-inl.h"
using namespace js;
using namespace js::gcstats;

View File

@ -4,26 +4,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Ion.h"
#include "IonFrames.h"
#include "jsobj.h"
#include "jsscript.h"
#include "jsfun.h"
#include "BaselineFrame.h"
#include "BaselineIC.h"
#include "BaselineJIT.h"
#include "IonCompartment.h"
#include "IonFrames-inl.h"
#include "IonFrameIterator-inl.h"
#include "Safepoints.h"
#include "IonSpewer.h"
#include "IonMacroAssembler.h"
#include "PcScriptCache.h"
#include "PcScriptCache-inl.h"
#include "gc/Marking.h"
#include "SnapshotReader.h"
#include "Safepoints.h"
#include "VMFunctions.h"
#include "ion/BaselineFrame.h"
#include "ion/BaselineIC.h"
#include "ion/BaselineJIT.h"
#include "ion/Ion.h"
#include "ion/IonCompartment.h"
#include "ion/IonMacroAssembler.h"
#include "ion/IonSpewer.h"
#include "ion/PcScriptCache.h"
#include "ion/Safepoints.h"
#include "ion/SnapshotReader.h"
#include "ion/VMFunctions.h"
#include "ion/IonFrameIterator-inl.h"
#include "ion/IonFrames-inl.h"
#include "ion/PcScriptCache-inl.h"
#include "vm/Probes-inl.h"
namespace js {
namespace ion {

View File

@ -1528,7 +1528,7 @@ struct JSContext : js::ContextFriendFields,
unsigned options_; /* see jsapi.h for JSOPTION_* */
public:
int32_t reportGranularity; /* see jsprobes.h */
int32_t reportGranularity; /* see vm/Probes.h */
js::AutoResolving *resolvingList;

View File

@ -8,14 +8,14 @@
#define jscntxtinlines_h___
#include "jscntxt.h"
#include "jscompartment.h"
#include "jsfriendapi.h"
#include "jsprobes.h"
#include "jsgc.h"
#include "builtin/Object.h" // For js::obj_construct
#include "frontend/ParseMaps.h"
#include "vm/Interpreter.h"
#include "vm/Probes.h"
#include "vm/RegExpObject.h"
#include "jsgcinlines.h"

View File

@ -17,9 +17,7 @@
#include "jstypedarray.h"
#include "builtin/ParallelArray.h"
#ifdef JS_ION
#include "ion/IonFrames.h"
#endif
#include "js/RootingAPI.h"
#include "vm/GlobalObject.h"

View File

@ -26,7 +26,6 @@
#include "jsiter.h"
#include "jsnum.h"
#include "jsopcode.h"
#include "jsprobes.h"
#include "jsprototypes.h"
#include "jsproxy.h"
#include "jsscript.h"
@ -34,7 +33,6 @@
#include "jsdbgapi.h"
#include "jswatchpoint.h"
#include "jswrapper.h"
#include "frontend/TokenStream.h"
#include "gc/Marking.h"
#include "ion/BaselineJIT.h"
@ -49,10 +47,10 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "jstypedarrayinlines.h"
#include "builtin/Iterator-inl.h"
#include "vm/BooleanObject-inl.h"
#include "vm/NumberObject-inl.h"
#include "vm/Probes-inl.h"
#include "vm/RegExpStatics-inl.h"
#include "vm/Shape-inl.h"
#include "vm/StringObject-inl.h"

View File

@ -17,7 +17,6 @@
#include "jsiter.h"
#include "jslock.h"
#include "jsnum.h"
#include "jsprobes.h"
#include "jspropertytree.h"
#include "jsproxy.h"
#include "jsstr.h"
@ -34,6 +33,7 @@
#include "vm/GlobalObject.h"
#include "vm/Shape.h"
#include "vm/NumberObject.h"
#include "vm/Probes.h"
#include "vm/RegExpStatics.h"
#include "vm/StringObject.h"
@ -42,9 +42,7 @@
#include "jsfuninlines.h"
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "gc/Barrier-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Shape-inl.h"
#include "vm/String-inl.h"

View File

@ -110,6 +110,7 @@ CPP_SOURCES += [
'ParseMaps.cpp',
'ParseNode.cpp',
'Parser.cpp',
'Probes.cpp',
'Profilers.cpp',
'PropertyKey.cpp',
'RegExp.cpp',
@ -166,7 +167,6 @@ CPP_SOURCES += [
'jsopcode.cpp',
'jsperf.cpp',
'jsprf.cpp',
'jsprobes.cpp',
'jspropertycache.cpp',
'jspropertytree.cpp',
'jsproxy.cpp',

View File

@ -13,11 +13,11 @@
#include "jsinfer.h"
#include "jslibmath.h"
#include "jsnum.h"
#include "jsprobes.h"
#include "jsstr.h"
#include "vm/Interpreter.h"
#include "ion/Ion.h"
#include "ion/IonCompartment.h"
#include "vm/ForkJoin.h"
#include "vm/Interpreter.h"
#include "jsatominlines.h"
#include "jsfuninlines.h"
@ -25,12 +25,6 @@
#include "jsopcodeinlines.h"
#include "jspropertycacheinlines.h"
#include "jstypedarrayinlines.h"
#ifdef JS_ION
#include "ion/Ion.h"
#include "ion/IonCompartment.h"
#endif
#include "vm/GlobalObject-inl.h"
#include "vm/Stack-inl.h"

View File

@ -16,13 +16,11 @@
#include <stdio.h>
#include <string.h>
#include "jstypes.h"
#include "jsprf.h"
#include "jsapi.h"
#include "jsarray.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsversion.h"
#include "jsdbgapi.h"
#include "jsfun.h"
#include "jsgc.h"
@ -30,31 +28,27 @@
#include "jsnum.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsprf.h"
#include "jspropertycache.h"
#include "jsscript.h"
#include "jsstr.h"
#include "jsversion.h"
#include "builtin/Eval.h"
#include "ion/BaselineJIT.h"
#include "ion/Ion.h"
#include "vm/Debugger.h"
#include "vm/Shape.h"
#include "ion/Ion.h"
#include "ion/BaselineJIT.h"
#ifdef JS_ION
#include "ion/IonFrames-inl.h"
#endif
#include "jsatominlines.h"
#include "jsboolinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"
#include "jsprobes.h"
#include "jsscriptinlines.h"
#include "builtin/Iterator-inl.h"
#include "ion/IonFrames-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/Probes-inl.h"
#include "vm/Stack-inl.h"
#include "jsautooplen.h"

131
js/src/vm/Probes-inl.h Normal file
View File

@ -0,0 +1,131 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef Probes_inl_h__
#define Probes_inl_h__
#include "vm/Probes.h"
#include "jscntxt.h"
#include "jsobj.h"
#include "jsscript.h"
#include "vm/Stack-inl.h"
namespace js {
/*
* Many probe handlers are implemented inline for minimal performance impact,
* especially important when no backends are enabled.
*/
inline bool
Probes::callTrackingActive(JSContext *cx)
{
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
return true;
#endif
#ifdef MOZ_TRACE_JSCALLS
if (cx->functionCallback)
return true;
#endif
return false;
}
inline bool
Probes::wantNativeAddressInfo(JSContext *cx)
{
return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION);
}
inline bool
Probes::enterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
StackFrame *fp)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
DTraceEnterJSFun(cx, maybeFun, script);
#endif
#ifdef MOZ_TRACE_JSCALLS
cx->doFunctionCallback(maybeFun, script, 1);
#endif
JSRuntime *rt = cx->runtime;
if (rt->spsProfiler.enabled()) {
rt->spsProfiler.enter(cx, script, maybeFun);
JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame());
fp->setPushedSPSFrame();
}
return ok;
}
inline bool
Probes::exitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
AbstractFramePtr fp)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
DTraceExitJSFun(cx, maybeFun, script);
#endif
#ifdef MOZ_TRACE_JSCALLS
cx->doFunctionCallback(maybeFun, script, 0);
#endif
JSRuntime *rt = cx->runtime;
/*
* Coming from IonMonkey, the fp might not be known (fp == NULL), but
* IonMonkey will only call exitScript() when absolutely necessary, so it is
* guaranteed that fp->hasPushedSPSFrame() would have been true
*/
if ((!fp && rt->spsProfiler.enabled()) || (fp && fp.hasPushedSPSFrame()))
rt->spsProfiler.exit(cx, script, maybeFun);
return ok;
}
inline bool
Probes::exitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
StackFrame *fp)
{
return Probes::exitScript(cx, script, maybeFun, fp ? AbstractFramePtr(fp) : AbstractFramePtr());
}
inline bool
Probes::startExecution(JSScript *script)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_START_ENABLED())
JAVASCRIPT_EXECUTE_START((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
#endif
return ok;
}
inline bool
Probes::stopExecution(JSScript *script)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
#endif
return ok;
}
} /* namespace js */
#endif // Probes_inl_h__

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jsprobes.h"
#include "Probes-inl.h"
#include "jscntxt.h"
#include "jsscript.h"

View File

@ -4,17 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _JSPROBES_H
#define _JSPROBES_H
#ifndef Probes_h__
#define Probes_h__
#include "jspubtd.h"
#include "jsobj.h"
#include "vm/Stack.h"
#ifdef INCLUDE_MOZILLA_DTRACE
#include "javascript-trace.h"
#endif
#include "jspubtd.h"
#include "jsprvtd.h"
#include "jscntxt.h"
#include "jsobj.h"
#include "jsscript.h"
namespace js {
@ -125,87 +124,6 @@ void DTraceExitJSFun(JSContext *cx, JSFunction *fun, JSScript *script);
} /* namespace Probes */
/*
* Many probe handlers are implemented inline for minimal performance impact,
* especially important when no backends are enabled.
*/
inline bool
Probes::callTrackingActive(JSContext *cx)
{
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
return true;
#endif
#ifdef MOZ_TRACE_JSCALLS
if (cx->functionCallback)
return true;
#endif
return false;
}
inline bool
Probes::wantNativeAddressInfo(JSContext *cx)
{
return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION);
}
inline bool
Probes::enterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
StackFrame *fp)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
DTraceEnterJSFun(cx, maybeFun, script);
#endif
#ifdef MOZ_TRACE_JSCALLS
cx->doFunctionCallback(maybeFun, script, 1);
#endif
JSRuntime *rt = cx->runtime;
if (rt->spsProfiler.enabled()) {
rt->spsProfiler.enter(cx, script, maybeFun);
JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame());
fp->setPushedSPSFrame();
}
return ok;
}
inline bool
Probes::exitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
AbstractFramePtr fp)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
DTraceExitJSFun(cx, maybeFun, script);
#endif
#ifdef MOZ_TRACE_JSCALLS
cx->doFunctionCallback(maybeFun, script, 0);
#endif
JSRuntime *rt = cx->runtime;
/*
* Coming from IonMonkey, the fp might not be known (fp == NULL), but
* IonMonkey will only call exitScript() when absolutely necessary, so it is
* guaranteed that fp->hasPushedSPSFrame() would have been true
*/
if ((!fp && rt->spsProfiler.enabled()) || (fp && fp.hasPushedSPSFrame()))
rt->spsProfiler.exit(cx, script, maybeFun);
return ok;
}
inline bool
Probes::exitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
StackFrame *fp)
{
return Probes::exitScript(cx, script, maybeFun, fp ? AbstractFramePtr(fp) : AbstractFramePtr());
}
#ifdef INCLUDE_MOZILLA_DTRACE
static const char *ObjectClassname(JSObject *obj) {
if (!obj)
@ -249,39 +167,7 @@ Probes::finalizeObject(JSObject *obj)
return ok;
}
inline bool
Probes::startExecution(JSScript *script)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_START_ENABLED())
JAVASCRIPT_EXECUTE_START((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
#endif
return ok;
}
inline bool
Probes::stopExecution(JSScript *script)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
#endif
return ok;
}
} /* namespace js */
/*
* Internal functions for controlling various profilers. The profiler-specific
* implementations of these are mostly in jsdbgapi.cpp.
*/
#endif /* _JSPROBES_H */
#endif // Probes_h__

View File

@ -13,11 +13,9 @@
#include "jscompartment.h"
#include "vm/Stack.h"
#ifdef JS_ION
#include "ion/BaselineFrame.h"
#include "ion/BaselineFrame-inl.h"
#include "ion/IonFrameIterator-inl.h"
#endif
#include "jsscriptinlines.h"
#include "ArgumentsObject-inl.h"

View File

@ -8,22 +8,21 @@
#include "mozilla/PodOperations.h"
#include "jscntxt.h"
#include "jsopcode.h"
#include "gc/Marking.h"
#ifdef JS_ION
#include "ion/BaselineFrame.h"
#include "ion/IonFrames.h"
#include "ion/IonCompartment.h"
#endif
#include "Stack.h"
#include "ForkJoin.h"
#include "vm/Stack.h"
#include "vm/ForkJoin.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jsopcode.h"
#include "Interpreter-inl.h"
#include "Stack-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/Stack-inl.h"
#include "vm/Probes-inl.h"
/* Includes to get to low-level memory-mapping functionality. */
#ifdef XP_WIN

View File

@ -9,9 +9,7 @@
#include "jsfun.h"
#include "jsscript.h"
#ifdef JS_ION
#include "ion/IonFrameIterator.h"
#endif
#include "jsautooplen.h"
struct JSContext;

View File

@ -7,13 +7,12 @@
#ifndef String_inl_h__
#define String_inl_h__
#include "vm/String.h"
#include "mozilla/PodOperations.h"
#include "jscntxt.h"
#include "jsprobes.h"
#include "gc/Marking.h"
#include "String.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"