From 04fc511d3dbf7b7d584f9eac326759442f2a56f6 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 16 Oct 2018 14:35:44 -0700 Subject: [PATCH] Backed out changeset c22b643cdf51 (bug 1479961, bug 1480129) --- js/public/GCAnnotations.h | 6 ----- js/src/devtools/rootAnalysis/annotations.js | 12 ---------- .../devtools/rootAnalysis/computeCallgraph.js | 24 ++----------------- js/src/jit/Jit.cpp | 2 +- js/src/vm/Interpreter.cpp | 4 ++-- 5 files changed, 5 insertions(+), 43 deletions(-) diff --git a/js/public/GCAnnotations.h b/js/public/GCAnnotations.h index 3d366f4b3ffa..021021c8ad95 100644 --- a/js/public/GCAnnotations.h +++ b/js/public/GCAnnotations.h @@ -55,11 +55,6 @@ // subsumes JS_HAZ_GC_CALL, since anything that can run script can GC.` # define JS_HAZ_CAN_RUN_SCRIPT __attribute__((annotate("Can run script"))) -// Mark a function as able to call JSNatives. Otherwise, JSNatives don't show -// up in the callgraph. This doesn't matter for the can-GC analysis, but it is -// very nice for other uses of the callgraph. -# define JS_HAZ_JSNATIVE_CALLER __attribute__((annotate("Calls JSNatives"))) - #else # define JS_HAZ_GC_THING @@ -71,7 +66,6 @@ # define JS_HAZ_GC_CALL # define JS_HAZ_GC_SUPPRESSED # define JS_HAZ_CAN_RUN_SCRIPT -# define JS_HAZ_JSNATIVE_CALLER #endif diff --git a/js/src/devtools/rootAnalysis/annotations.js b/js/src/devtools/rootAnalysis/annotations.js index 69012d98161b..8a1ac828fdbb 100644 --- a/js/src/devtools/rootAnalysis/annotations.js +++ b/js/src/devtools/rootAnalysis/annotations.js @@ -427,15 +427,3 @@ function listNonGCPointers() { 'NPIdentifier', ]; } - -function isJSNative(mangled) -{ - // _Z...E = function - // 9JSContext = JSContext* - // j = uint32 - // PN2JS5Value = JS::Value* - // P = pointer - // N2JS = JS:: - // 5Value = Value - return mangled.endsWith("P9JSContextjPN2JS5ValueE") && mangled.startsWith("_Z"); -} diff --git a/js/src/devtools/rootAnalysis/computeCallgraph.js b/js/src/devtools/rootAnalysis/computeCallgraph.js index 3a1def441034..949669b29a2e 100644 --- a/js/src/devtools/rootAnalysis/computeCallgraph.js +++ b/js/src/devtools/rootAnalysis/computeCallgraph.js @@ -18,9 +18,6 @@ var origOut = os.file.redirect(callgraphOut_filename); var memoized = new Map(); var memoizedCount = 0; -var JSNativeCaller = Object.create(null); -var JSNatives = []; - var unmangled2id = new Set(); function getId(name) @@ -105,11 +102,8 @@ function processBody(functionName, body) return; - for (var tag of getAnnotations(functionName, body).values()) { + for (var tag of getAnnotations(functionName, body).values()) print("T " + functionId(functionName) + " " + tag); - if (tag == "Calls JSNatives") - JSNativeCaller[functionName] = true; - } // Set of all callees that have been output so far, in order to suppress // repeated callgraph edges from being recorded. This uses a Map from @@ -228,8 +222,6 @@ function process(functionName, functionBodies) printOnce("D " + functionId(inChargeXTor) + " " + functionId(functionName)); } - const [ mangled, unmangled ] = splitFunction(functionName); - // Further note: from https://itanium-cxx-abi.github.io/cxx-abi/abi.html the // different kinds of constructors/destructors are: // C1 # complete object constructor @@ -264,6 +256,7 @@ function process(functionName, functionBodies) // Currently, allocating constructors are never used. // if (functionName.indexOf("C4") != -1) { + var [ mangled, unmangled ] = splitFunction(functionName); // E terminates the method name (and precedes the method parameters). // If eg "C4E" shows up in the mangled name for another reason, this // will create bogus edges in the callgraph. But it will affect little @@ -312,17 +305,6 @@ function process(functionName, functionBodies) printOnce("D " + functionId(D1) + " " + functionId(D2)); printOnce("D " + functionId(D2) + " " + functionId(functionName)); } - - if (isJSNative(mangled)) - JSNatives.push(functionName); -} - -function postprocess_callgraph() { - for (const caller of Object.keys(JSNativeCaller)) { - const caller_id = functionId(caller); - for (const callee of JSNatives) - printOnce(`D ${caller_id} ${functionId(callee)}`); - } } for (var nameIndex = minStream; nameIndex <= maxStream; nameIndex++) { @@ -333,6 +315,4 @@ for (var nameIndex = minStream; nameIndex <= maxStream; nameIndex++) { xdb.free_string(data); } -postprocess_callgraph(); - os.file.close(os.file.redirect(origOut)); diff --git a/js/src/jit/Jit.cpp b/js/src/jit/Jit.cpp index 147da9230178..fcaedd84655f 100644 --- a/js/src/jit/Jit.cpp +++ b/js/src/jit/Jit.cpp @@ -17,7 +17,7 @@ using namespace js; using namespace js::jit; -static EnterJitStatus JS_HAZ_JSNATIVE_CALLER +static EnterJitStatus EnterJit(JSContext* cx, RunState& state, uint8_t* code) { MOZ_ASSERT(state.script()->hasBaselineScript()); diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index a2e3dd7017db..71360d99b18f 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -368,7 +368,7 @@ MaybeCreateThisForConstructor(JSContext* cx, JSScript* calleeScript, const CallA return CreateThis(cx, callee, calleeScript, newTarget, newKind, args.mutableThisv()); } -static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool +static MOZ_NEVER_INLINE bool Interpret(JSContext* cx, RunState& state); InterpreterFrame* @@ -1992,7 +1992,7 @@ js::ReportInNotObjectError(JSContext* cx, HandleValue lref, int lindex, InformalValueTypeName(rref)); } -static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool +static MOZ_NEVER_INLINE bool Interpret(JSContext* cx, RunState& state) { /*