Skip to content

Commit

Permalink
Put back INDY operations for yield points.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrail committed Oct 2, 2024
1 parent b366b14 commit 5c85ebc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1664,14 +1664,11 @@ private void generateYieldPoint(Node node, boolean exprContext) {
if (unnestedYields.containsKey(node)) {
// Yield was previously moved up via the "nestedYield" code below.
if (exprContext) {
String name = unnestedYields.get(node);
cfw.addALoad(variableObjectLocal);
cfw.addLoadConstant(unnestedYields.get(node));
cfw.addALoad(contextLocal);
cfw.addALoad(variableObjectLocal);
addScriptRuntimeInvoke(
"getObjectPropNoWarn",
"(Ljava/lang/Object;Ljava/lang/String;Lorg/mozilla/javascript/Context;"
+ "Lorg/mozilla/javascript/Scriptable;)Ljava/lang/Object;");
addDynamicInvoke("PROP:GETNOWARN:" + name, Signatures.PROP_GET_NOWARN);
}
return;
}
Expand All @@ -1689,14 +1686,9 @@ private void generateYieldPoint(Node node, boolean exprContext) {
unnestedYieldCount++;
cfw.addALoad(variableObjectLocal);
cfw.add(ByteCode.SWAP);
cfw.addLoadConstant(nn);
cfw.add(ByteCode.SWAP);
cfw.addALoad(contextLocal);

addScriptRuntimeInvoke(
"setObjectProp",
"(Lorg/mozilla/javascript/Scriptable;Ljava/lang/String;Ljava/lang/Object;"
+ "Lorg/mozilla/javascript/Context;)Ljava/lang/Object;");
cfw.addALoad(variableObjectLocal);
addDynamicInvoke("PROP:SET:" + nn, Signatures.PROP_SET);
cfw.add(ByteCode.POP);

unnestedYields.put(nestedYield, nn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
/**
* This class defines the method signatures for the properties used by the invokedynamic
* instructions in the bytecode. This helps us identify what each bytecode operation means, and what
* the method signature should be.
* the method signature should be. The method signatures here don't necessarily map 1:1 with
* ScriptRuntime operations -- the runtime will insert the value of the "name" part of the operation
* name before making the call.
*/
interface Signatures {
/**
Expand Down

0 comments on commit 5c85ebc

Please sign in to comment.