зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
ba3a798e63
Коммит
3b79862ea3
|
@ -374,6 +374,8 @@ public class Codegen extends Interpreter {
|
|||
this.namesVector = names;
|
||||
this.classFilesVector = classFiles;
|
||||
Context cx = Context.getCurrentContext();
|
||||
itsUseDynamicScope = cx.hasCompileFunctionsWithDynamicScope();
|
||||
|
||||
itsSourceFile = null;
|
||||
// default is to generate debug info
|
||||
if (!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug())
|
||||
|
@ -1372,7 +1374,7 @@ public class Codegen extends Interpreter {
|
|||
variableObjectLocal = reserveWordLocal(2);
|
||||
thisObjLocal = reserveWordLocal(3);
|
||||
|
||||
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope() &&
|
||||
if (inFunction && !itsUseDynamicScope &&
|
||||
directParameterCount == -1)
|
||||
{
|
||||
// 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.POP);
|
||||
|
||||
addByteCode(ByteCode.DUP);
|
||||
classFile.add(ByteCode.INVOKEINTERFACE,
|
||||
if (!itsUseDynamicScope) {
|
||||
addByteCode(ByteCode.DUP);
|
||||
classFile.add(ByteCode.INVOKEINTERFACE,
|
||||
"org/mozilla/javascript/Scriptable",
|
||||
"getParentScope",
|
||||
"()", "Lorg/mozilla/javascript/Scriptable;");
|
||||
} else {
|
||||
aload(variableObjectLocal);
|
||||
}
|
||||
aload(contextLocal);
|
||||
addByteCode(ByteCode.SWAP);
|
||||
|
||||
|
@ -3802,6 +3808,7 @@ public class Codegen extends Interpreter {
|
|||
private short itsZeroArgArray;
|
||||
private short itsOneArgArray;
|
||||
|
||||
private boolean itsUseDynamicScope;
|
||||
private boolean hasVarsInRegs;
|
||||
private boolean itsForcedObjectParameters;
|
||||
private boolean trivialInit;
|
||||
|
|
Загрузка…
Ссылка в новой задаче