Patch from Bob Jervis (bjervis@google.com):
Here is the patch for the (mostly) formatting issues in the code differences. Note: There is one non-formatting change in here. It is fallout from the 'const' support I implemented some time back. Basically, the change marginally improves the memory allocation for compiled code. Essentially, the bug is that I was reserving 2 slots for each local, when I should only reserve one in this function. (This is the result of a bad cut and paste, I think, with the function above it in Codegen.java.) git-svn-id: svn://10.0.0.236/trunk@229806 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
2c78e8a5d6
commit
c940f9ef3d
@ -696,10 +696,10 @@ public class Interpreter
|
||||
// For example, eval("function () {}") should return a
|
||||
// function, not undefined.
|
||||
if (!itsInFunctionFlag) {
|
||||
addIndexOp(Icode_CLOSURE_EXPR, fnIndex);
|
||||
stackChange(1);
|
||||
addIcode(Icode_POP_RESULT);
|
||||
stackChange(-1);
|
||||
addIndexOp(Icode_CLOSURE_EXPR, fnIndex);
|
||||
stackChange(1);
|
||||
addIcode(Icode_POP_RESULT);
|
||||
stackChange(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1267,15 +1267,15 @@ public class Interpreter
|
||||
}
|
||||
break;
|
||||
|
||||
case Token.SETCONSTVAR:
|
||||
{
|
||||
if (itsData.itsNeedsActivation) Kit.codeBug();
|
||||
int index = scriptOrFn.getIndexForNameNode(child);
|
||||
child = child.getNext();
|
||||
visitExpression(child, 0);
|
||||
addVarOp(Token.SETCONSTVAR, index);
|
||||
}
|
||||
break;
|
||||
case Token.SETCONSTVAR:
|
||||
{
|
||||
if (itsData.itsNeedsActivation) Kit.codeBug();
|
||||
int index = scriptOrFn.getIndexForNameNode(child);
|
||||
child = child.getNext();
|
||||
visitExpression(child, 0);
|
||||
addVarOp(Token.SETCONSTVAR, index);
|
||||
}
|
||||
break;
|
||||
|
||||
case Token.NULL:
|
||||
case Token.THIS:
|
||||
|
||||
@ -708,11 +708,11 @@ public class Codegen extends Interpreter
|
||||
cfw.startMethod("getParamOrVarName", "(I)Ljava/lang/String;",
|
||||
ClassFileWriter.ACC_PUBLIC);
|
||||
break;
|
||||
case Do_getParamOrVarConst:
|
||||
metodLocals = 1 + 1 + 1; // this + paramOrVarName
|
||||
cfw.startMethod("getParamOrVarConst", "(I)Z",
|
||||
ClassFileWriter.ACC_PUBLIC);
|
||||
break;
|
||||
case Do_getParamOrVarConst:
|
||||
metodLocals = 1 + 1 + 1; // this + paramOrVarName
|
||||
cfw.startMethod("getParamOrVarConst", "(I)Z",
|
||||
ClassFileWriter.ACC_PUBLIC);
|
||||
break;
|
||||
case Do_getEncodedSource:
|
||||
metodLocals = 1; // Only this
|
||||
cfw.startMethod("getEncodedSource", "()Ljava/lang/String;",
|
||||
@ -4242,7 +4242,7 @@ Else pass the JS object in the aReg and 0.0 in the dReg.
|
||||
if (isConst)
|
||||
locals[result + 1] = true;
|
||||
if (result == firstFreeLocal) {
|
||||
for (int i = firstFreeLocal + 2; i < MAX_LOCALS; i++) {
|
||||
for (int i = firstFreeLocal + 1; i < MAX_LOCALS; i++) {
|
||||
if (!locals[i]) {
|
||||
firstFreeLocal = (short) i;
|
||||
if (localsMax < firstFreeLocal)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user