Skip to content

Commit 8c4b663

Browse files
authored
Fixed a bug with interpreter peeling introduced in #1510 (#1578)
Lack of support for all the varieties of lambda function in Rhino in the new "interpreter peeling" code introduced to make continuations work better was holding back additional conversions to lambda functions.
1 parent 7e4fa18 commit 8c4b663

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rhino/src/main/java/org/mozilla/javascript/Interpreter.java

+2
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,8 @@ private static Object interpretLoop(Context cx, CallFrame frame, Object throwabl
17841784
ArrowFunction afun = (ArrowFunction) fun;
17851785
fun = afun.getTargetFunction();
17861786
funThisObj = afun.getCallThis(cx);
1787+
} else if (fun instanceof LambdaConstructor) {
1788+
break;
17871789
} else if (fun instanceof LambdaFunction) {
17881790
fun = ((LambdaFunction) fun).getTarget();
17891791
} else if (fun instanceof BoundFunction) {

tests/src/test/java/org/mozilla/javascript/tests/LambdaFunctionTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public void cleanup() {
3737
}
3838

3939
private void eval(String source) {
40-
cx.evaluateString(root, source, "test.js", 1, null);
40+
Utils.runWithAllOptimizationLevels(
41+
ignored -> cx.evaluateString(root, source, "test.js", 1, null));
4142
}
4243

4344
@Test

0 commit comments

Comments
 (0)