| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library object_graph; | 5 library object_graph; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
| 10 | 10 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 } | 647 } |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 if (newDomIndex != 0 && domByPOI[curPostOrderIndex] != newDomIndex) { | 650 if (newDomIndex != 0 && domByPOI[curPostOrderIndex] != newDomIndex) { |
| 651 domByPOI[curPostOrderIndex] = newDomIndex; | 651 domByPOI[curPostOrderIndex] = newDomIndex; |
| 652 changed = true; | 652 changed = true; |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 | 656 |
| 657 Logger.root.info("Start remap dominators"); |
| 658 |
| 657 // Reindex doms by id instead of post order index so we can throw away | 659 // Reindex doms by id instead of post order index so we can throw away |
| 658 // the post order arrays. | 660 // the post order arrays. |
| 659 var domById = new Uint32List(N + 1); | 661 var domById = new Uint32List(N + 1); |
| 660 for (var id = 1; id <= N; id++) { | 662 for (var id = 1; id <= N; id++) { |
| 661 domById[id] = postOrder[domByPOI[postOrderIndex[id]]]; | 663 domById[id] = postOrder[domByPOI[postOrderIndex[id]]]; |
| 662 } | 664 } |
| 663 | 665 |
| 666 Logger.root.info("End remap dominators"); |
| 667 |
| 664 domById[root] = 0; | 668 domById[root] = 0; |
| 665 | 669 |
| 666 _doms = domById; | 670 _doms = domById; |
| 667 } | 671 } |
| 668 | 672 |
| 669 void _calculateRetainedSizes() { | 673 void _calculateRetainedSizes() { |
| 670 var N = _N; | 674 var N = _N; |
| 671 | 675 |
| 672 var size = 0; | 676 var size = 0; |
| 673 var positions = _positions; | 677 var positions = _positions; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 691 for (var o = 0; o < (N - 1); o++) { | 695 for (var o = 0; o < (N - 1); o++) { |
| 692 var i = postOrderOrdinals[o]; | 696 var i = postOrderOrdinals[o]; |
| 693 assert(i != 1); | 697 assert(i != 1); |
| 694 retainedSizes[doms[i]] += retainedSizes[i]; | 698 retainedSizes[doms[i]] += retainedSizes[i]; |
| 695 } | 699 } |
| 696 | 700 |
| 697 _retainedSizes = retainedSizes; | 701 _retainedSizes = retainedSizes; |
| 698 _size = size; | 702 _size = size; |
| 699 } | 703 } |
| 700 } | 704 } |
| OLD | NEW |