This commit is contained in:
Steve Fink 2011-05-24 16:53:07 -07:00
Родитель 213abb5dfb
Коммит 841dc77018
8 изменённых файлов: 4 добавлений и 189 удалений

Просмотреть файл

@ -542,7 +542,7 @@ interface jsdIContextEnumerator : nsISupports
/**
* Set jsdIDebuggerService::scriptHook to an instance of one of these.
*/
[scriptable, uuid(d030d1a2-a58a-4f19-b9e3-96da4e2cdd09)]
[scriptable, uuid(bb722893-0f63-45c5-b547-7a0947c7b6b6)]
interface jsdIScriptHook : nsISupports
{
/**
@ -811,7 +811,7 @@ interface jsdIContext : jsdIEphemeral
* interface. Once a jsdIStackFrame has been invalidated all method and
* property accesses will throw a NS_ERROR_NOT_AVAILABLE exception.
*/
[scriptable, uuid(7c95422c-7579-4a6f-8ef7-e5b391552ee5)]
[scriptable, uuid(0633ca73-105e-4e8e-bcc5-13405d61754a)]
interface jsdIStackFrame : jsdIEphemeral
{
/** Internal use only. */
@ -884,7 +884,7 @@ interface jsdIStackFrame : jsdIEphemeral
* Script object. In JavaScript engine terms, there's a single script for each
* function, and one for the top level script.
*/
[scriptable, uuid(721724e0-7716-4bf4-b48f-92b78d056141)]
[scriptable, uuid(e7935220-7def-4c8e-832f-fbc948a97490)]
interface jsdIScript : jsdIEphemeral
{
/** Internal use only. */
@ -1030,17 +1030,6 @@ interface jsdIScript : jsdIEphemeral
* The |pcmap| argument specifies which pc to source line map to use.
*/
boolean isLineExecutable(in unsigned long line, in unsigned long pcmap);
/**
* Return a list of all executable lines in a script.
* |pcmap| specifies which pc to source line map to use.
* |startLine| and |maxLines| may be used to retrieve a chunk at a time.
*/
void getExecutableLines(in unsigned long pcmap,
in unsigned long startLine, in unsigned long maxLines,
out unsigned long count,
[array, size_is(count), retval] out unsigned long executableLines);
/**
* Set a breakpoint at a PC in this script.
*/
@ -1065,7 +1054,7 @@ interface jsdIScript : jsdIEphemeral
* jsdIValue adds a root for the underlying JavaScript value, so don't keep it
* if you don't need to.
*/
[scriptable, uuid(861c4d37-e115-4a52-9f76-273cb6b21c3b)]
[scriptable, uuid(fd1311f7-096c-44a3-847b-9d478c8176c3)]
interface jsdIValue : jsdIEphemeral
{
/** Internal use only. */

Просмотреть файл

@ -481,11 +481,6 @@ jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, uintN line);
extern uintN
jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
extern JSBool
jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
uintN startLine, uintN maxLines,
uintN* count, uintN** lines, jsuword** pcs);
extern void
jsd_NewScriptHookProc(
JSContext *cx,

Просмотреть файл

@ -580,44 +580,6 @@ jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc)
return line;
}
JSBool
jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
uintN startLine, uintN maxLines,
uintN* count, uintN** retLines, jsuword** retPCs)
{
JSCrossCompartmentCall *call;
uintN first = jsdscript->lineBase;
uintN last = first + jsd_GetScriptLineExtent(jsdc, jsdscript) - 1;
JSBool ok;
uintN *lines;
jsbytecode **pcs;
uintN i;
if (last < startLine)
return JS_TRUE;
call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script);
if (!call)
return JS_FALSE;
ok = JS_GetLinePCs(jsdc->dumbContext, jsdscript->script,
startLine, maxLines,
count, retLines, &pcs);
if (ok) {
if (retPCs) {
for (i = 0; i < *count; ++i) {
(*retPCs)[i] = (*pcs)[i];
}
}
JS_free(jsdc->dumbContext, pcs);
}
JS_LeaveCrossCompartmentCall(call);
return ok;
}
JSBool
jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata)
{

Просмотреть файл

@ -1541,58 +1541,6 @@ jsdScript::EnableSingleStepInterrupts(PRBool enable)
return (JSD_EnableSingleStepInterrupts(mCx, mScript, enable) ? NS_OK : NS_ERROR_FAILURE);
}
NS_IMETHODIMP
jsdScript::GetExecutableLines(PRUint32 aPcmap, PRUint32 aStartLine, PRUint32 aMaxLines,
PRUint32* aCount, PRUint32** aExecutableLines)
{
ASSERT_VALID_EPHEMERAL;
if (aPcmap == PCMAP_SOURCETEXT) {
jsuword start = JSD_GetClosestPC(mCx, mScript, 0);
uintN lastLine = JSD_GetScriptBaseLineNumber(mCx, mScript)
+ JSD_GetScriptLineExtent(mCx, mScript) - 1;
jsuword end = JSD_GetClosestPC(mCx, mScript, lastLine + 1);
*aExecutableLines = static_cast<PRUint32*>(NS_Alloc((end - start + 1) * sizeof(PRUint32)));
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines, NULL))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
if (aPcmap == PCMAP_PRETTYPRINT) {
if (!mPPLineMap) {
if (!CreatePPLineMap())
return NS_ERROR_OUT_OF_MEMORY;
}
nsTArray<PRUint32> lines;
PRUint32 i;
for (i = 0; i < mPCMapSize; ++i) {
if (mPPLineMap[i].line >= aStartLine)
break;
}
for (; i < mPCMapSize && lines.Length() < aMaxLines; ++i) {
lines.AppendElement(mPPLineMap[i].line);
}
if (aCount)
*aCount = lines.Length();
*aExecutableLines = static_cast<PRUint32*>(NS_Alloc(lines.Length() * sizeof(PRUint32)));
if (!*aExecutableLines)
return NS_ERROR_OUT_OF_MEMORY;
for (i = 0; i < lines.Length(); ++i)
(*aExecutableLines)[i] = lines[i];
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
jsdScript::IsLineExecutable(PRUint32 aLine, PRUint32 aPcmap, PRBool *_rval)
{

Просмотреть файл

@ -356,16 +356,6 @@ JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc)
return jsd_GetClosestLine(jsdc, jsdscript, pc);
}
JSD_PUBLIC_API(JSBool)
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
uintN startLine, uintN maxLines,
uintN* count, uintN** lines, jsuword** pcs)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_SCRIPT(jsdscript);
return jsd_GetLinePCs(jsdc, jsdscript, startLine, maxLines, count, lines, pcs);
}
JSD_PUBLIC_API(void)
JSD_ScriptCreated(JSDContext* jsdc,
JSContext *cx,

Просмотреть файл

@ -496,17 +496,6 @@ JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, uintN line);
extern JSD_PUBLIC_API(uintN)
JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, jsuword pc);
/*
* Get a list of lines and the corresponding earliest PC for each (see
* JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL
* may be passed for either lines or pcs to avoid filling anything in for that
* argument.
*/
extern JSD_PUBLIC_API(JSBool)
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
uintN startLine, uintN maxLines,
uintN* count, uintN** lines, jsuword** pcs);
/* these are only used in cases where scripts are created outside of JS*/
/*

Просмотреть файл

@ -1299,59 +1299,6 @@ JS_EndPC(JSContext *cx, JSScript *script)
return script->code + script->length;
}
JS_PUBLIC_API(JSBool)
JS_GetLinePCs(JSContext *cx, JSScript *script,
uintN startLine, uintN maxLines,
uintN* count, uintN** retLines, jsbytecode*** retPCs)
{
uintN* lines;
jsbytecode** pcs;
size_t len = (script->length > maxLines ? maxLines : script->length);
lines = (uintN*) cx->malloc_(len * sizeof(uintN));
if (!lines)
return JS_FALSE;
pcs = (jsbytecode**) cx->malloc_(len * sizeof(jsbytecode*));
if (!pcs) {
cx->free_(lines);
return JS_FALSE;
}
uintN lineno = script->lineno;
uintN offset = 0;
uintN i = 0;
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
offset += SN_DELTA(sn);
JSSrcNoteType type = (JSSrcNoteType) SN_TYPE(sn);
if (type == SRC_SETLINE || type == SRC_NEWLINE) {
if (type == SRC_SETLINE)
lineno = (uintN) js_GetSrcNoteOffset(sn, 0);
else
lineno++;
if (lineno >= startLine) {
lines[i] = lineno;
pcs[i] = script->code + offset;
if (++i >= maxLines)
break;
}
}
}
*count = i;
if (retLines)
*retLines = lines;
else
cx->free_(lines);
if (retPCs)
*retPCs = pcs;
else
cx->free_(pcs);
return JS_TRUE;
}
JS_PUBLIC_API(uintN)
JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun)
{

Просмотреть файл

@ -217,11 +217,6 @@ JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno);
extern JS_PUBLIC_API(jsbytecode *)
JS_EndPC(JSContext *cx, JSScript *script);
extern JS_PUBLIC_API(JSBool)
JS_GetLinePCs(JSContext *cx, JSScript *script,
uintN startLine, uintN maxLines,
uintN* count, uintN** lines, jsbytecode*** pcs);
extern JS_PUBLIC_API(uintN)
JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);