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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 2294073003: Converted Observatory class-view element (Closed)
Patch Set: Addressed comments Created 4 years, 3 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
OLDNEW
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 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 break; 260 break;
261 case 'Script': 261 case 'Script':
262 obj = new Script._empty(owner); 262 obj = new Script._empty(owner);
263 break; 263 break;
264 case 'Socket': 264 case 'Socket':
265 obj = new Socket._empty(owner); 265 obj = new Socket._empty(owner);
266 break; 266 break;
267 case 'Sentinel': 267 case 'Sentinel':
268 obj = new Sentinel._empty(owner); 268 obj = new Sentinel._empty(owner);
269 break; 269 break;
270 case 'InstanceSet':
271 obj = new InstanceSet._empty(owner);
272 break;
270 case 'TypeArguments': 273 case 'TypeArguments':
271 obj = new TypeArguments._empty(owner); 274 obj = new TypeArguments._empty(owner);
272 break; 275 break;
273 case 'Instance': 276 case 'Instance':
274 obj = new Instance._empty(owner); 277 obj = new Instance._empty(owner);
275 break; 278 break;
276 default: 279 default:
277 break; 280 break;
278 } 281 }
279 if (obj == null) { 282 if (obj == null) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 407 }
405 } 408 }
406 409
407 if (mapIsRef) { 410 if (mapIsRef) {
408 return; 411 return;
409 } 412 }
410 size = map['size']; 413 size = map['size'];
411 } 414 }
412 } 415 }
413 416
417 class RetainingObject implements M.RetainingObject {
418 int get retainedSize => object.retainedSize;
419 final HeapObject object;
420 RetainingObject(this.object);
421 }
422
414 abstract class ServiceObjectOwner extends ServiceObject { 423 abstract class ServiceObjectOwner extends ServiceObject {
415 /// Creates an empty [ServiceObjectOwner]. 424 /// Creates an empty [ServiceObjectOwner].
416 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner); 425 ServiceObjectOwner._empty(ServiceObjectOwner owner) : super._empty(owner);
417 426
418 /// Builds a [ServiceObject] corresponding to the [id] from [map]. 427 /// Builds a [ServiceObject] corresponding to the [id] from [map].
419 /// The result may come from the cache. The result will not necessarily 428 /// The result may come from the cache. The result will not necessarily
420 /// be [loaded]. 429 /// be [loaded].
421 ServiceObject getFromMap(ObservableMap map); 430 ServiceObject getFromMap(ObservableMap map);
422 } 431 }
423 432
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 class AllocationCount extends Observable implements M.AllocationCount { 2326 class AllocationCount extends Observable implements M.AllocationCount {
2318 @observable int instances = 0; 2327 @observable int instances = 0;
2319 @observable int bytes = 0; 2328 @observable int bytes = 0;
2320 2329
2321 void reset() { 2330 void reset() {
2322 instances = 0; 2331 instances = 0;
2323 bytes = 0; 2332 bytes = 0;
2324 } 2333 }
2325 2334
2326 bool get empty => (instances == 0) && (bytes == 0); 2335 bool get empty => (instances == 0) && (bytes == 0);
2336 bool get notEmpty => (instances != 0) || (bytes != 0);
2327 } 2337 }
2328 2338
2329 class Allocations implements M.Allocations{ 2339 class Allocations implements M.Allocations {
2330 // Indexes into VM provided array. (see vm/class_table.h). 2340 // Indexes into VM provided array. (see vm/class_table.h).
2331 static const ALLOCATED_BEFORE_GC = 0; 2341 static const ALLOCATED_BEFORE_GC = 0;
2332 static const ALLOCATED_BEFORE_GC_SIZE = 1; 2342 static const ALLOCATED_BEFORE_GC_SIZE = 1;
2333 static const LIVE_AFTER_GC = 2; 2343 static const LIVE_AFTER_GC = 2;
2334 static const LIVE_AFTER_GC_SIZE = 3; 2344 static const LIVE_AFTER_GC_SIZE = 3;
2335 static const ALLOCATED_SINCE_GC = 4; 2345 static const ALLOCATED_SINCE_GC = 4;
2336 static const ALLOCATED_SINCE_GC_SIZE = 5; 2346 static const ALLOCATED_SINCE_GC_SIZE = 5;
2337 static const ACCUMULATED = 6; 2347 static const ACCUMULATED = 6;
2338 static const ACCUMULATED_SIZE = 7; 2348 static const ACCUMULATED_SIZE = 7;
2339 2349
2340 final AllocationCount accumulated = new AllocationCount(); 2350 final AllocationCount accumulated = new AllocationCount();
2341 final AllocationCount current = new AllocationCount(); 2351 final AllocationCount current = new AllocationCount();
2342 2352
2343 void update(List stats) { 2353 void update(List stats) {
2344 accumulated.instances = stats[ACCUMULATED]; 2354 accumulated.instances = stats[ACCUMULATED];
2345 accumulated.bytes = stats[ACCUMULATED_SIZE]; 2355 accumulated.bytes = stats[ACCUMULATED_SIZE];
2346 current.instances = stats[LIVE_AFTER_GC] + stats[ALLOCATED_SINCE_GC]; 2356 current.instances = stats[LIVE_AFTER_GC] + stats[ALLOCATED_SINCE_GC];
2347 current.bytes = stats[LIVE_AFTER_GC_SIZE] + stats[ALLOCATED_SINCE_GC_SIZE]; 2357 current.bytes = stats[LIVE_AFTER_GC_SIZE] + stats[ALLOCATED_SINCE_GC_SIZE];
2348 } 2358 }
2349 2359
2350 bool get empty => accumulated.empty && current.empty; 2360 bool get empty => accumulated.empty && current.empty;
2361 bool get notEmpty => accumulated.notEmpty || current.notEmpty;
2351 } 2362 }
2352 2363
2353 class Class extends HeapObject implements M.Class { 2364 class Class extends HeapObject implements M.Class {
2354 @observable Library library; 2365 @observable Library library;
2355 2366
2356 @observable bool isAbstract; 2367 @observable bool isAbstract;
2357 @observable bool isConst; 2368 @observable bool isConst;
2358 @observable bool isFinalized; 2369 @observable bool isFinalized;
2359 @observable bool isPatch; 2370 @observable bool isPatch;
2360 @observable bool isImplemented; 2371 @observable bool isImplemented;
2361 2372
2362 @observable SourceLocation location; 2373 @observable SourceLocation location;
2363 2374
2364 @observable DartError error; 2375 @observable DartError error;
2365 @observable int vmCid; 2376 @observable int vmCid;
2366 2377
2367 final Allocations newSpace = new Allocations(); 2378 final Allocations newSpace = new Allocations();
2368 final Allocations oldSpace = new Allocations(); 2379 final Allocations oldSpace = new Allocations();
2369 final AllocationCount promotedByLastNewGC = new AllocationCount(); 2380 final AllocationCount promotedByLastNewGC = new AllocationCount();
2370 2381
2382 @observable bool get hasAllocations => newSpace.notEmpty || oldSpace.notEmpty;
2371 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty; 2383 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty;
2372 @observable bool traceAllocations = false; 2384 @observable bool traceAllocations = false;
2373 @reflectable final fields = new ObservableList<Field>(); 2385 @reflectable final fields = new ObservableList<Field>();
2374 @reflectable final functions = new ObservableList<ServiceFunction>(); 2386 @reflectable final functions = new ObservableList<ServiceFunction>();
2375 2387
2376 @observable Class superclass; 2388 @observable Class superclass;
2377 @reflectable final interfaces = new ObservableList<Instance>(); 2389 @reflectable final interfaces = new ObservableList<Instance>();
2378 @reflectable final subclasses = new ObservableList<Class>(); 2390 @reflectable final subclasses = new ObservableList<Class>();
2379 2391
2380 @observable Instance superType; 2392 @observable Instance superType;
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 _upgradeCollection(map, isolate); 3034 _upgradeCollection(map, isolate);
3023 super._update(map, mapIsRef); 3035 super._update(map, mapIsRef);
3024 3036
3025 name = map['name']; 3037 name = map['name'];
3026 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name); 3038 vmName = (map.containsKey('_vmName') ? map['_vmName'] : name);
3027 dartOwner = map['owner']; 3039 dartOwner = map['owner'];
3028 declaredType = map['declaredType']; 3040 declaredType = map['declaredType'];
3029 isStatic = map['static']; 3041 isStatic = map['static'];
3030 isFinal = map['final']; 3042 isFinal = map['final'];
3031 isConst = map['const']; 3043 isConst = map['const'];
3032 staticValue = map['staticValue'];
3033 3044
3034 if (dartOwner is Class) { 3045 if (dartOwner is Class) {
3035 Class ownerClass = dartOwner; 3046 Class ownerClass = dartOwner;
3036 library = ownerClass.library; 3047 library = ownerClass.library;
3037 3048
3038 } else { 3049 } else {
3039 library = dartOwner; 3050 library = dartOwner;
3040 } 3051 }
3041 3052
3042 if (mapIsRef) { 3053 if (mapIsRef) {
3043 return; 3054 return;
3044 } 3055 }
3056 staticValue = map['staticValue'];
3045 3057
3046 guardNullable = map['_guardNullable']; 3058 guardNullable = map['_guardNullable'];
3047 if (map['_guardClass'] is Class) { 3059 if (map['_guardClass'] is Class) {
3048 guardClass = map['_guardClass']; 3060 guardClass = map['_guardClass'];
3049 guardClassKind = M.GuardClassKind.single; 3061 guardClassKind = M.GuardClassKind.single;
3050 } else { 3062 } else {
3051 switch (map['_guardClass']) { 3063 switch (map['_guardClass']) {
3052 case 'various': 3064 case 'various':
3053 guardClassKind = M.GuardClassKind.dynamic; 3065 guardClassKind = M.GuardClassKind.dynamic;
3054 break; 3066 break;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3736 3748
3737 dartOwner = map['_owner']; 3749 dartOwner = map['_owner'];
3738 name = map['name']; 3750 name = map['name'];
3739 if (mapIsRef) { 3751 if (mapIsRef) {
3740 return; 3752 return;
3741 } 3753 }
3742 types = map['types']; 3754 types = map['types'];
3743 } 3755 }
3744 } 3756 }
3745 3757
3758 class InstanceSet extends HeapObject implements M.InstanceSet {
3759 HeapObject dartOwner;
3760 int count;
3761 Iterable<HeapObject> samples;
3762
3763 InstanceSet._empty(ServiceObjectOwner owner) : super._empty(owner);
3764
3765 void _update(ObservableMap map, bool mapIsRef) {
3766 _upgradeCollection(map, isolate);
3767 super._update(map, mapIsRef);
3768
3769 if (mapIsRef) {
3770 return;
3771 }
3772 count = map['totalCount'];
3773 samples = map['samples'];
3774 }
3775 }
3776
3746 class MegamorphicCache extends HeapObject implements M.MegamorphicCache { 3777 class MegamorphicCache extends HeapObject implements M.MegamorphicCache {
3747 @observable int mask; 3778 @observable int mask;
3748 @observable Instance buckets; 3779 @observable Instance buckets;
3749 @observable String selector; 3780 @observable String selector;
3750 @observable Instance argumentsDescriptor; 3781 @observable Instance argumentsDescriptor;
3751 3782
3752 bool get immutable => false; 3783 bool get immutable => false;
3753 3784
3754 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner); 3785 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner);
3755 3786
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
4420 var v = list[i]; 4451 var v = list[i];
4421 if ((v is ObservableMap) && _isServiceMap(v)) { 4452 if ((v is ObservableMap) && _isServiceMap(v)) {
4422 list[i] = owner.getFromMap(v); 4453 list[i] = owner.getFromMap(v);
4423 } else if (v is ObservableList) { 4454 } else if (v is ObservableList) {
4424 _upgradeObservableList(v, owner); 4455 _upgradeObservableList(v, owner);
4425 } else if (v is ObservableMap) { 4456 } else if (v is ObservableMap) {
4426 _upgradeObservableMap(v, owner); 4457 _upgradeObservableMap(v, owner);
4427 } 4458 }
4428 } 4459 }
4429 } 4460 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/repositories/top_retaining_instances.dart ('k') | runtime/observatory/observatory_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698