зеркало из https://github.com/mozilla/gecko-dev.git
Bug 955838 - Remove JSScript::enclosingScriptsCompiledSuccessfully() and some unused friend API functions. r=bhackett
This commit is contained in:
Родитель
415c36488e
Коммит
a45b34226f
|
@ -496,12 +496,6 @@ JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj);
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_DefineDebuggerObject(JSContext *cx, JSObject *obj);
|
JS_DefineDebuggerObject(JSContext *cx, JSObject *obj);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
|
||||||
JS_DumpBytecode(JSContext *cx, JSScript *script);
|
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
|
||||||
JS_DumpCompartmentBytecode(JSContext *cx);
|
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
extern JS_PUBLIC_API(void)
|
||||||
JS_DumpPCCounts(JSContext *cx, JSScript *script);
|
JS_DumpPCCounts(JSContext *cx, JSScript *script);
|
||||||
|
|
||||||
|
|
|
@ -443,12 +443,6 @@ js::RunningWithTrustedPrincipals(JSContext *cx)
|
||||||
return cx->runningWithTrustedPrincipals();
|
return cx->runningWithTrustedPrincipals();
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
|
||||||
js::IsOriginalScriptFunction(JSFunction *fun)
|
|
||||||
{
|
|
||||||
return fun->nonLazyScript()->function() == fun;
|
|
||||||
}
|
|
||||||
|
|
||||||
JS_FRIEND_API(JSScript *)
|
JS_FRIEND_API(JSScript *)
|
||||||
js::GetOutermostEnclosingFunctionOfScriptedCaller(JSContext *cx)
|
js::GetOutermostEnclosingFunctionOfScriptedCaller(JSContext *cx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -512,9 +512,6 @@ SetDefaultObjectForContext(JSContext *cx, JSObject *obj);
|
||||||
JS_FRIEND_API(void)
|
JS_FRIEND_API(void)
|
||||||
NotifyAnimationActivity(JSObject *obj);
|
NotifyAnimationActivity(JSObject *obj);
|
||||||
|
|
||||||
JS_FRIEND_API(bool)
|
|
||||||
IsOriginalScriptFunction(JSFunction *fun);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the outermost enclosing function (script) of the scripted caller.
|
* Return the outermost enclosing function (script) of the scripted caller.
|
||||||
* This function returns nullptr in several cases:
|
* This function returns nullptr in several cases:
|
||||||
|
|
|
@ -2102,30 +2102,6 @@ JSScript::uninlinedGlobal() const
|
||||||
return global();
|
return global();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
JSScript::enclosingScriptsCompiledSuccessfully() const
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* When a nested script is succesfully compiled, it is eagerly given the
|
|
||||||
* static JSFunction of its enclosing script. The enclosing function's
|
|
||||||
* 'script' field will be nullptr until the enclosing script successfully
|
|
||||||
* compiles. Thus, we can detect failed compilation by looking for
|
|
||||||
* JSFunctions in the enclosingScope chain without scripts.
|
|
||||||
*/
|
|
||||||
JSObject *enclosing = enclosingStaticScope();
|
|
||||||
while (enclosing) {
|
|
||||||
if (enclosing->is<JSFunction>()) {
|
|
||||||
JSFunction *fun = &enclosing->as<JSFunction>();
|
|
||||||
if (!fun->hasScript() || !fun->nonLazyScript())
|
|
||||||
return false;
|
|
||||||
enclosing = fun->nonLazyScript()->enclosingStaticScope();
|
|
||||||
} else {
|
|
||||||
enclosing = enclosing->as<StaticBlockObject>().enclosingStaticScope();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
|
js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1247,18 +1247,6 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
|
||||||
return enclosingScopeOrOriginalFunction_;
|
return enclosingScopeOrOriginalFunction_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If a compile error occurs in an enclosing function after parsing a
|
|
||||||
* nested function, the enclosing function's JSFunction, which appears on
|
|
||||||
* the nested function's enclosingScope chain, will be invalid. Normal VM
|
|
||||||
* operation only sees scripts where all enclosing scripts have been
|
|
||||||
* successfully compiled. Any path that may look at scripts left over from
|
|
||||||
* unsuccessful compilation (e.g., by iterating over all scripts in the
|
|
||||||
* compartment) should check this predicate before doing any operation that
|
|
||||||
* uses enclosingScope (e.g., ScopeCoordinateName).
|
|
||||||
*/
|
|
||||||
bool enclosingScriptsCompiledSuccessfully() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool makeTypes(JSContext *cx);
|
bool makeTypes(JSContext *cx);
|
||||||
bool makeAnalysis(JSContext *cx);
|
bool makeAnalysis(JSContext *cx);
|
||||||
|
|
|
@ -833,23 +833,6 @@ JS_GetGlobalDebugHooks(JSRuntime *rt)
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
JS_PUBLIC_API(void)
|
|
||||||
JS_DumpBytecode(JSContext *cx, JSScript *scriptArg)
|
|
||||||
{
|
|
||||||
#if defined(DEBUG)
|
|
||||||
Rooted<JSScript*> script(cx, scriptArg);
|
|
||||||
|
|
||||||
Sprinter sprinter(cx);
|
|
||||||
if (!sprinter.init())
|
|
||||||
return;
|
|
||||||
|
|
||||||
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
|
|
||||||
js_Disassemble(cx, script, true, &sprinter);
|
|
||||||
fputs(sprinter.string(), stdout);
|
|
||||||
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
extern JS_PUBLIC_API(void)
|
||||||
JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
|
JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
|
||||||
{
|
{
|
||||||
|
@ -866,30 +849,6 @@ JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
|
||||||
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
|
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
typedef Vector<JSScript *, 0, SystemAllocPolicy> ScriptsToDump;
|
|
||||||
|
|
||||||
static void
|
|
||||||
DumpBytecodeScriptCallback(JSRuntime *rt, void *data, JSScript *script)
|
|
||||||
{
|
|
||||||
static_cast<ScriptsToDump *>(data)->append(script);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* anonymous namespace */
|
|
||||||
|
|
||||||
JS_PUBLIC_API(void)
|
|
||||||
JS_DumpCompartmentBytecode(JSContext *cx)
|
|
||||||
{
|
|
||||||
ScriptsToDump scripts;
|
|
||||||
IterateScripts(cx->runtime(), cx->compartment(), &scripts, DumpBytecodeScriptCallback);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < scripts.length(); i++) {
|
|
||||||
if (scripts[i]->enclosingScriptsCompiledSuccessfully())
|
|
||||||
JS_DumpBytecode(cx, scripts[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JS_PUBLIC_API(void)
|
JS_PUBLIC_API(void)
|
||||||
JS_DumpCompartmentPCCounts(JSContext *cx)
|
JS_DumpCompartmentPCCounts(JSContext *cx)
|
||||||
{
|
{
|
||||||
|
@ -898,7 +857,7 @@ JS_DumpCompartmentPCCounts(JSContext *cx)
|
||||||
if (script->compartment() != cx->compartment())
|
if (script->compartment() != cx->compartment())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (script->hasScriptCounts() && script->enclosingScriptsCompiledSuccessfully())
|
if (script->hasScriptCounts())
|
||||||
JS_DumpPCCounts(cx, script);
|
JS_DumpPCCounts(cx, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче