summaryrefslogtreecommitdiff
path: root/test/binaryen.js/expressionrunner.js
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-03-29 13:01:12 -0700
committerGitHub <noreply@github.com>2024-03-29 13:01:12 -0700
commitb10d59d1d201506eba1aaba035e699fec849ea60 (patch)
treec4a57f8881bffc06a7d2cf74fc88c2d90f61224b /test/binaryen.js/expressionrunner.js
parent88eabaaddeeff6fb8295a2e35c8e29927df04724 (diff)
downloadbinaryen-b10d59d1d201506eba1aaba035e699fec849ea60.tar.gz
binaryen-b10d59d1d201506eba1aaba035e699fec849ea60.tar.bz2
binaryen-b10d59d1d201506eba1aaba035e699fec849ea60.zip
Remove the TRAVERSE_CALLS option in the ConstantExpressionRunner (#6449)
The implementation of calls with this option was incorrect because it cleared the locals before evaluating the call arguments. The likely explanation for why this was never noticed is that there are no users of this option, especially since it is exposed in the C and JS APIs but not used internally. Rather than try to fix the implementation, just remove the option.
Diffstat (limited to 'test/binaryen.js/expressionrunner.js')
-rw-r--r--test/binaryen.js/expressionrunner.js35
1 files changed, 1 insertions, 34 deletions
diff --git a/test/binaryen.js/expressionrunner.js b/test/binaryen.js/expressionrunner.js
index 7071f950d..9535b3eec 100644
--- a/test/binaryen.js/expressionrunner.js
+++ b/test/binaryen.js/expressionrunner.js
@@ -1,7 +1,6 @@
var Flags = binaryen.ExpressionRunner.Flags;
console.log("// ExpressionRunner.Flags.Default = " + Flags.Default);
console.log("// ExpressionRunner.Flags.PreserveSideeffects = " + Flags.PreserveSideeffects);
-console.log("// ExpressionRunner.Flags.TraverseCalls = " + Flags.TraverseCalls);
function assertDeepEqual(x, y) {
if (typeof x === "object") {
@@ -139,39 +138,7 @@ assertDeepEqual(
}
);
-// Should traverse into (simple) functions if requested
-runner = new binaryen.ExpressionRunner(module, Flags.TraverseCalls);
-module.addFunction("add", binaryen.createType([ binaryen.i32, binaryen.i32 ]), binaryen.i32, [],
- module.block(null, [
- module.i32.add(
- module.local.get(0, binaryen.i32),
- module.local.get(1, binaryen.i32)
- )
- ], binaryen.i32)
-);
-assert(runner.setLocalValue(0, module.i32.const(1)));
-expr = runner.runAndDispose(
- module.i32.add(
- module.i32.add(
- module.local.get(0, binaryen.i32),
- module.call("add", [
- module.i32.const(2),
- module.i32.const(4)
- ], binaryen.i32)
- ),
- module.local.get(0, binaryen.i32)
- )
-);
-assertDeepEqual(
- binaryen.getExpressionInfo(expr),
- {
- id: binaryen.ExpressionIds.Const,
- type: binaryen.i32,
- value: 8
- }
-);
-
-// Should not attempt to traverse into functions if not explicitly set
+// Should not attempt to traverse into functions
runner = new binaryen.ExpressionRunner(module);
expr = runner.runAndDispose(
module.i32.add(