aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-14 12:03:05 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-14 12:03:05 -0800
commitf1651fc6dc0864418039f35bfa4de577f37c2c83 (patch)
treee9ae0454e15de6f1c3580f1cfbccb43452edfdbe
parent39abd6568309834686abc7bcd7769d18849ba4a7 (diff)
simplify relooper code following optimizations
-rw-r--r--src/analyzer.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index a5b7169c..746037a9 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -946,25 +946,24 @@ function analyzer(data, sidePass) {
label.allOutLabels = [];
});
+ // First, find allInLabels
var worked = true;
while (worked) {
worked = false;
labels.forEach(function(label) {
- function inout(s, l) {
- var temp = label[s];
- label[s].forEach(function(label2Id) {
- temp = temp.concat(labelsDict[label2Id][l]);
- });
- temp = dedup(temp);
- if (temp.length > label[l].length) {
- label[l] = temp;
- worked = true;
- }
+ var temp = label.inLabels;
+ label.inLabels.forEach(function(label2Id) {
+ temp = temp.concat(labelsDict[label2Id].allInLabels);
+ });
+ temp = dedup(temp);
+ if (temp.length > label.allInLabels.length) {
+ label.allInLabels = temp;
+ worked = true;
}
- inout('inLabels', 'allInLabels');
});
}
+ // Infer allOutLabels from allInLabels, they are mirror images
labels.forEach(function(label) {
label.allInLabels.forEach(function(inLabelId) {
labelsDict[inLabelId].allOutLabels.push(label.ident);