Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=173906: change Codegen.visitCall to check for dynamic scope flag when calling

direct call target
This commit is contained in:
igor%mir2.org 2002-10-24 10:05:36 +00:00
Родитель ba3a798e63
Коммит 3b79862ea3
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -374,6 +374,8 @@ public class Codegen extends Interpreter {
this.namesVector = names; this.namesVector = names;
this.classFilesVector = classFiles; this.classFilesVector = classFiles;
Context cx = Context.getCurrentContext(); Context cx = Context.getCurrentContext();
itsUseDynamicScope = cx.hasCompileFunctionsWithDynamicScope();
itsSourceFile = null; itsSourceFile = null;
// default is to generate debug info // default is to generate debug info
if (!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug()) if (!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug())
@ -1372,7 +1374,7 @@ public class Codegen extends Interpreter {
variableObjectLocal = reserveWordLocal(2); variableObjectLocal = reserveWordLocal(2);
thisObjLocal = reserveWordLocal(3); thisObjLocal = reserveWordLocal(3);
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope() && if (inFunction && !itsUseDynamicScope &&
directParameterCount == -1) directParameterCount == -1)
{ {
// Unless we're either using dynamic scope or we're in a // Unless we're either using dynamic scope or we're in a
@ -1759,11 +1761,15 @@ public class Codegen extends Interpreter {
addByteCode(ByteCode.SWAP); addByteCode(ByteCode.SWAP);
addByteCode(ByteCode.POP); addByteCode(ByteCode.POP);
addByteCode(ByteCode.DUP); if (!itsUseDynamicScope) {
classFile.add(ByteCode.INVOKEINTERFACE, addByteCode(ByteCode.DUP);
classFile.add(ByteCode.INVOKEINTERFACE,
"org/mozilla/javascript/Scriptable", "org/mozilla/javascript/Scriptable",
"getParentScope", "getParentScope",
"()", "Lorg/mozilla/javascript/Scriptable;"); "()", "Lorg/mozilla/javascript/Scriptable;");
} else {
aload(variableObjectLocal);
}
aload(contextLocal); aload(contextLocal);
addByteCode(ByteCode.SWAP); addByteCode(ByteCode.SWAP);
@ -3802,6 +3808,7 @@ public class Codegen extends Interpreter {
private short itsZeroArgArray; private short itsZeroArgArray;
private short itsOneArgArray; private short itsOneArgArray;
private boolean itsUseDynamicScope;
private boolean hasVarsInRegs; private boolean hasVarsInRegs;
private boolean itsForcedObjectParameters; private boolean itsForcedObjectParameters;
private boolean trivialInit; private boolean trivialInit;