src/jdk/nashorn/internal/codegen/CodeGenerator.java
Print this page
rev 747 : 8031983: Error objects should capture stack at the constructor
Reviewed-by: jlaskey, hannesw
rev 758 : 8021350: Share script classes between threads/globals within context
Reviewed-by: lagergren, sundar
@@ -683,11 +683,11 @@
}
private void scopeCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
// ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
- method.loadNull(); //the 'this'
+ method.loadUndefined(Type.OBJECT); //the 'this' object
method.dynamicCall(callNodeType, 2 + loadArgs(args), flags);
}
private void evalCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
@@ -816,11 +816,11 @@
@Override
protected boolean enterDefault(final Node node) {
// Load up function.
load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
- method.loadNull(); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
+ method.loadUndefined(Type.OBJECT); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
return false;
}
});
@@ -2021,12 +2021,10 @@
load(throwNode.getExpression());
method.athrow();
return false;
}
- method._new(ECMAException.class).dup();
-
final Source source = lc.getCurrentFunction().getSource();
final Expression expression = throwNode.getExpression();
final int position = throwNode.position();
final int line = throwNode.getLineNumber();
@@ -2035,11 +2033,11 @@
load(expression, Type.OBJECT);
method.load(source.getName());
method.load(line);
method.load(column);
- method.invoke(ECMAException.THROW_INIT);
+ method.invoke(ECMAException.CREATE);
method.athrow();
return false;
}