| 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 part of service; | 5 part of service; |
| 6 | 6 |
| 7 /// Abstract [ServiceObjectCache]. | 7 /// Abstract [ServiceObjectCache]. |
| 8 abstract class ServiceObjectCache<T extends ServiceObject> { | 8 abstract class ServiceObjectCache<T extends ServiceObject> { |
| 9 final Isolate isolate; | 9 final Isolate isolate; |
| 10 final _cache = new ObservableMap<String, T>(); | 10 final _cache = new ObservableMap<String, T>(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 codeList.sort((Code a, Code b) { | 106 codeList.sort((Code a, Code b) { |
| 107 return b.exclusiveTicks - a.exclusiveTicks; | 107 return b.exclusiveTicks - a.exclusiveTicks; |
| 108 }); | 108 }); |
| 109 if (codeList.length < count) { | 109 if (codeList.length < count) { |
| 110 return codeList; | 110 return codeList; |
| 111 } | 111 } |
| 112 codeList.length = count; | 112 codeList.length = count; |
| 113 return codeList; | 113 return codeList; |
| 114 } | 114 } |
| 115 | 115 |
| 116 static const TAG_ROOT_ID = 'code/tag-0'; |
| 117 |
| 118 /// Returns the Code object for the root tag. |
| 119 Code tagRoot() { |
| 120 return _cache[TAG_ROOT_ID]; |
| 121 } |
| 122 |
| 116 void _resetProfileData() { | 123 void _resetProfileData() { |
| 117 _cache.forEach((k, Code code) { | 124 _cache.forEach((k, Code code) { |
| 118 code.resetProfileData(); | 125 code.resetProfileData(); |
| 119 }); | 126 }); |
| 120 } | 127 } |
| 121 | 128 |
| 122 void _updateProfileData(ServiceMap profile, List<Code> codeTable) { | 129 void _updateProfileData(ServiceMap profile, List<Code> codeTable) { |
| 123 var codeRegions = profile['codes']; | 130 var codeRegions = profile['codes']; |
| 124 var sampleCount = profile['samples']; | 131 var sampleCount = profile['samples']; |
| 125 for (var codeRegion in codeRegions) { | 132 for (var codeRegion in codeRegions) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 | 154 |
| 148 bool cachesType(String type) => ServiceObject.stripRef(type) == 'Function'; | 155 bool cachesType(String type) => ServiceObject.stripRef(type) == 'Function'; |
| 149 ServiceMap _upgrade(ObservableMap obj) => | 156 ServiceMap _upgrade(ObservableMap obj) => |
| 150 new ServiceMap.fromMap(isolate, obj); | 157 new ServiceMap.fromMap(isolate, obj); |
| 151 | 158 |
| 152 static final RegExp _matcher = | 159 static final RegExp _matcher = |
| 153 new RegExp(r'^functions/native-.+|' | 160 new RegExp(r'^functions/native-.+|' |
| 154 r'^functions/collected-.+|' | 161 r'^functions/collected-.+|' |
| 155 r'^functions/reused-.+|' | 162 r'^functions/reused-.+|' |
| 156 r'^functions/stub-.+|' | 163 r'^functions/stub-.+|' |
| 164 r'^functions/tag-.+|' |
| 157 r'^classes/\d+/functions/.+|' | 165 r'^classes/\d+/functions/.+|' |
| 158 r'^classes/\d+/closures/.+|' | 166 r'^classes/\d+/closures/.+|' |
| 159 r'^classes/\d+/implicit_closures/.+|' | 167 r'^classes/\d+/implicit_closures/.+|' |
| 160 r'^classes/\d+/dispatchers/.+'); | 168 r'^classes/\d+/dispatchers/.+'); |
| 161 } | 169 } |
| OLD | NEW |