OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. | 1 // Copyright (c) 2011, the Dart project authors. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 | 3 |
4 /** | 4 /** |
5 * Class CFG | 5 * Class CFG |
6 * | 6 * |
7 * A simple class simulating the concept of | 7 * A simple class simulating the concept of |
8 * a control flow graph. | 8 * a control flow graph. |
9 * | 9 * |
10 * CFG maintains a list of nodes, plus a start node. | 10 * CFG maintains a list of nodes, plus a start node. |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 return; | 460 return; |
461 } | 461 } |
462 nonBackPreds[x.getDfsNumber()].forEach(function f(int iter) { | 462 nonBackPreds[x.getDfsNumber()].forEach(function f(int iter) { |
463 UnionFindNode y = nodes[iter]; | 463 UnionFindNode y = nodes[iter]; |
464 UnionFindNode ydash = y.findSet(); | 464 UnionFindNode ydash = y.findSet(); |
465 if (!isAncestor(w. ydash.getDfsNumber(), last)) { | 465 if (!isAncestor(w. ydash.getDfsNumber(), last)) { |
466 type[w] = BB.IRREDUCIBLE; | 466 type[w] = BB.IRREDUCIBLE; |
467 nonBackPreds[w].add(ydash.getDfsnumber()); | 467 nonBackPreds[w].add(ydash.getDfsnumber()); |
468 } else { | 468 } else { |
469 if (ydash.getDfsNumber() != w) { | 469 if (ydash.getDfsNumber() != w) { |
470 if (!nodePool.some(function f(UnionFindNode x) {return x == ydas
h;})) { | 470 if (!nodePool.any(function f(UnionFindNode x) {return x == ydash
;})) { |
471 workList.addLast(ydash); | 471 workList.addLast(ydash); |
472 nodePool.addLast(ydash); | 472 nodePool.addLast(ydash); |
473 } | 473 } |
474 } | 474 } |
475 } | 475 } |
476 }); | 476 }); |
477 } | 477 } |
478 // Collapse/Unionize nodes in a SCC to a single node | 478 // Collapse/Unionize nodes in a SCC to a single node |
479 // For every SCC found, create a loop descriptor and link it in. | 479 // For every SCC found, create a loop descriptor and link it in. |
480 if ((nodePool.length > 0) || (type[w] == BB.SELF)) { | 480 if ((nodePool.length > 0) || (type[w] == BB.SELF)) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 class Out { | 809 class Out { |
810 | 810 |
811 static void write(String str) { | 811 static void write(String str) { |
812 Havlak.window.document.write(str); | 812 Havlak.window.document.write(str); |
813 } | 813 } |
814 | 814 |
815 static void writeln(String str) { | 815 static void writeln(String str) { |
816 Havlak.window.document.writeln(str); | 816 Havlak.window.document.writeln(str); |
817 } | 817 } |
818 } | 818 } |
OLD | NEW |