зеркало из https://github.com/mozilla/gecko-dev.git
Removal of no longer used debug name index in Token.CALL/Token.REF_CALL: ScriptRuntime.get(Elem|Prop|Name|Value)FunctionAndThis takes care about debugging themselves.
This commit is contained in:
Родитель
5253d42f7c
Коммит
11ce08544d
|
@ -1106,6 +1106,9 @@ public class Interpreter
|
||||||
iCodeTop = addShort(itsLineNumber, iCodeTop);
|
iCodeTop = addShort(itsLineNumber, iCodeTop);
|
||||||
} else {
|
} else {
|
||||||
iCodeTop = addIndexOp(type, argCount, iCodeTop);
|
iCodeTop = addIndexOp(type, argCount, iCodeTop);
|
||||||
|
if (type == Token.NEW) {
|
||||||
|
// Code for generateCallFunAndThis takes care about debugging
|
||||||
|
// for Token.CALL abd Token.REF_CALL;
|
||||||
if (debugNameIndex < 0xFFFF) {
|
if (debugNameIndex < 0xFFFF) {
|
||||||
// Use only 2 bytes to store debug index
|
// Use only 2 bytes to store debug index
|
||||||
iCodeTop = addShort(debugNameIndex, iCodeTop);
|
iCodeTop = addShort(debugNameIndex, iCodeTop);
|
||||||
|
@ -1113,6 +1116,7 @@ public class Interpreter
|
||||||
iCodeTop = addShort(0xFFFF, iCodeTop);
|
iCodeTop = addShort(0xFFFF, iCodeTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// adjust stack
|
// adjust stack
|
||||||
if (type == Token.NEW) {
|
if (type == Token.NEW) {
|
||||||
// f, args -> results
|
// f, args -> results
|
||||||
|
@ -1735,8 +1739,10 @@ public class Interpreter
|
||||||
out.println(tname+" "+idata.itsNestedFunctions[indexReg]);
|
out.println(tname+" "+idata.itsNestedFunctions[indexReg]);
|
||||||
break;
|
break;
|
||||||
case Token.CALL :
|
case Token.CALL :
|
||||||
case Token.NEW :
|
|
||||||
case Token.REF_CALL :
|
case Token.REF_CALL :
|
||||||
|
out.println(tname+' '+indexReg);
|
||||||
|
break;
|
||||||
|
case Token.NEW :
|
||||||
out.println(tname+' '+indexReg);
|
out.println(tname+' '+indexReg);
|
||||||
pc += 2;
|
pc += 2;
|
||||||
break;
|
break;
|
||||||
|
@ -1862,9 +1868,7 @@ public class Interpreter
|
||||||
// line number
|
// line number
|
||||||
return 1 + 1 + 1 + 2;
|
return 1 + 1 + 1 + 2;
|
||||||
|
|
||||||
case Token.CALL :
|
|
||||||
case Token.NEW :
|
case Token.NEW :
|
||||||
case Token.REF_CALL :
|
|
||||||
// index of potential function name for debugging
|
// index of potential function name for debugging
|
||||||
return 1 + 2;
|
return 1 + 2;
|
||||||
|
|
||||||
|
@ -2659,7 +2663,29 @@ switch (op) {
|
||||||
indexReg);
|
indexReg);
|
||||||
stack[stackTop] = fun.call(cx, funScope, funThisObj, outArgs);
|
stack[stackTop] = fun.call(cx, funScope, funThisObj, outArgs);
|
||||||
}
|
}
|
||||||
pc += 2;
|
continue Loop;
|
||||||
|
}
|
||||||
|
case Token.REF_CALL : {
|
||||||
|
if (instructionCounting) {
|
||||||
|
cx.instructionCount += INVOCATION_COST;
|
||||||
|
}
|
||||||
|
// indexReg: number of arguments
|
||||||
|
stackTop -= indexReg;
|
||||||
|
int calleeArgShft = stackTop + 1;
|
||||||
|
|
||||||
|
// REF_CALL generation ensures that funThisObj and fun
|
||||||
|
// are already Scriptable and Function objects respectively
|
||||||
|
Scriptable funThisObj = (Scriptable)stack[stackTop];
|
||||||
|
--stackTop;
|
||||||
|
Function fun = (Function)stack[stackTop];
|
||||||
|
|
||||||
|
Scriptable funScope = scope;
|
||||||
|
if (idata.itsNeedsActivation) {
|
||||||
|
funScope = ScriptableObject.getTopLevelScope(scope);
|
||||||
|
}
|
||||||
|
Object[] outArgs = getArgsArray(stack, sDbl, calleeArgShft, indexReg);
|
||||||
|
stack[stackTop] = ScriptRuntime.referenceCall(fun, funThisObj, outArgs,
|
||||||
|
cx, funScope);
|
||||||
continue Loop;
|
continue Loop;
|
||||||
}
|
}
|
||||||
case Token.NEW : {
|
case Token.NEW : {
|
||||||
|
@ -2693,31 +2719,7 @@ switch (op) {
|
||||||
if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]);
|
if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]);
|
||||||
throw notAFunction(lhs, idata, pc);
|
throw notAFunction(lhs, idata, pc);
|
||||||
}
|
}
|
||||||
pc += 2;
|
pc += 2; // skip debug name index
|
||||||
continue Loop;
|
|
||||||
}
|
|
||||||
case Token.REF_CALL : {
|
|
||||||
if (instructionCounting) {
|
|
||||||
cx.instructionCount += INVOCATION_COST;
|
|
||||||
}
|
|
||||||
// indexReg: number of arguments
|
|
||||||
stackTop -= indexReg;
|
|
||||||
int calleeArgShft = stackTop + 1;
|
|
||||||
|
|
||||||
// REF_CALL generation ensures that funThisObj and fun
|
|
||||||
// are already Scriptable and Function objects respectively
|
|
||||||
Scriptable funThisObj = (Scriptable)stack[stackTop];
|
|
||||||
--stackTop;
|
|
||||||
Function fun = (Function)stack[stackTop];
|
|
||||||
|
|
||||||
Scriptable funScope = scope;
|
|
||||||
if (idata.itsNeedsActivation) {
|
|
||||||
funScope = ScriptableObject.getTopLevelScope(scope);
|
|
||||||
}
|
|
||||||
Object[] outArgs = getArgsArray(stack, sDbl, calleeArgShft, indexReg);
|
|
||||||
stack[stackTop] = ScriptRuntime.referenceCall(fun, funThisObj, outArgs,
|
|
||||||
cx, funScope);
|
|
||||||
pc += 2;
|
|
||||||
continue Loop;
|
continue Loop;
|
||||||
}
|
}
|
||||||
case Token.TYPEOF : {
|
case Token.TYPEOF : {
|
||||||
|
@ -3467,7 +3469,7 @@ switch (op) {
|
||||||
} else {
|
} else {
|
||||||
debugName = ScriptRuntime.toString(notAFunction);
|
debugName = ScriptRuntime.toString(notAFunction);
|
||||||
}
|
}
|
||||||
throw ScriptRuntime.typeError1("msg.isnt.function", debugName);
|
throw ScriptRuntime.notFunctionError(notAFunction, debugName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object[] getArgsArray(Object[] stack, double[] sDbl,
|
private static Object[] getArgsArray(Object[] stack, double[] sDbl,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче