commit d66df91712a3aea05e21de55f331f33a8a348034
parent 3759f80defe47904aaa8e2b602b28acf02415b6d
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Thu, 30 Oct 2025 20:44:19 +0000
Bug 1997296 - Remove dtrace support for js/ r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D270656
Diffstat:
12 files changed, 5 insertions(+), 235 deletions(-)
diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure
@@ -342,7 +342,7 @@ check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=building_with_gnu_compatible_cc)
-check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace)
+check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin)
check_and_add_asm_flag(
"-fPIC", when=building_with_gnu_compatible_cc & ~target_is_windows
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
@@ -3942,16 +3942,3 @@ def htmlaccel_config(target, c_compiler):
set_config("HTML_ACCEL_FLAGS", htmlaccel_config)
-
-# dtrace support
-##
-option("--enable-dtrace", help="Build with dtrace support")
-
-dtrace = check_header(
- "sys/sdt.h",
- when="--enable-dtrace",
- onerror=lambda: die("dtrace enabled but sys/sdt.h not found"),
-)
-
-set_config("HAVE_DTRACE", True, when=dtrace)
-set_define("INCLUDE_MOZILLA_DTRACE", True, when=dtrace)
diff --git a/config/check_spidermonkey_style.py b/config/check_spidermonkey_style.py
@@ -60,7 +60,6 @@ included_inclnames_to_ignore = set(
"devtools/Instruments.h", # we ignore devtools/ in general
"diplomat_runtime.hpp", # ICU4X
"double-conversion/double-conversion.h", # strange MFBT case
- "javascript-trace.h", # generated in $OBJDIR if HAVE_DTRACE is defined
"frontend/ReservedWordsGenerated.h", # generated in $OBJDIR
"gc/StatsPhasesGenerated.h", # generated in $OBJDIR
"gc/StatsPhasesGenerated.inc", # generated in $OBJDIR
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
@@ -37,27 +37,6 @@ install::
$(MAKE) -C build install
$(MAKE) -C shell install
-ifdef HAVE_DTRACE
-javascript-trace.h: $(srcdir)/devtools/javascript-trace.d
- dtrace -x nolibs -h -s $(srcdir)/devtools/javascript-trace.d -o javascript-trace.h.in
- sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
- -e '/const/!s/char \*/const char */g' \
- javascript-trace.h.in > javascript-trace.h
-
-# We can't automatically generate dependencies on auto-generated headers;
-# we have to list them explicitly.
-$(addsuffix .$(OBJ_SUFFIX),Probes jsinterp jsobj): $(CURDIR)/javascript-trace.h
-
-ifneq ($(OS_ARCH),Darwin)
-DTRACE_PROBE_OBJ = js-dtrace.$(OBJ_SUFFIX)
-$(LIBRARY): $(DTRACE_PROBE_OBJ)
-$(DTRACE_PROBE_OBJ): $(srcdir)/devtools/javascript-trace.d $(OBJS)
- dtrace -x nolibs -G -C -s $< -o $@ $(filter-out $<, $^)
-
-OBJS += $(DTRACE_PROBE_OBJ)
-endif # OS_ARCH != Darwin
-endif # HAVE_DTRACE
-
###############################################
# Generating source package tarballs
# (only possible when tar is found)
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp
@@ -529,15 +529,6 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
return false;
}
-#ifdef INCLUDE_MOZILLA_DTRACE
- value = BooleanValue(true);
-#else
- value = BooleanValue(false);
-#endif
- if (!JS_SetProperty(cx, info, "dtrace", value)) {
- return false;
- }
-
#ifdef MOZ_VALGRIND
value = BooleanValue(true);
#else
diff --git a/js/src/devtools/automation/variants/dtrace b/js/src/devtools/automation/variants/dtrace
@@ -1,5 +0,0 @@
-{
- "configure-args": "--enable-dtrace --enable-debug-symbols --enable-rust-simd",
- "optimize": true,
- "debug": true,
-}
diff --git a/js/src/jit-test/lib/wasm.js b/js/src/jit-test/lib/wasm.js
@@ -13,7 +13,7 @@ function canRunHugeMemoryTests() {
// blocklist of properties that can't be true is great. But the latter is
// probably better.
let blocked = ['rooting-analysis','simulator',
- 'android','wasi','asan','tsan','ubsan','dtrace','valgrind'];
+ 'android','wasi','asan','tsan','ubsan','valgrind'];
for ( let b of blocked ) {
if (getBuildConfiguration(b)) {
print("Failing canRunHugeMemoryTests() because '" + b + "' is true");
diff --git a/js/src/moz.build b/js/src/moz.build
@@ -103,10 +103,6 @@ CONFIGURE_DEFINE_FILES += [
"js-config.h",
]
-if CONFIG["HAVE_DTRACE"]:
- GeneratedFile("javascript-trace.h")
- EXPORTS += ["!javascript-trace.h"]
-
# Changes to internal header files, used externally, massively slow down
# browser builds. Don't add new files here unless you know what you're
# doing!
diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp
@@ -846,12 +846,8 @@ bool js::ExecuteKernel(JSContext* cx, HandleScript script,
return true;
}
- probes::StartExecution(script);
ExecuteState state(cx, script, envChainArg, evalInFrame, result);
- bool ok = RunScript(cx, state);
- probes::StopExecution(script);
-
- return ok;
+ return RunScript(cx, state);
}
bool js::Execute(JSContext* cx, HandleScript script, HandleObject envChain,
diff --git a/js/src/vm/Probes-inl.h b/js/src/vm/Probes-inl.h
@@ -19,24 +19,8 @@ namespace js {
* 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
- return false;
-}
-
inline bool probes::EnterScript(JSContext* cx, JSScript* script,
JSFunction* maybeFun, InterpreterFrame* fp) {
-#ifdef INCLUDE_MOZILLA_DTRACE
- if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED()) {
- DTraceEnterJSFun(cx, maybeFun, script);
- }
-#endif
-
JSRuntime* rt = cx->runtime();
if (rt->geckoProfiler().enabled()) {
if (!cx->geckoProfiler().enter(cx, script)) {
@@ -51,45 +35,11 @@ inline bool probes::EnterScript(JSContext* cx, JSScript* script,
inline void probes::ExitScript(JSContext* cx, JSScript* script,
JSFunction* maybeFun, bool popProfilerFrame) {
-#ifdef INCLUDE_MOZILLA_DTRACE
- if (JAVASCRIPT_FUNCTION_RETURN_ENABLED()) {
- DTraceExitJSFun(cx, maybeFun, script);
- }
-#endif
-
if (popProfilerFrame) {
cx->geckoProfiler().exit(cx, script);
}
}
-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 /* vm_Probes_inl_h */
diff --git a/js/src/vm/Probes.cpp b/js/src/vm/Probes.cpp
@@ -6,59 +6,6 @@
#include "vm/Probes-inl.h"
-#ifdef INCLUDE_MOZILLA_DTRACE
-# include "vm/JSScript-inl.h"
-#endif
-
using namespace js;
-const char probes::nullName[] = "(null)";
-const char probes::anonymousName[] = "(anonymous)";
-
bool probes::ProfilingActive = true;
-
-#ifdef INCLUDE_MOZILLA_DTRACE
-static const char* ScriptFilename(const JSScript* script) {
- if (!script) {
- return probes::nullName;
- }
- if (!script->filename()) {
- return probes::anonymousName;
- }
- return script->filename();
-}
-
-static const char* FunctionName(JSContext* cx, JSFunction* fun,
- UniqueChars* bytes) {
- if (!fun) {
- return probes::nullName;
- }
- if (!fun->maybePartialDisplayAtom()) {
- return probes::anonymousName;
- }
- // TODO: Should be JS_EncodeStringToUTF8, but that'd introduce a rooting
- // hazard, because JS_EncodeStringToUTF8 can GC.
- *bytes = JS_EncodeStringToLatin1(cx, fun->maybePartialDisplayAtom());
- return *bytes ? bytes->get() : probes::nullName;
-}
-
-/*
- * These functions call the DTrace macros for the JavaScript USDT probes.
- * Originally this code was inlined in the JavaScript code; however since
- * a number of operations are called, these have been placed into functions
- * to reduce any negative compiler optimization effect that the addition of
- * a number of usually unused lines of code would cause.
- */
-void probes::DTraceEnterJSFun(JSContext* cx, JSFunction* fun,
- JSScript* script) {
- UniqueChars funNameBytes;
- JAVASCRIPT_FUNCTION_ENTRY(ScriptFilename(script), probes::nullName,
- FunctionName(cx, fun, &funNameBytes));
-}
-
-void probes::DTraceExitJSFun(JSContext* cx, JSFunction* fun, JSScript* script) {
- UniqueChars funNameBytes;
- JAVASCRIPT_FUNCTION_RETURN(ScriptFilename(script), probes::nullName,
- FunctionName(cx, fun, &funNameBytes));
-}
-#endif
diff --git a/js/src/vm/Probes.h b/js/src/vm/Probes.h
@@ -7,10 +7,6 @@
#ifndef vm_Probes_h
#define vm_Probes_h
-#ifdef INCLUDE_MOZILLA_DTRACE
-# include "javascript-trace.h"
-#endif
-
#include "vm/JSObject.h"
namespace js {
@@ -51,28 +47,12 @@ namespace probes {
*/
extern bool ProfilingActive;
-extern const char nullName[];
-extern const char anonymousName[];
-
-/*
- * Test whether we are tracking JS function call enter/exit. The JITs use this
- * to decide whether they can optimize in a way that would prevent probes from
- * firing.
- */
-bool CallTrackingActive(JSContext*);
-
/* Entering a JS function */
bool EnterScript(JSContext*, JSScript*, JSFunction*, InterpreterFrame*);
/* About to leave a JS function */
void ExitScript(JSContext*, JSScript*, JSFunction*, bool popProfilerFrame);
-/* Executing a script */
-bool StartExecution(JSScript* script);
-
-/* Script has completed execution */
-bool StopExecution(JSScript* script);
-
/*
* Object has been created. |obj| must exist (its class and size are read)
*/
@@ -83,61 +63,11 @@ bool CreateObject(JSContext* cx, JSObject* obj);
* read)
*/
bool FinalizeObject(JSObject* obj);
-
-/*
- * Internal: DTrace-specific functions to be called during probes::EnterScript
- * and probes::ExitScript. These will not be inlined, but the argument
- * marshalling required for these probe points is expensive enough that it
- * shouldn't really matter.
- */
-void DTraceEnterJSFun(JSContext* cx, JSFunction* fun, JSScript* script);
-void DTraceExitJSFun(JSContext* cx, JSFunction* fun, JSScript* script);
-
} // namespace probes
-#ifdef INCLUDE_MOZILLA_DTRACE
-static const char* ObjectClassname(JSObject* obj) {
- if (!obj) {
- return "(null object)";
- }
- const JSClass* clasp = obj->getClass();
- if (!clasp) {
- return "(null)";
- }
- const char* class_name = clasp->name;
- if (!class_name) {
- return "(null class name)";
- }
- return class_name;
-}
-#endif
-
-inline bool probes::CreateObject(JSContext* cx, JSObject* obj) {
- bool ok = true;
-
-#ifdef INCLUDE_MOZILLA_DTRACE
- if (JAVASCRIPT_OBJECT_CREATE_ENABLED()) {
- JAVASCRIPT_OBJECT_CREATE(ObjectClassname(obj), (uintptr_t)obj);
- }
-#endif
-
- return ok;
-}
-
-inline bool probes::FinalizeObject(JSObject* obj) {
- bool ok = true;
-
-#ifdef INCLUDE_MOZILLA_DTRACE
- if (JAVASCRIPT_OBJECT_FINALIZE_ENABLED()) {
- const JSClass* clasp = obj->getClass();
-
- /* the first arg is nullptr - reserved for future use (filename?) */
- JAVASCRIPT_OBJECT_FINALIZE(nullptr, (char*)clasp->name, (uintptr_t)obj);
- }
-#endif
+inline bool probes::CreateObject(JSContext* cx, JSObject* obj) { return true; }
- return ok;
-}
+inline bool probes::FinalizeObject(JSObject* obj) { return true; }
} /* namespace js */