mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
Fix up bug where direct calls were getting the parent scope when they shouldn't have,
resulting in a NullPointerException on the following code when run on the MS VM with -opt 9: var testcases = getTestCases(); function getTestCases() { return new Boolean(new MyObject(true)); } function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); return this; }
This commit is contained in:
parent
5d1cd52439
commit
108f81d6ac
@ -1461,6 +1461,7 @@ public class Codegen extends Interpreter {
|
||||
/**
|
||||
* Generate the prologue for a function or script.
|
||||
*
|
||||
* @param cx the context
|
||||
* @param tree the tree to generate code for
|
||||
* @param inFunction true if generating the prologue for a function
|
||||
* (as opposed to a script)
|
||||
@ -1474,8 +1475,13 @@ public class Codegen extends Interpreter {
|
||||
contextLocal = reserveWordLocal(1);
|
||||
variableObjectLocal = reserveWordLocal(2);
|
||||
thisObjLocal = reserveWordLocal(3);
|
||||
|
||||
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope()) {
|
||||
|
||||
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope() &&
|
||||
directParameterCount == -1)
|
||||
{
|
||||
// Unless we're either using dynamic scope or we're in a
|
||||
// direct call, use the enclosing scope of the function as our
|
||||
// variable object.
|
||||
aload(funObjLocal);
|
||||
classFile.add(ByteCode.INVOKEINTERFACE,
|
||||
"org/mozilla/javascript/Scriptable",
|
||||
|
@ -1461,6 +1461,7 @@ public class Codegen extends Interpreter {
|
||||
/**
|
||||
* Generate the prologue for a function or script.
|
||||
*
|
||||
* @param cx the context
|
||||
* @param tree the tree to generate code for
|
||||
* @param inFunction true if generating the prologue for a function
|
||||
* (as opposed to a script)
|
||||
@ -1474,8 +1475,13 @@ public class Codegen extends Interpreter {
|
||||
contextLocal = reserveWordLocal(1);
|
||||
variableObjectLocal = reserveWordLocal(2);
|
||||
thisObjLocal = reserveWordLocal(3);
|
||||
|
||||
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope()) {
|
||||
|
||||
if (inFunction && !cx.hasCompileFunctionsWithDynamicScope() &&
|
||||
directParameterCount == -1)
|
||||
{
|
||||
// Unless we're either using dynamic scope or we're in a
|
||||
// direct call, use the enclosing scope of the function as our
|
||||
// variable object.
|
||||
aload(funObjLocal);
|
||||
classFile.add(ByteCode.INVOKEINTERFACE,
|
||||
"org/mozilla/javascript/Scriptable",
|
||||
|
Loading…
Reference in New Issue
Block a user