mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Codegen.visitRegularCall should not try to apply the simple call optimization when firstArgDone is true indicating directly called function. The patch also replaces generation of code to call new Object[0] by loading the ScripRuntime.emptyArgs field.
This commit is contained in:
parent
55fc9c878b
commit
16f9ecfd66
@ -1853,8 +1853,9 @@ public class Codegen extends Interpreter {
|
||||
if (itsZeroArgArray >= 0)
|
||||
aload(itsZeroArgArray);
|
||||
else {
|
||||
push(0);
|
||||
addByteCode(ByteCode.ANEWARRAY, "java/lang/Object");
|
||||
classFile.add(ByteCode.GETSTATIC,
|
||||
"org/mozilla/javascript/ScriptRuntime",
|
||||
"emptyArgs", "[Ljava/lang/Object;");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1918,7 +1919,7 @@ public class Codegen extends Interpreter {
|
||||
boolean isSpecialCall = node.getProp(Node.SPECIALCALL_PROP) != null;
|
||||
boolean isSimpleCall = false;
|
||||
String simpleCallName = null;
|
||||
if (type != TokenStream.NEW) {
|
||||
if (!firstArgDone && type != TokenStream.NEW) {
|
||||
simpleCallName = getSimpleCallName(node);
|
||||
if (simpleCallName != null && !isSpecialCall) {
|
||||
isSimpleCall = true;
|
||||
@ -1926,8 +1927,7 @@ public class Codegen extends Interpreter {
|
||||
aload(variableObjectLocal);
|
||||
child = child.getNext().getNext();
|
||||
argIndex = 0;
|
||||
push(childCount - argSkipCount);
|
||||
addByteCode(ByteCode.ANEWARRAY, "java/lang/Object");
|
||||
constructArgArray(childCount - argSkipCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1974,10 +1974,6 @@ public class Codegen extends Interpreter {
|
||||
}
|
||||
argIndex++;
|
||||
if (argIndex == 0) {
|
||||
// now we need to construct the array
|
||||
// (even if there are no args to load
|
||||
// into it) - REMIND could pass null
|
||||
// instead ?
|
||||
constructArgArray(childCount - argSkipCount);
|
||||
}
|
||||
child = child.getNext();
|
||||
|
Loading…
Reference in New Issue
Block a user