summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 44dc7174b..7bd88fadc 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -485,6 +485,13 @@ function initializeConstants() {
].forEach(function(name) {
Module['SideEffects'][name] = Module['_BinaryenSideEffect' + name]();
});
+
+ // ExpressionRunner flags
+ Module['ExpressionRunner']['Flags'] = {
+ 'Default': Module['_ExpressionRunnerFlagsDefault'](),
+ 'PreserveSideeffects': Module['_ExpressionRunnerFlagsPreserveSideeffects'](),
+ 'TraverseCalls': Module['_ExpressionRunnerFlagsTraverseCalls']()
+ };
}
// 'Module' interface
@@ -2427,6 +2434,24 @@ Module['Relooper'] = function(module) {
};
};
+// 'ExpressionRunner' interface
+Module['ExpressionRunner'] = function(module, flags, maxDepth, maxLoopIterations) {
+ var runner = Module['_ExpressionRunnerCreate'](module['ptr'], flags, maxDepth, maxLoopIterations);
+ this['ptr'] = runner;
+
+ this['setLocalValue'] = function(index, valueExpr) {
+ return Boolean(Module['_ExpressionRunnerSetLocalValue'](runner, index, valueExpr));
+ };
+ this['setGlobalValue'] = function(name, valueExpr) {
+ return preserveStack(function() {
+ return Boolean(Module['_ExpressionRunnerSetGlobalValue'](runner, strToStack(name), valueExpr));
+ });
+ };
+ this['runAndDispose'] = function(expr) {
+ return Module['_ExpressionRunnerRunAndDispose'](runner, expr);
+ };
+};
+
function getAllNested(ref, numFn, getFn) {
var num = numFn(ref);
var ret = new Array(num);