Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cli/asc.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ exports.main = function main(argv, options, callback) {
transforms = transforms.map(classOrModule => {
// Except if it’s a legacy module, just pass it through.
if (typeof classOrModule !== "function") {
return classOrModule;
return classOrModule;
}
Object.assign(classOrModule.prototype, {
program,
Expand Down Expand Up @@ -881,12 +881,20 @@ exports.main = function main(argv, options, callback) {
if (opts.trapMode === "clamp") {
stats.optimizeCount++;
stats.optimizeTime += measure(() => {
module.runPass("trap-mode-clamp");
try {
module.runPasses(["trap-mode-clamp"]);
} catch (e) {
crash("runPasses", e);
}
});
} else if (opts.trapMode === "js") {
stats.optimizeCount++;
stats.optimizeTime += measure(() => {
module.runPass("trap-mode-js");
try {
module.runPasses(["trap-mode-js"]);
} catch (e) {
crash("runPasses", e);
}
});
} else if (opts.trapMode !== "allow") {
module.dispose();
Expand Down
10 changes: 0 additions & 10 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2191,16 +2191,6 @@ export class Module {
binaryen._BinaryenModuleSetFeatures(this.ref, featureFlags);
}

runPass(pass: string, func: FunctionRef = 0): void {
var cStr = allocString(pass);
if (func) {
binaryen._BinaryenFunctionRunPasses(func, this.ref, cStr, 1);
} else {
binaryen._BinaryenModuleRunPasses(this.ref, cStr, 1);
}
binaryen._free(cStr);
}

runPasses(passes: string[], func: FunctionRef = 0): void {
var numNames = passes.length;
var cStrs = new Array<StringRef>(numNames);
Expand Down