Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: pkg/kernel/lib/class_hierarchy.dart

Issue 2869803002: Use Uint32List as the return type of _IntervalListBuilder.buildIntervalList(). (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.class_hierarchy; 4 library kernel.class_hierarchy;
5 5
6 import 'ast.dart'; 6 import 'ast.dart';
7 import 'dart:math'; 7 import 'dart:math';
8 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 import 'src/heap.dart'; 9 import 'src/heap.dart';
10 import 'type_algebra.dart'; 10 import 'type_algebra.dart';
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 void addSingleton(int x) { 816 void addSingleton(int x) {
817 addInterval(x, x + 1); 817 addInterval(x, x + 1);
818 } 818 }
819 819
820 void addIntervalList(Uint32List intervals) { 820 void addIntervalList(Uint32List intervals) {
821 for (int i = 0; i < intervals.length; i += 2) { 821 for (int i = 0; i < intervals.length; i += 2) {
822 addInterval(intervals[i], intervals[i + 1]); 822 addInterval(intervals[i], intervals[i + 1]);
823 } 823 }
824 } 824 }
825 825
826 List<int> buildIntervalList() { 826 Uint32List buildIntervalList() {
827 // Sort the event points and sweep left to right while tracking how many 827 // Sort the event points and sweep left to right while tracking how many
828 // intervals we are currently inside. Record an interval end point when the 828 // intervals we are currently inside. Record an interval end point when the
829 // number of intervals drop to zero or increase from zero to one. 829 // number of intervals drop to zero or increase from zero to one.
830 // Event points are encoded so that an opening end point occur before a 830 // Event points are encoded so that an opening end point occur before a
831 // closing end point at the same value. 831 // closing end point at the same value.
832 events.sort(); 832 events.sort();
833 int insideCount = 0; // The number of intervals we are currently inside. 833 int insideCount = 0; // The number of intervals we are currently inside.
834 int storeIndex = 0; 834 int storeIndex = 0;
835 for (int i = 0; i < events.length; ++i) { 835 for (int i = 0; i < events.length; ++i) {
836 int event = events[i]; 836 int event = events[i];
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 class _LubHeap extends Heap<_ClassInfo> { 1069 class _LubHeap extends Heap<_ClassInfo> {
1070 @override 1070 @override
1071 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); 1071 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b);
1072 1072
1073 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { 1073 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) {
1074 if (a.depth > b.depth) return true; 1074 if (a.depth > b.depth) return true;
1075 if (a.depth < b.depth) return false; 1075 if (a.depth < b.depth) return false;
1076 return a.topologicalIndex < b.topologicalIndex; 1076 return a.topologicalIndex < b.topologicalIndex;
1077 } 1077 }
1078 } 1078 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698