зеркало из https://github.com/mozilla/gecko-dev.git
Optimization: for line counting use offset of line icode of interpreter instead of the line itself. In this way interpreter does not need to read encoded line data on each line marker which can occur quite frequently.
This commit is contained in:
Родитель
d13a4dc44c
Коммит
6935fd4558
|
@ -2002,9 +2002,8 @@ public class Context {
|
|||
Context cx = getCurrentContext();
|
||||
if (cx == null)
|
||||
return null;
|
||||
if (cx.interpreterLine > 0 && cx.interpreterSourceFile != null) {
|
||||
linep[0] = cx.interpreterLine;
|
||||
return cx.interpreterSourceFile;
|
||||
if (cx.interpreterData != null) {
|
||||
return Interpreter.getSourcePositionFromStack(cx, linep);
|
||||
}
|
||||
/**
|
||||
* A bit of a hack, but the only way to get filename and line
|
||||
|
@ -2208,8 +2207,8 @@ public class Context {
|
|||
private Hashtable activationNames;
|
||||
|
||||
// For the interpreter to indicate line/source for error reports.
|
||||
int interpreterLine;
|
||||
String interpreterSourceFile;
|
||||
int interpreterLineIndex;
|
||||
InterpreterData interpreterData;
|
||||
|
||||
// For instruction counting (interpreter only)
|
||||
int instructionCount;
|
||||
|
|
|
@ -1571,7 +1571,8 @@ public class Interpreter
|
|||
}
|
||||
}
|
||||
|
||||
static int[] getLineNumbers(InterpreterData data) {
|
||||
static int[] getLineNumbers(InterpreterData data)
|
||||
{
|
||||
UintMap presentLines = new UintMap();
|
||||
|
||||
int iCodeLength = data.itsICodeTop;
|
||||
|
@ -1589,6 +1590,13 @@ public class Interpreter
|
|||
|
||||
return presentLines.getKeys();
|
||||
}
|
||||
|
||||
static String getSourcePositionFromStack(Context cx, int[] linep)
|
||||
{
|
||||
InterpreterData idata = cx.interpreterData;
|
||||
linep[0] = getShort(idata.itsICode, cx.interpreterLineIndex);
|
||||
return idata.itsSourceFile;
|
||||
}
|
||||
|
||||
static Object getEncodedSource(InterpreterData idata)
|
||||
{
|
||||
|
@ -1739,8 +1747,8 @@ public class Interpreter
|
|||
debuggerFrame.onEnter(cx, scope, thisObj, args);
|
||||
}
|
||||
|
||||
String savedSourceFile = cx.interpreterSourceFile;
|
||||
cx.interpreterSourceFile = idata.itsSourceFile;
|
||||
InterpreterData savedData = cx.interpreterData;
|
||||
cx.interpreterData = idata;
|
||||
|
||||
Object result = undefined;
|
||||
// If javaException != null on exit, it will be throw instead of
|
||||
|
@ -2665,9 +2673,9 @@ public class Interpreter
|
|||
break;
|
||||
}
|
||||
case Icode_LINE : {
|
||||
int line = getShort(iCode, pc + 1);
|
||||
cx.interpreterLine = line;
|
||||
cx.interpreterLineIndex = pc + 1;
|
||||
if (debuggerFrame != null) {
|
||||
int line = getShort(iCode, pc + 1);
|
||||
debuggerFrame.onLineChange(cx, line);
|
||||
}
|
||||
pc += 2;
|
||||
|
@ -2701,7 +2709,7 @@ public class Interpreter
|
|||
}
|
||||
}
|
||||
|
||||
cx.interpreterSourceFile = savedSourceFile;
|
||||
cx.interpreterData = savedData;
|
||||
|
||||
if (debuggerFrame != null) {
|
||||
if (javaException != null) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче