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)
|
if (itsZeroArgArray >= 0)
|
||||||
aload(itsZeroArgArray);
|
aload(itsZeroArgArray);
|
||||||
else {
|
else {
|
||||||
push(0);
|
classFile.add(ByteCode.GETSTATIC,
|
||||||
addByteCode(ByteCode.ANEWARRAY, "java/lang/Object");
|
"org/mozilla/javascript/ScriptRuntime",
|
||||||
|
"emptyArgs", "[Ljava/lang/Object;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1918,7 +1919,7 @@ public class Codegen extends Interpreter {
|
|||||||
boolean isSpecialCall = node.getProp(Node.SPECIALCALL_PROP) != null;
|
boolean isSpecialCall = node.getProp(Node.SPECIALCALL_PROP) != null;
|
||||||
boolean isSimpleCall = false;
|
boolean isSimpleCall = false;
|
||||||
String simpleCallName = null;
|
String simpleCallName = null;
|
||||||
if (type != TokenStream.NEW) {
|
if (!firstArgDone && type != TokenStream.NEW) {
|
||||||
simpleCallName = getSimpleCallName(node);
|
simpleCallName = getSimpleCallName(node);
|
||||||
if (simpleCallName != null && !isSpecialCall) {
|
if (simpleCallName != null && !isSpecialCall) {
|
||||||
isSimpleCall = true;
|
isSimpleCall = true;
|
||||||
@ -1926,8 +1927,7 @@ public class Codegen extends Interpreter {
|
|||||||
aload(variableObjectLocal);
|
aload(variableObjectLocal);
|
||||||
child = child.getNext().getNext();
|
child = child.getNext().getNext();
|
||||||
argIndex = 0;
|
argIndex = 0;
|
||||||
push(childCount - argSkipCount);
|
constructArgArray(childCount - argSkipCount);
|
||||||
addByteCode(ByteCode.ANEWARRAY, "java/lang/Object");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1974,10 +1974,6 @@ public class Codegen extends Interpreter {
|
|||||||
}
|
}
|
||||||
argIndex++;
|
argIndex++;
|
||||||
if (argIndex == 0) {
|
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);
|
constructArgArray(childCount - argSkipCount);
|
||||||
}
|
}
|
||||||
child = child.getNext();
|
child = child.getNext();
|
||||||
|
Loading…
Reference in New Issue
Block a user