Bug 1043588 - Remove some unused functions from OldDebugAPI. r=jimb

This commit is contained in:
Tom Schuster 2014-07-25 14:26:40 +02:00
parent f68682512f
commit 7fecfd389c
4 changed files with 5 additions and 236 deletions

View File

@ -28,12 +28,6 @@ class FrameIter;
class ScriptSource;
}
// Raw JSScript* because this needs to be callable from a signal handler.
extern JS_PUBLIC_API(unsigned)
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
extern JS_PUBLIC_API(const char *)
JS_GetScriptFilename(JSScript *script);
namespace JS {
@ -59,9 +53,6 @@ typedef enum JSTrapStatus {
JSTRAP_LIMIT
} JSTrapStatus;
extern JS_PUBLIC_API(JSCompartment *)
JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target);
extern JS_PUBLIC_API(JSString *)
JS_DecompileScript(JSContext *cx, JS::HandleScript script, const char *name, unsigned indent);
@ -114,64 +105,21 @@ JS_SetSingleStepMode(JSContext *cx, JS::HandleScript script, bool singleStep);
/************************************************************************/
// Raw JSScript* because this needs to be callable from a signal handler.
extern JS_PUBLIC_API(unsigned)
JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
extern JS_PUBLIC_API(jsbytecode *)
JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno);
extern JS_PUBLIC_API(jsbytecode *)
JS_EndPC(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(bool)
JS_GetLinePCs(JSContext *cx, JSScript *script,
unsigned startLine, unsigned maxLines,
unsigned* count, unsigned** lines, jsbytecode*** pcs);
extern JS_PUBLIC_API(unsigned)
JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);
extern JS_PUBLIC_API(bool)
JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun);
/*
* N.B. The mark is in the context temp pool and thus the caller must take care
* to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other
* call that may use the temp pool.
*/
extern JS_PUBLIC_API(uintptr_t *)
JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp);
extern JS_PUBLIC_API(JSAtom *)
JS_LocalNameToAtom(uintptr_t w);
extern JS_PUBLIC_API(JSString *)
JS_AtomKey(JSAtom *atom);
extern JS_PUBLIC_API(void)
JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark);
extern JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, JS::HandleFunction fun);
extern JS_PUBLIC_API(JSNative)
JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
JS_PUBLIC_API(JSFunction *)
JS_GetScriptFunction(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(JSObject *)
JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
/************************************************************************/
/*
* This is almost JS_GetClass(obj)->name except that certain debug-only
* proxies are made transparent. In particular, this function turns the class
* of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObject)
* from "Proxy" to "Call", "Block", "With" etc.
*/
extern JS_PUBLIC_API(const char *)
JS_GetDebugClassName(JSObject *obj);
/************************************************************************/
JS_GetScriptFilename(JSScript *script);
extern JS_PUBLIC_API(const jschar *)
JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
@ -182,13 +130,6 @@ JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(unsigned)
JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(JSVersion)
JS_GetScriptVersion(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(bool)
JS_GetScriptIsSelfHosted(JSScript *script);
/************************************************************************/
/*

View File

@ -36,7 +36,6 @@ BEGIN_TEST(testScriptInfo)
jsbytecode *start = JS_LineNumberToPC(cx, script, startLine);
CHECK_EQUAL(JS_GetScriptBaseLineNumber(cx, script), startLine);
CHECK_EQUAL(JS_PCToLineNumber(cx, script, start), startLine);
CHECK_EQUAL(JS_GetScriptLineExtent(cx, script), 11u);
CHECK(strcmp(JS_GetScriptFilename(script), __FILE__) == 0);
const jschar *sourceMap = JS_GetScriptSourceMap(cx, script);
CHECK(sourceMap);

View File

@ -941,15 +941,6 @@ JS_EnterCompartment(JSContext *cx, JSObject *target)
return oldCompartment;
}
JS_PUBLIC_API(JSCompartment *)
JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
GlobalObject &global = target->global();
return JS_EnterCompartment(cx, &global);
}
JS_PUBLIC_API(void)
JS_LeaveCompartment(JSContext *cx, JSCompartment *oldCompartment)
{

View File

@ -196,121 +196,6 @@ JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno)
return js_LineNumberToPC(script, lineno);
}
JS_PUBLIC_API(jsbytecode *)
JS_EndPC(JSContext *cx, JSScript *script)
{
return script->codeEnd();
}
JS_PUBLIC_API(bool)
JS_GetLinePCs(JSContext *cx, JSScript *script,
unsigned startLine, unsigned maxLines,
unsigned* count, unsigned** retLines, jsbytecode*** retPCs)
{
size_t len = (script->length() > maxLines ? maxLines : script->length());
unsigned *lines = cx->pod_malloc<unsigned>(len);
if (!lines)
return false;
jsbytecode **pcs = cx->pod_malloc<jsbytecode*>(len);
if (!pcs) {
js_free(lines);
return false;
}
unsigned lineno = script->lineno();
unsigned offset = 0;
unsigned i = 0;
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
offset += SN_DELTA(sn);
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
if (type == SRC_SETLINE || type == SRC_NEWLINE) {
if (type == SRC_SETLINE)
lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
else
lineno++;
if (lineno >= startLine) {
lines[i] = lineno;
pcs[i] = script->offsetToPC(offset);
if (++i >= maxLines)
break;
}
}
}
*count = i;
if (retLines)
*retLines = lines;
else
js_free(lines);
if (retPCs)
*retPCs = pcs;
else
js_free(pcs);
return true;
}
JS_PUBLIC_API(unsigned)
JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun)
{
return fun->nargs();
}
JS_PUBLIC_API(bool)
JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun)
{
return fun->nonLazyScript()->bindings.count() > 0;
}
extern JS_PUBLIC_API(uintptr_t *)
JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **memp)
{
RootedScript script(cx, fun->nonLazyScript());
BindingVector bindings(cx);
if (!FillBindingVector(script, &bindings))
return nullptr;
LifoAlloc &lifo = cx->tempLifoAlloc();
// Store the LifoAlloc::Mark right before the allocation.
LifoAlloc::Mark mark = lifo.mark();
void *mem = lifo.alloc(sizeof(LifoAlloc::Mark) + bindings.length() * sizeof(uintptr_t));
if (!mem) {
js_ReportOutOfMemory(cx);
return nullptr;
}
*memp = mem;
*reinterpret_cast<LifoAlloc::Mark*>(mem) = mark;
// Munge data into the API this method implements. Avert your eyes!
uintptr_t *names = reinterpret_cast<uintptr_t*>((char*)mem + sizeof(LifoAlloc::Mark));
for (size_t i = 0; i < bindings.length(); i++)
names[i] = reinterpret_cast<uintptr_t>(bindings[i].name());
return names;
}
extern JS_PUBLIC_API(JSAtom *)
JS_LocalNameToAtom(uintptr_t w)
{
return reinterpret_cast<JSAtom *>(w);
}
extern JS_PUBLIC_API(JSString *)
JS_AtomKey(JSAtom *atom)
{
return atom;
}
extern JS_PUBLIC_API(void)
JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mem)
{
cx->tempLifoAlloc().release(*reinterpret_cast<LifoAlloc::Mark*>(mem));
}
JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, HandleFunction fun)
{
@ -326,35 +211,6 @@ JS_GetFunctionScript(JSContext *cx, HandleFunction fun)
return fun->nonLazyScript();
}
JS_PUBLIC_API(JSNative)
JS_GetFunctionNative(JSContext *cx, JSFunction *fun)
{
return fun->maybeNative();
}
/************************************************************************/
JS_PUBLIC_API(JSFunction *)
JS_GetScriptFunction(JSContext *cx, JSScript *script)
{
script->ensureNonLazyCanonicalFunction(cx);
return script->functionNonDelazifying();
}
JS_PUBLIC_API(JSObject *)
JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj)
{
return obj->enclosingScope();
}
JS_PUBLIC_API(const char *)
JS_GetDebugClassName(JSObject *obj)
{
if (obj->is<DebugScopeObject>())
return obj->as<DebugScopeObject>().scope().getClass()->name;
return obj->getClass()->name;
}
/************************************************************************/
JS_PUBLIC_API(const char *)
@ -377,24 +233,6 @@ JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script)
return script->lineno();
}
JS_PUBLIC_API(unsigned)
JS_GetScriptLineExtent(JSContext *cx, JSScript *script)
{
return js_GetScriptLineExtent(script);
}
JS_PUBLIC_API(JSVersion)
JS_GetScriptVersion(JSContext *cx, JSScript *script)
{
return VersionNumber(script->getVersion());
}
JS_PUBLIC_API(bool)
JS_GetScriptIsSelfHosted(JSScript *script)
{
return script->selfHosted();
}
/***************************************************************************/
extern JS_PUBLIC_API(void)