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,693 ****
}
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.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
--- 683,693 ----
}
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.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,826 ****
@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.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
return false;
}
});
--- 816,826 ----
@Override
protected boolean enterDefault(final Node node) {
// Load up function.
load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
! 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,2032 ****
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();
--- 2021,2030 ----
*** 2035,2045 ****
load(expression, Type.OBJECT);
method.load(source.getName());
method.load(line);
method.load(column);
! method.invoke(ECMAException.THROW_INIT);
method.athrow();
return false;
}
--- 2033,2043 ----
load(expression, Type.OBJECT);
method.load(source.getName());
method.load(line);
method.load(column);
! method.invoke(ECMAException.CREATE);
method.athrow();
return false;
}