aboutsummaryrefslogtreecommitdiff
path: root/src/analyzer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-02 11:23:05 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-02 11:23:05 -0800
commit52acac245a7599b7b4eba793c2384adaab39a1ff (patch)
tree54bb50303bb0175ab7964d8e027043091bd6b86a /src/analyzer.js
parent8950ba2d235173749bc97da1f635e2a2d7a6bc32 (diff)
do not set label when leaving a multiple with one post-entry, and properly optimize the case of not setting label with new BRNOL branch signature
Diffstat (limited to 'src/analyzer.js')
-rw-r--r--src/analyzer.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 8c07951e..9783f447 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -1182,9 +1182,15 @@ function analyzer(data) {
actualEntryLabels.forEach(function(actualEntryLabel) {
if (dcheck('relooping')) dprint(' creating sub-block in multiple for ' + actualEntryLabel.ident + ' : ' + getLabelIds(actualEntryLabel.blockChildren) + ' ::: ' + actualEntryLabel.blockChildren.length);
+ var pattern = 'BREAK|' + blockId;
+ if (keys(postEntryLabels).length == 1) {
+ // We are breaking out of a multiple and have one entry after it, so we don't need to set __label__
+ pattern = 'BRNOL|' + blockId;
+ }
keys(postEntryLabels).forEach(function(post) {
- replaceLabelLabels(actualEntryLabel.blockChildren, set(post), 'BREAK|' + blockId);
+ replaceLabelLabels(actualEntryLabel.blockChildren, set(post), pattern);
});
+
// Create child block
actualEntryLabel.block = makeBlock(actualEntryLabel.blockChildren, [actualEntryLabel.blockChildren[0].ident], labelsDict);
});
@@ -1273,6 +1279,7 @@ function analyzer(data) {
replaceLabelLabels(block.labels, set('BJSET|*|' + block.willGetTo), 'BNOPP');
replaceLabelLabels(block.labels, set('BCONT|*|' + block.willGetTo), 'BNOPP');
replaceLabelLabels(block.labels, set('BREAK|*|' + block.willGetTo), 'BNOPP');
+ replaceLabelLabels(block.labels, set('BRNOL|*|' + block.willGetTo), 'BNOPP');
}
}