Skip to content

Commit

Permalink
Fixed a bug with interpreter peeling introduced in #1510 (#1578)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andreabergia authored Aug 23, 2024
1 parent 7e4fa18 commit 8c4b663
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rhino/src/main/java/org/mozilla/javascript/Interpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,8 @@ private static Object interpretLoop(Context cx, CallFrame frame, Object throwabl
ArrowFunction afun = (ArrowFunction) fun;
fun = afun.getTargetFunction();
funThisObj = afun.getCallThis(cx);
} else if (fun instanceof LambdaConstructor) {
break;
} else if (fun instanceof LambdaFunction) {
fun = ((LambdaFunction) fun).getTarget();
} else if (fun instanceof BoundFunction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void cleanup() {
}

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

@Test
Expand Down

0 comments on commit 8c4b663

Please sign in to comment.