aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/analyzer.js2
-rw-r--r--src/compiler.js3
-rw-r--r--src/intertyper.js2
-rw-r--r--src/jsifier.js16
-rw-r--r--src/utility.js6
5 files changed, 25 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 2f6581b4..2b74a83f 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -25,6 +25,7 @@ var SHADOW_FLIP = { i64: 'double', double: 'i64' }; //, i32: 'float', float: 'i3
// Analyzer
function analyzer(data, sidePass) {
+ //B.start('analyzer');
var mainPass = !sidePass;
var item = { items: data };
@@ -1761,6 +1762,7 @@ function analyzer(data, sidePass) {
stackAnalyzer();
relooper();
+ //B.stop('analyzer');
return item;
}
diff --git a/src/compiler.js b/src/compiler.js
index ac1b0ec8..e9197a5d 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -285,6 +285,7 @@ function compile(raw) {
//dumpInterProf();
//printErr(phase + ' paths (fast, slow): ' + [fastPaths, slowPaths]);
+ B.print(phase);
phase = null;
@@ -308,6 +309,8 @@ function compile(raw) {
}
}
+B = new Benchmarker();
+
if (ll_file) {
if (ll_file.indexOf(String.fromCharCode(10)) == -1) {
compile(read(ll_file));
diff --git a/src/intertyper.js b/src/intertyper.js
index 1272f569..4c35db34 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -153,6 +153,7 @@ var NSW_NUW = set('nsw', 'nuw');
// Intertyper
function intertyper(lines, sidePass, baseLineNums) {
+ //B.start('intertyper');
var mainPass = !sidePass;
baseLineNums = baseLineNums || [[0,0]]; // each pair [#0,#1] means "starting from line #0, the base line num is #1"
@@ -1184,6 +1185,7 @@ function intertyper(lines, sidePass, baseLineNums) {
finalResults.push(item);
if (item.tokens) item.tokens = null; // We do not need tokens, past the intertyper. Clean them up as soon as possible here.
});
+ //B.stop('intertyper');
return finalResults;
}
diff --git a/src/jsifier.js b/src/jsifier.js
index 6da2b09f..b36e11ed 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -20,6 +20,7 @@ var functionStubSigs = {};
// JSifier
function JSify(data, functionsOnly, givenFunctions) {
+ //B.start('jsifier');
var mainPass = !functionsOnly;
var itemsDict = { type: [], GlobalVariableStub: [], functionStub: [], function: [], GlobalVariable: [], GlobalVariablePostSet: [] };
@@ -67,7 +68,9 @@ function JSify(data, functionsOnly, givenFunctions) {
// Add additional necessary items for the main pass. We can now do this since types are parsed (types can be used through
// generateStructInfo in library.js)
+ //B.start('jsifier-libload');
LibraryManager.load();
+ //B.stop('jsifier-libload');
if (phase == 'pre') {
var libFuncsToInclude;
@@ -504,6 +507,7 @@ function JSify(data, functionsOnly, givenFunctions) {
// function splitter
function functionSplitter(item) {
item.lines.forEach(function(line) {
+ //B.start('jsifier-handle-' + line.intertype);
Framework.currItem = line;
line.funcData = item; // TODO: remove all these, access it globally
switch (line.intertype) {
@@ -538,8 +542,11 @@ function JSify(data, functionsOnly, givenFunctions) {
//if (ASM_JS) assert(line.JS.indexOf('var ') < 0, dump(line));
if (line.assignTo) makeAssign(line);
Framework.currItem = null;
+ //B.stop('jsifier-handle-' + line.intertype);
});
+ //B.start('jsifier-frec');
functionReconstructor(item);
+ //B.stop('jsifier-frec');
}
// function for filtering functions for label debugging
@@ -763,6 +770,7 @@ function JSify(data, functionsOnly, givenFunctions) {
ret += '\n';
} else {
// Reloop multiple blocks using the compiled relooper
+ //B.start('jsifier-reloop');
//Relooper.setDebug(1);
Relooper.init();
@@ -812,6 +820,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
ret += Relooper.render(blockMap[block.entries[0]]);
Relooper.cleanup();
+ //B.stop('jsifier-reloop');
}
return ret;
}
@@ -1910,8 +1919,6 @@ function JSify(data, functionsOnly, givenFunctions) {
}
PassManager.serialize();
-
- return null;
}
// Data
@@ -1941,13 +1948,18 @@ function JSify(data, functionsOnly, givenFunctions) {
}
}
+ //B.start('jsifier-handle-gv');
sortGlobals(data.globalVariables).forEach(globalVariableHandler);
+ //B.stop('jsifier-handle-gv');
data.aliass.forEach(aliasHandler);
data.functions.forEach(functionSplitter);
}
+ //B.start('jsifier-fc');
finalCombiner();
+ //B.stop('jsifier-fc');
dprint('framework', 'Big picture: Finishing JSifier, main pass=' + mainPass);
+ //B.stop('jsifier');
}
diff --git a/src/utility.js b/src/utility.js
index 9644b0e9..ac821a89 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -395,8 +395,10 @@ function Benchmarker() {
};
this.print = function(text) {
var ids = keys(totals);
- ids.sort(function(a, b) { return totals[b] - totals[a] });
- printErr(text + ' times: \n' + ids.map(function(id) { return id + ' : ' + totals[id] + ' ms' }).join('\n'));
+ if (ids.length > 0) {
+ ids.sort(function(a, b) { return totals[b] - totals[a] });
+ printErr(text + ' times: \n' + ids.map(function(id) { return id + ' : ' + totals[id] + ' ms' }).join('\n'));
+ }
};
};