Chromium Code Reviews| Index: runtime/bin/vmservice/client/lib/src/service/cache.dart |
| diff --git a/runtime/bin/vmservice/client/lib/src/service/cache.dart b/runtime/bin/vmservice/client/lib/src/service/cache.dart |
| index 02604ce9915599aa50a2dc91f657fdf68b5bd999..2c283ab62e8ae7528c24ce5662295f55f9ca1f5e 100644 |
| --- a/runtime/bin/vmservice/client/lib/src/service/cache.dart |
| +++ b/runtime/bin/vmservice/client/lib/src/service/cache.dart |
| @@ -53,6 +53,9 @@ abstract class ServiceObjectCache<T extends ServiceObject> { |
| assert(ServiceObject.isServiceMap(obj)); |
| String id = obj['id']; |
| var type = obj['type']; |
| + if (!cachesId(id)) { |
| + Logger.root.warning('Cache does not cache this id: $id'); |
| + } |
| assert(cachesId(id)); |
| if (contains(id)) { |
| return this[id]; |
| @@ -117,11 +120,11 @@ class CodeCache extends ServiceObjectCache<Code> { |
| } |
| void _updateProfileData(ServiceMap profile, List<Code> codeTable) { |
| - var codes = profile['codes']; |
| + var codeRegions = profile['codes']; |
| var sampleCount = profile['samples']; |
| - for (var profileCode in codes) { |
| - Code code = profileCode['code']; |
| - code.updateProfileData(profileCode, codeTable, sampleCount); |
| + for (var codeRegion in codeRegions) { |
| + Code code = codeRegion['code']; |
| + code.updateProfileData(codeRegion, codeTable, sampleCount); |
| } |
| } |
| } |
| @@ -136,3 +139,36 @@ class ClassCache extends ServiceObjectCache<ServiceMap> { |
| static final RegExp _matcher = new RegExp(r'classes/\d+$'); |
| } |
| + |
| +class FunctionCache extends ServiceObjectCache<ServiceMap> { |
| + FunctionCache(Isolate isolate) : super(isolate); |
| + |
| + bool cachesId(String id) => _native_matcher.hasMatch(id) || |
| + _collected_matcher.hasMatch(id) || |
| + _reused_matcher.hasMatch(id) || |
| + _stub_matcher.hasMatch(id) || |
| + _class_function_matcher.hasMatch(id) || |
| + _class_closure_matcher.hasMatch(id) || |
| + _class_implicit_closure_matcher.hasMatch(id) || |
| + _class_dispatcher_matcher.hasMatch(id); |
|
turnidge
2014/03/13 18:09:09
Checking 8 regexps will be slower than checking 1
Cutch
2014/03/13 20:52:26
Done.
|
| + |
| + bool cachesType(String type) => ServiceObject.stripRef(type) == 'Function'; |
| + ServiceMap _upgrade(ObservableMap obj) => |
| + new ServiceMap.fromMap(isolate, obj); |
| + |
| + static final RegExp _native_matcher = new RegExp(r'^functions/native-.+'); |
| + static final RegExp _collected_matcher = |
| + new RegExp(r'^functions/collected-.+'); |
| + static final RegExp _reused_matcher = |
| + new RegExp(r'^functions/reused-.+'); |
| + static final RegExp _stub_matcher = |
| + new RegExp(r'^functions/stub-.+'); |
| + static final RegExp _class_function_matcher = |
| + new RegExp(r'^classes/\d+/functions/.+'); |
| + static final RegExp _class_closure_matcher = |
| + new RegExp(r'^classes/\d+/closures/.+'); |
| + static final RegExp _class_implicit_closure_matcher = |
| + new RegExp(r'^classes/\d+/implicit_closures/.+'); |
| + static final RegExp _class_dispatcher_matcher = |
| + new RegExp(r'^classes/\d+/dispatchers/.+'); |
| +} |