summaryrefslogtreecommitdiff
path: root/src/intertyper.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-04 13:07:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-04 13:07:37 -0800
commit4385bdddb0594c6a5a05b74c540dc194d7b3a562 (patch)
tree4283ff5768eea8164648d8e0ffc20f299597a2a2 /src/intertyper.js
parent0dd6e0f630529d6a56439e19ae1738c82a117393 (diff)
batch function lines to speed up processing of many tiny functions
Diffstat (limited to 'src/intertyper.js')
-rw-r--r--src/intertyper.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 03fbf072..417f6588 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -23,9 +23,9 @@ var NSW_NUW = set('nsw', 'nuw');
// Intertyper
-function intertyper(data, sidePass, baseLineNum) {
+function intertyper(data, sidePass, baseLineNums) {
var mainPass = !sidePass;
- baseLineNum = baseLineNum || 0;
+ baseLineNums = baseLineNums || [[0,0]]; // each pair [#0,#1] means "starting from line #0, the base line num is #1"
dprint('framework', 'Big picture: Starting intertyper, main pass=' + mainPass);
@@ -67,10 +67,15 @@ function intertyper(data, sidePass, baseLineNum) {
};
unparsedBundles.push(unparsedGlobals);
}
+ var baseLineNumPosition = 0;
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
lines[i] = null; // lines may be very very large. Allow GCing to occur in the loop by releasing refs here
+ while (baseLineNumPosition < baseLineNums.length-1 && i >= baseLineNums[baseLineNumPosition+1][0]) {
+ baseLineNumPosition++;
+ }
+
if (mainPass && (line[0] == '%' || line[0] == '@')) {
// If this isn't a type, it's a global variable, make a note of the information now, we will need it later
var testType = /[@%\w\d\.\" ]+ = type .*/.exec(line);
@@ -104,7 +109,7 @@ function intertyper(data, sidePass, baseLineNum) {
} else {
ret.push({
lineText: line,
- lineNum: i + 1 + baseLineNum
+ lineNum: i + 1 + baseLineNums[baseLineNumPosition][1]
});
if (/^\ +switch\ .*/.test(line)) {
// beginning of llvm switch