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

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

Issue 2244433003: Converted Observatory refs elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: All element tested Created 4 years, 4 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 String toString() => 'MalformedResponseRpcException(${message})'; 86 String toString() => 'MalformedResponseRpcException(${message})';
87 } 87 }
88 88
89 class FakeVMRpcException extends RpcException { 89 class FakeVMRpcException extends RpcException {
90 FakeVMRpcException(String message) : super(message); 90 FakeVMRpcException(String message) : super(message);
91 91
92 String toString() => 'FakeVMRpcException(${message})'; 92 String toString() => 'FakeVMRpcException(${message})';
93 } 93 }
94 94
95 /// A [ServiceObject] represents a persistent object within the vm. 95 /// A [ServiceObject] represents a persistent object within the vm.
96 abstract class ServiceObject extends Observable { 96 abstract class ServiceObject extends Observable implements M.ObjectRef {
97 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { 97 static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
98 return o1.name.compareTo(o2.name); 98 return o1.name.compareTo(o2.name);
99 } 99 }
100 100
101 List removeDuplicatesAndSortLexical(List<ServiceObject> list) { 101 List removeDuplicatesAndSortLexical(List<ServiceObject> list) {
102 return list.toSet().toList()..sort(LexicalSortName); 102 return list.toSet().toList()..sort(LexicalSortName);
103 } 103 }
104 104
105 /// The owner of this [ServiceObject]. This can be an [Isolate], a 105 /// The owner of this [ServiceObject]. This can be an [Isolate], a
106 /// [VM], or null. 106 /// [VM], or null.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 break; 260 break;
261 case 'Event': 261 case 'Event':
262 obj = new ServiceEvent._empty(owner); 262 obj = new ServiceEvent._empty(owner);
263 break; 263 break;
264 case 'Script': 264 case 'Script':
265 obj = new Script._empty(owner); 265 obj = new Script._empty(owner);
266 break; 266 break;
267 case 'Socket': 267 case 'Socket':
268 obj = new Socket._empty(owner); 268 obj = new Socket._empty(owner);
269 break; 269 break;
270 case 'Sentinel':
271 obj = new Sentinel._empty(owner);
272 break;
270 case 'Instance': 273 case 'Instance':
271 case 'Sentinel': // TODO(rmacnak): Separate this out.
272 obj = new Instance._empty(owner); 274 obj = new Instance._empty(owner);
273 break; 275 break;
274 default: 276 default:
275 break; 277 break;
276 } 278 }
277 if (obj == null) { 279 if (obj == null) {
278 obj = new ServiceMap._empty(owner); 280 obj = new ServiceMap._empty(owner);
279 } 281 }
280 obj.update(map); 282 obj.update(map);
281 return obj; 283 return obj;
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 2385
2384 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { 2386 Future<ServiceObject> getAllocationSamples([String tags = 'None']) {
2385 var params = { 'tags': tags, 2387 var params = { 'tags': tags,
2386 'classId': id }; 2388 'classId': id };
2387 return isolate.invokeRpc('_getAllocationSamples', params); 2389 return isolate.invokeRpc('_getAllocationSamples', params);
2388 } 2390 }
2389 2391
2390 String toString() => 'Class($vmName)'; 2392 String toString() => 'Class($vmName)';
2391 } 2393 }
2392 2394
2395 M.InstanceKind stringToInstanceKind(String s) {
2396 switch (s) {
2397 case 'PlainInstance':
2398 return M.InstanceKind.plainInstance;
2399 case 'Null':
2400 return M.InstanceKind.vNull;
2401 case 'Bool':
2402 return M.InstanceKind.bool;
2403 case 'Double':
2404 return M.InstanceKind.double;
2405 case 'Int':
2406 return M.InstanceKind.int;
2407 case 'String':
2408 return M.InstanceKind.string;
2409 case 'List':
2410 return M.InstanceKind.list;
2411 case 'Map':
2412 return M.InstanceKind.map;
2413 case 'Float32x4':
2414 return M.InstanceKind.float32x4;
2415 case 'Float64x2':
2416 return M.InstanceKind.float64x2;
2417 case 'Int32x4':
2418 return M.InstanceKind.int32x4;
2419 case 'Uint8ClampedList':
2420 return M.InstanceKind.uint8ClampedList;
2421 case 'Uint8List':
2422 return M.InstanceKind.uint8List;
2423 case 'Uint16List':
2424 return M.InstanceKind.uint16List;
2425 case 'Uint32List':
2426 return M.InstanceKind.uint32List;
2427 case 'Uint64List':
2428 return M.InstanceKind.uint64List;
2429 case 'Int8List':
2430 return M.InstanceKind.int8List;
2431 case 'Int16List':
2432 return M.InstanceKind.int16List;
2433 case 'Int32List':
2434 return M.InstanceKind.int32List;
2435 case 'Int64List':
2436 return M.InstanceKind.int64List;
2437 case 'Float32List':
2438 return M.InstanceKind.float32List;
2439 case 'Float64List':
2440 return M.InstanceKind.float64List;
2441 case 'Int32x4List':
2442 return M.InstanceKind.int32x4List;
2443 case 'Float32x4List':
2444 return M.InstanceKind.float32x4List;
2445 case 'Float64x2List':
2446 return M.InstanceKind.float64x2List;
2447 case 'StackTrace':
2448 return M.InstanceKind.stackTrace;
2449 case 'Closure':
2450 return M.InstanceKind.closure;
2451 case 'MirrorReference':
2452 return M.InstanceKind.mirrorReference;
2453 case 'RegExp':
2454 return M.InstanceKind.regExp;
2455 case 'WeakProperty':
2456 return M.InstanceKind.weakProperty;
2457 case 'Type':
2458 return M.InstanceKind.type;
2459 case 'TypeParameter':
2460 return M.InstanceKind.typeParameter;
2461 case 'TypeRef':
2462 return M.InstanceKind.typeRef;
2463 case 'BoundedType':
2464 return M.InstanceKind.boundedType;
2465 }
2466 Logger.root.severe("Unrecognized InstanceKind: '$s'");
2467 throw new FallThroughError();
2468 }
2469
2470 class Guarded<T> implements M.Guarded<T> {
2471 bool get isValue => asValue != null;
2472 bool get isSentinel => asSentinel != null;
2473 final Sentinel asSentinel;
2474 final T asValue;
2475
2476 factory Guarded(ServiceObject obj) {
2477 if (obj is Sentinel) {
2478 return new Guarded.fromSentinel(obj);
2479 } else if (obj is T) {
2480 return new Guarded.fromValue(obj);
2481 }
2482 throw new Exception('${obj.type} is neither Sentinel or $T');
2483 }
2484
2485 Guarded.fromSentinel(this.asSentinel)
2486 : asValue = null;
2487 Guarded.fromValue(this.asValue)
2488 : asSentinel = null;
2489 }
2490
2491 class BoundField implements M.BoundField {
2492 final Field decl;
2493 final Guarded<Instance> value;
2494 BoundField(this.decl, value)
2495 : value = new Guarded(value);
2496 }
2497
2498 class MapAssociation implements M.MapAssociation {
2499 final Guarded<Instance> key;
2500 final Guarded<Instance> value;
2501 MapAssociation(key, value)
2502 : key = new Guarded(key),
2503 value = new Guarded(value);
2504 }
2505
2393 class Instance extends HeapObject implements M.Instance { 2506 class Instance extends HeapObject implements M.Instance {
2394 @observable String kind; 2507 @observable M.InstanceKind kind;
2395 @observable String valueAsString; // If primitive. 2508 @observable String valueAsString; // If primitive.
2396 @observable bool valueAsStringIsTruncated; 2509 @observable bool valueAsStringIsTruncated;
2397 @observable ServiceFunction function; // If a closure. 2510 @observable ServiceFunction closureFunction; // If a closure.
2398 @observable Context context; // If a closure. 2511 @observable Context context; // If a closure.
2399 @observable int length; // If a List, Map or TypedData. 2512 @observable int length; // If a List, Map or TypedData.
2513 int count;
2514 int offset;
2400 @observable Instance pattern; // If a RegExp. 2515 @observable Instance pattern; // If a RegExp.
2401 2516
2402 @observable String name; 2517 @observable String name;
2403 @observable Class typeClass; 2518 @observable Class typeClass;
2404 @observable Class parameterizedClass; 2519 @observable Class parameterizedClass;
2405 @observable ServiceObject typeArguments; 2520 @observable ServiceObject typeArguments;
2406 @observable int parameterIndex; 2521 @observable int parameterIndex;
2407 @observable Instance targetType; 2522 @observable Instance targetType;
2408 @observable Instance bound; 2523 @observable Instance bound;
2409 2524
2410 @observable var fields; 2525 @observable Iterable<BoundField> fields;
Cutch 2016/08/15 23:27:08 If these are List use List instead of Iterable (he
cbernaschina 2016/08/16 00:01:44 It is for enforcing the "read only" nature of the
2411 @observable var nativeFields; 2526 @observable var nativeFields;
2412 @observable var elements; // If a List. 2527 @observable Iterable<Guarded<ServiceObject>> elements; // If a List.
2413 @observable var associations; // If a Map. 2528 @observable Iterable<MapAssociation> associations; // If a Map.
2414 @observable var typedElements; // If a TypedData. 2529 @observable Iterable<dynamic> typedElements; // If a TypedData.
2415 @observable var referent; // If a MirrorReference. 2530 @observable Instance referent; // If a MirrorReference.
2416 @observable Instance key; // If a WeakProperty. 2531 @observable Instance key; // If a WeakProperty.
2417 @observable Instance value; // If a WeakProperty. 2532 @observable Instance value; // If a WeakProperty.
2418 @observable Breakpoint activationBreakpoint; // If a Closure. 2533 @observable Breakpoint activationBreakpoint; // If a Closure.
2419 @observable ServiceFunction oneByteFunction; // If a RegExp. 2534 @observable ServiceFunction oneByteFunction; // If a RegExp.
2420 @observable ServiceFunction twoByteFunction; // If a RegExp. 2535 @observable ServiceFunction twoByteFunction; // If a RegExp.
2421 @observable ServiceFunction externalOneByteFunction; // If a RegExp. 2536 @observable ServiceFunction externalOneByteFunction; // If a RegExp.
2422 @observable ServiceFunction externalTwoByteFunction; // If a RegExp. 2537 @observable ServiceFunction externalTwoByteFunction; // If a RegExp.
2423 @observable Instance oneByteBytecode; // If a RegExp. 2538 @observable Instance oneByteBytecode; // If a RegExp.
2424 @observable Instance twoByteBytecode; // If a RegExp. 2539 @observable Instance twoByteBytecode; // If a RegExp.
2425 @observable bool isCaseSensitive; // If a RegExp. 2540 @observable bool isCaseSensitive; // If a RegExp.
2426 @observable bool isMultiLine; // If a RegExp. 2541 @observable bool isMultiLine; // If a RegExp.
2427 2542
2428 bool get isAbstractType {
2429 return (kind == 'Type' || kind == 'TypeRef' ||
2430 kind == 'TypeParameter' || kind == 'BoundedType');
2431 }
2432 bool get isNull => kind == 'Null';
2433 bool get isBool => kind == 'Bool';
2434 bool get isDouble => kind == 'Double';
2435 bool get isString => kind == 'String';
2436 bool get isInt => kind == 'Int';
2437 bool get isList => kind == 'List';
2438 bool get isMap => kind == 'Map';
2439 bool get isTypedData {
2440 return kind == 'Uint8ClampedList'
2441 || kind == 'Uint8List'
2442 || kind == 'Uint16List'
2443 || kind == 'Uint32List'
2444 || kind == 'Uint64List'
2445 || kind == 'Int8List'
2446 || kind == 'Int16List'
2447 || kind == 'Int32List'
2448 || kind == 'Int64List'
2449 || kind == 'Float32List'
2450 || kind == 'Float64List'
2451 || kind == 'Int32x4List'
2452 || kind == 'Float32x4List'
2453 || kind == 'Float64x2List';
2454 }
2455 bool get isSimdValue {
2456 return kind == 'Float32x4'
2457 || kind == 'Float64x2'
2458 || kind == 'Int32x4';
2459 }
2460 bool get isRegExp => kind == 'RegExp';
2461 bool get isMirrorReference => kind == 'MirrorReference';
2462 bool get isWeakProperty => kind == 'WeakProperty';
2463 bool get isClosure => kind == 'Closure';
2464 bool get isStackTrace => kind == 'StackTrace';
2465 bool get isStackOverflowError { 2543 bool get isStackOverflowError {
2466 if (clazz == null) { 2544 if (clazz == null) {
2467 return false; 2545 return false;
2468 } 2546 }
2469 if (clazz.library == null) { 2547 if (clazz.library == null) {
2470 return false; 2548 return false;
2471 } 2549 }
2472 return (clazz.name == 'StackOverflowError') && clazz.library.isDart('core'); 2550 return (clazz.name == 'StackOverflowError') && clazz.library.isDart('core');
2473 } 2551 }
2474 2552
(...skipping 11 matching lines...) Expand all
2486 // instance kinds are added? 2564 // instance kinds are added?
2487 bool get isPlainInstance => kind == 'PlainInstance'; 2565 bool get isPlainInstance => kind == 'PlainInstance';
2488 2566
2489 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 2567 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
2490 2568
2491 void _update(ObservableMap map, bool mapIsRef) { 2569 void _update(ObservableMap map, bool mapIsRef) {
2492 // Extract full properties.1 2570 // Extract full properties.1
2493 _upgradeCollection(map, isolate); 2571 _upgradeCollection(map, isolate);
2494 super._update(map, mapIsRef); 2572 super._update(map, mapIsRef);
2495 2573
2496 kind = map['kind']; 2574 kind = stringToInstanceKind(map['kind']);
2497 valueAsString = map['valueAsString']; 2575 valueAsString = map['valueAsString'];
2498 // Coerce absence to false. 2576 // Coerce absence to false.
2499 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true; 2577 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
2500 function = map['closureFunction']; 2578 closureFunction = map['closureFunction'];
2501 context = map['closureContext']; 2579 context = map['closureContext'];
2502 name = map['name']; 2580 name = map['name'];
2503 length = map['length']; 2581 length = map['length'];
2504 pattern = map['pattern']; 2582 pattern = map['pattern'];
2505 typeClass = map['typeClass']; 2583 typeClass = map['typeClass'];
2506 2584
2507 if (mapIsRef) { 2585 if (mapIsRef) {
2508 return; 2586 return;
2509 } 2587 }
2510 2588
2589 count = map['count'];
2590 offset = map['offset'];
2511 isCaseSensitive = map['isCaseSensitive']; 2591 isCaseSensitive = map['isCaseSensitive'];
2512 isMultiLine = map['isMultiLine']; 2592 isMultiLine = map['isMultiLine'];
2513 bool isCompiled = map['_oneByteFunction'] is ServiceFunction; 2593 bool isCompiled = map['_oneByteFunction'] is ServiceFunction;
2514 oneByteFunction = isCompiled ? map['_oneByteFunction'] : null; 2594 oneByteFunction = isCompiled ? map['_oneByteFunction'] : null;
2515 twoByteFunction = isCompiled ? map['_twoByteFunction'] : null; 2595 twoByteFunction = isCompiled ? map['_twoByteFunction'] : null;
2516 externalOneByteFunction = isCompiled ? map['_externalOneByteFunction'] : nul l; 2596 externalOneByteFunction = isCompiled ? map['_externalOneByteFunction'] : nul l;
2517 externalTwoByteFunction = isCompiled ? map['_externalTwoByteFunction'] : nul l; 2597 externalTwoByteFunction = isCompiled ? map['_externalTwoByteFunction'] : nul l;
2518 oneByteBytecode = map['_oneByteBytecode']; 2598 oneByteBytecode = map['_oneByteBytecode'];
2519 twoByteBytecode = map['_twoByteBytecode']; 2599 twoByteBytecode = map['_twoByteBytecode'];
2520 2600
2521 nativeFields = map['_nativeFields']; 2601 nativeFields = map['_nativeFields'];
2522 fields = map['fields']; 2602 if (map['fields'] != null) {
2523 elements = map['elements']; 2603 fields = map['fields']
2524 associations = map['associations']; 2604 .map((f) => new BoundField(f['decl'], f['value'])).toList();
2605 }
2606 if (map['elements'] != null) {
2607 // Should be:
2608 // elements = map['elements'].map((e) => new Guarded<Instance>(e)).toList();
Cutch 2016/08/15 23:27:08 weird indentation. Fix the code or fix the commen
cbernaschina 2016/08/16 00:01:44 Done.
2609 // some times we obtain object that are not InstanceRef
2610 elements = map['elements'].map((e) => new Guarded<ServiceObject>(e))
2611 .toList();
2612 }
2613 if (map['associations'] != null) {
2614 associations = map['associations'].map((a) =>
2615 new MapAssociation(a['key'], a['value'])).toList();
2616 };
2525 if (map['bytes'] != null) { 2617 if (map['bytes'] != null) {
2526 Uint8List bytes = BASE64.decode(map['bytes']); 2618 Uint8List bytes = BASE64.decode(map['bytes']);
2527 switch (map['kind']) { 2619 switch (map['kind']) {
2528 case "Uint8ClampedList": 2620 case "Uint8ClampedList":
2529 typedElements = bytes.buffer.asUint8ClampedList(); break; 2621 typedElements = bytes.buffer.asUint8ClampedList(); break;
2530 case "Uint8List": 2622 case "Uint8List":
2531 typedElements = bytes.buffer.asUint8List(); break; 2623 typedElements = bytes.buffer.asUint8List(); break;
2532 case "Uint16List": 2624 case "Uint16List":
2533 typedElements = bytes.buffer.asUint16List(); break; 2625 typedElements = bytes.buffer.asUint16List(); break;
2534 case "Uint32List": 2626 case "Uint32List":
(...skipping 30 matching lines...) Expand all
2565 key = map['propertyKey']; 2657 key = map['propertyKey'];
2566 value = map['propertyValue']; 2658 value = map['propertyValue'];
2567 activationBreakpoint = map['_activationBreakpoint']; 2659 activationBreakpoint = map['_activationBreakpoint'];
2568 2660
2569 // We are fully loaded. 2661 // We are fully loaded.
2570 _loaded = true; 2662 _loaded = true;
2571 } 2663 }
2572 2664
2573 String get shortName { 2665 String get shortName {
2574 if (isClosure) { 2666 if (isClosure) {
2575 return function.qualifiedName; 2667 return closureFunction.qualifiedName;
2576 } 2668 }
2577 if (valueAsString != null) { 2669 if (valueAsString != null) {
2578 return valueAsString; 2670 return valueAsString;
2579 } 2671 }
2580 return 'a ${clazz.name}'; 2672 return 'a ${clazz.name}';
2581 } 2673 }
2582 2674
2583 Future<ServiceObject> evaluate(String expression) { 2675 Future<ServiceObject> evaluate(String expression) {
2584 return isolate._eval(this, expression); 2676 return isolate._eval(this, expression);
2585 } 2677 }
2586 2678
2587 String toString() => 'Instance($shortName)'; 2679 String toString() => 'Instance($shortName)';
2588 } 2680 }
2589 2681
2590 2682
2591 class Context extends HeapObject { 2683 class Context extends HeapObject implements M.Context {
2592 @observable var parentContext; 2684 @observable Context parentContext;
2593 @observable int length; 2685 @observable int length;
2594 @observable var variables; 2686 @observable var variables;
2595 2687
2596 Context._empty(ServiceObjectOwner owner) : super._empty(owner); 2688 Context._empty(ServiceObjectOwner owner) : super._empty(owner);
2597 2689
2598 void _update(ObservableMap map, bool mapIsRef) { 2690 void _update(ObservableMap map, bool mapIsRef) {
2599 // Extract full properties. 2691 // Extract full properties.
2600 _upgradeCollection(map, isolate); 2692 _upgradeCollection(map, isolate);
2601 super._update(map, mapIsRef); 2693 super._update(map, mapIsRef);
2602 2694
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2811
2720 ServiceFunction get homeMethod { 2812 ServiceFunction get homeMethod {
2721 var m = this; 2813 var m = this;
2722 while (m.dartOwner is ServiceFunction) { 2814 while (m.dartOwner is ServiceFunction) {
2723 m = m.dartOwner; 2815 m = m.dartOwner;
2724 } 2816 }
2725 return m; 2817 return m;
2726 } 2818 }
2727 } 2819 }
2728 2820
2821 M.SentinelKind stringToSentinelKind(String s) {
2822 switch (s) {
2823 case 'Collected':
2824 return M.SentinelKind.collected;
2825 case 'Expired':
2826 return M.SentinelKind.expired;
2827 case 'NotInitialized':
2828 return M.SentinelKind.notInitialized;
2829 case 'BeingInitialized':
2830 return M.SentinelKind.beingInitialized;
2831 case 'OptimizedOut':
2832 return M.SentinelKind.optimizedOut;
2833 case 'Free':
2834 return M.SentinelKind.free;
2835 }
2836 Logger.root.severe("Unrecognized SentinelKind: '$s'");
2837 throw new FallThroughError();
2838 }
2729 2839
2730 class Field extends HeapObject { 2840 class Sentinel extends ServiceObject implements M.Sentinel {
2841
2842 M.SentinelKind kind;
2843 String valueAsString;
2844
2845 Sentinel._empty(ServiceObjectOwner owner) : super._empty(owner);
2846
2847 void _update(ObservableMap map, bool mapIsRef) {
2848 // Extract full properties.
2849 _upgradeCollection(map, isolate);
2850
2851 kind = stringToSentinelKind(map['kind']);
2852 valueAsString = map['valueAsString'];
2853 _loaded = true;
2854 }
2855
2856 String toString() => 'Sentinel($kind)';
2857 }
2858
2859 class Field extends HeapObject implements M.FieldRef {
2731 // Library or Class. 2860 // Library or Class.
2732 @observable ServiceObject dartOwner; 2861 @observable ServiceObject dartOwner;
2733 @observable Library library; 2862 @observable Library library;
2734 @observable Instance declaredType; 2863 @observable Instance declaredType;
2735 @observable bool isStatic; 2864 @observable bool isStatic;
2736 @observable bool isFinal; 2865 @observable bool isFinal;
2737 @observable bool isConst; 2866 @observable bool isConst;
2738 @observable Instance staticValue; 2867 @observable Instance staticValue;
2739 @observable String name; 2868 @observable String name;
2740 @observable String vmName; 2869 @observable String vmName;
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3275 var line = script.tokenToLine(tokenPos); 3404 var line = script.tokenToLine(tokenPos);
3276 if (line == null) { 3405 if (line == null) {
3277 return; 3406 return;
3278 } 3407 }
3279 this.script = script; 3408 this.script = script;
3280 var scriptLine = script.getLine(line); 3409 var scriptLine = script.getLine(line);
3281 formattedLine = scriptLine.text; 3410 formattedLine = scriptLine.text;
3282 } 3411 }
3283 } 3412 }
3284 3413
3285 class PcDescriptors extends ServiceObject { 3414 class PcDescriptors extends ServiceObject implements M.PcDescriptorsRef {
3286 @observable Class clazz; 3415 @observable Class clazz;
3287 @observable int size; 3416 @observable int size;
3288 bool get immutable => true; 3417 bool get immutable => true;
3289 @reflectable final List<PcDescriptor> descriptors = 3418 @reflectable final List<PcDescriptor> descriptors =
3290 new ObservableList<PcDescriptor>(); 3419 new ObservableList<PcDescriptor>();
3291 3420
3292 PcDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner) { 3421 PcDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner) {
3293 } 3422 }
3294 3423
3295 void _update(ObservableMap m, bool mapIsRef) { 3424 void _update(ObservableMap m, bool mapIsRef) {
3296 if (mapIsRef) { 3425 if (mapIsRef) {
3297 return; 3426 return;
3298 } 3427 }
3299 _upgradeCollection(m, isolate); 3428 _upgradeCollection(m, isolate);
3300 clazz = m['class']; 3429 clazz = m['class'];
3301 size = m['size']; 3430 size = m['size'];
3302 descriptors.clear(); 3431 descriptors.clear();
3303 for (var descriptor in m['members']) { 3432 for (var descriptor in m['members']) {
3304 var pcOffset = int.parse(descriptor['pcOffset'], radix:16); 3433 var pcOffset = int.parse(descriptor['pcOffset'], radix:16);
3305 var deoptId = descriptor['deoptId']; 3434 var deoptId = descriptor['deoptId'];
3306 var tokenPos = descriptor['tokenPos']; 3435 var tokenPos = descriptor['tokenPos'];
3307 var tryIndex = descriptor['tryIndex']; 3436 var tryIndex = descriptor['tryIndex'];
3308 var kind = descriptor['kind'].trim(); 3437 var kind = descriptor['kind'].trim();
3309 descriptors.add( 3438 descriptors.add(
3310 new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind)); 3439 new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind));
3311 } 3440 }
3312 } 3441 }
3313 } 3442 }
3314 3443
3315 class LocalVarDescriptor extends Observable { 3444 class LocalVarDescriptor extends Observable
3445 implements M.LocalVarDescriptorsRef {
3446 @reflectable final String id;
3316 @reflectable final String name; 3447 @reflectable final String name;
3317 @reflectable final int index; 3448 @reflectable final int index;
3318 @reflectable final int beginPos; 3449 @reflectable final int beginPos;
3319 @reflectable final int endPos; 3450 @reflectable final int endPos;
3320 @reflectable final int scopeId; 3451 @reflectable final int scopeId;
3321 @reflectable final String kind; 3452 @reflectable final String kind;
3322 3453
3323 LocalVarDescriptor(this.name, this.index, this.beginPos, this.endPos, 3454 LocalVarDescriptor(this.id, this.name, this.index, this.beginPos, this.endPos,
3324 this.scopeId, this.kind); 3455 this.scopeId, this.kind);
3325 } 3456 }
3326 3457
3327 class LocalVarDescriptors extends ServiceObject { 3458 class LocalVarDescriptors extends ServiceObject {
3328 @observable Class clazz; 3459 @observable Class clazz;
3329 @observable int size; 3460 @observable int size;
3330 bool get immutable => true; 3461 bool get immutable => true;
3331 @reflectable final List<LocalVarDescriptor> descriptors = 3462 @reflectable final List<LocalVarDescriptor> descriptors =
3332 new ObservableList<LocalVarDescriptor>(); 3463 new ObservableList<LocalVarDescriptor>();
3333 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner); 3464 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner);
3334 3465
3335 void _update(ObservableMap m, bool mapIsRef) { 3466 void _update(ObservableMap m, bool mapIsRef) {
3336 if (mapIsRef) { 3467 if (mapIsRef) {
3337 return; 3468 return;
3338 } 3469 }
3339 _upgradeCollection(m, isolate); 3470 _upgradeCollection(m, isolate);
3340 clazz = m['class']; 3471 clazz = m['class'];
3341 size = m['size']; 3472 size = m['size'];
3342 descriptors.clear(); 3473 descriptors.clear();
3343 for (var descriptor in m['members']) { 3474 for (var descriptor in m['members']) {
3475 var id = descriptor['name'];
3344 var name = descriptor['name']; 3476 var name = descriptor['name'];
3345 var index = descriptor['index']; 3477 var index = descriptor['index'];
3346 var beginPos = descriptor['beginPos']; 3478 var beginPos = descriptor['beginPos'];
3347 var endPos = descriptor['endPos']; 3479 var endPos = descriptor['endPos'];
3348 var scopeId = descriptor['scopeId']; 3480 var scopeId = descriptor['scopeId'];
3349 var kind = descriptor['kind'].trim(); 3481 var kind = descriptor['kind'].trim();
3350 descriptors.add( 3482 descriptors.add(
3351 new LocalVarDescriptor(name, index, beginPos, endPos, scopeId, kind)); 3483 new LocalVarDescriptor(id, name, index, beginPos, endPos, scopeId,
3484 kind));
3352 } 3485 }
3353 } 3486 }
3354 } 3487 }
3355 3488
3356 class ObjectPool extends HeapObject { 3489 class ObjectPool extends HeapObject implements M.ObjectPoolRef {
3357 bool get immutable => false; 3490 bool get immutable => false;
3358 3491
3359 @observable int length; 3492 @observable int length;
3360 @observable List entries; 3493 @observable List entries;
3361 3494
3362 ObjectPool._empty(ServiceObjectOwner owner) : super._empty(owner); 3495 ObjectPool._empty(ServiceObjectOwner owner) : super._empty(owner);
3363 3496
3364 void _update(ObservableMap map, bool mapIsRef) { 3497 void _update(ObservableMap map, bool mapIsRef) {
3365 _upgradeCollection(map, isolate); 3498 _upgradeCollection(map, isolate);
3366 super._update(map, mapIsRef); 3499 super._update(map, mapIsRef);
3367 3500
3368 length = map['length']; 3501 length = map['length'];
3369 if (mapIsRef) { 3502 if (mapIsRef) {
3370 return; 3503 return;
3371 } 3504 }
3372 entries = map['_entries']; 3505 entries = map['_entries'];
3373 } 3506 }
3374 } 3507 }
3375 3508
3376 class ICData extends HeapObject { 3509 class ICData extends HeapObject implements M.ICDataRef {
3377 @observable ServiceObject dartOwner; 3510 @observable ServiceObject dartOwner;
3378 @observable String selector; 3511 @observable String selector;
3379 @observable Instance argumentsDescriptor; 3512 @observable Instance argumentsDescriptor;
3380 @observable Instance entries; 3513 @observable Instance entries;
3381 3514
3382 bool get immutable => false; 3515 bool get immutable => false;
3383 3516
3384 ICData._empty(ServiceObjectOwner owner) : super._empty(owner); 3517 ICData._empty(ServiceObjectOwner owner) : super._empty(owner);
3385 3518
3386 void _update(ObservableMap map, bool mapIsRef) { 3519 void _update(ObservableMap map, bool mapIsRef) {
3387 _upgradeCollection(map, isolate); 3520 _upgradeCollection(map, isolate);
3388 super._update(map, mapIsRef); 3521 super._update(map, mapIsRef);
3389 3522
3390 dartOwner = map['_owner']; 3523 dartOwner = map['_owner'];
3391 selector = map['_selector']; 3524 selector = map['_selector'];
3392 if (mapIsRef) { 3525 if (mapIsRef) {
3393 return; 3526 return;
3394 } 3527 }
3395 argumentsDescriptor = map['_argumentsDescriptor']; 3528 argumentsDescriptor = map['_argumentsDescriptor'];
3396 entries = map['_entries']; 3529 entries = map['_entries'];
3397 } 3530 }
3398 } 3531 }
3399 3532
3400 class MegamorphicCache extends HeapObject { 3533 class MegamorphicCache extends HeapObject implements M.MegamorphicCacheRef {
3401 @observable int mask; 3534 @observable int mask;
3402 @observable Instance buckets; 3535 @observable Instance buckets;
3403 @observable String selector; 3536 @observable String selector;
3404 @observable Instance argumentsDescriptor; 3537 @observable Instance argumentsDescriptor;
3405 3538
3406 bool get immutable => false; 3539 bool get immutable => false;
3407 3540
3408 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner); 3541 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner);
3409 3542
3410 void _update(ObservableMap map, bool mapIsRef) { 3543 void _update(ObservableMap map, bool mapIsRef) {
3411 _upgradeCollection(map, isolate); 3544 _upgradeCollection(map, isolate);
3412 super._update(map, mapIsRef); 3545 super._update(map, mapIsRef);
3413 3546
3414 selector = map['_selector']; 3547 selector = map['_selector'];
3415 if (mapIsRef) { 3548 if (mapIsRef) {
3416 return; 3549 return;
3417 } 3550 }
3418 3551
3419 mask = map['_mask']; 3552 mask = map['_mask'];
3420 buckets = map['_buckets']; 3553 buckets = map['_buckets'];
3421 argumentsDescriptor = map['_argumentsDescriptor']; 3554 argumentsDescriptor = map['_argumentsDescriptor'];
3422 } 3555 }
3423 } 3556 }
3424 3557
3425 class Instructions extends HeapObject { 3558 class Instructions extends HeapObject implements M.InstructionsRef {
3426 bool get immutable => true; 3559 bool get immutable => true;
3427 3560
3428 @observable Code code; 3561 @observable Code code;
3429 @observable ObjectPool objectPool; 3562 @observable ObjectPool objectPool;
3430 3563
3431 Instructions._empty(ServiceObjectOwner owner) : super._empty(owner); 3564 Instructions._empty(ServiceObjectOwner owner) : super._empty(owner);
3432 3565
3433 void _update(ObservableMap map, bool mapIsRef) { 3566 void _update(ObservableMap map, bool mapIsRef) {
3434 _upgradeCollection(map, isolate); 3567 _upgradeCollection(map, isolate);
3435 super._update(map, mapIsRef); 3568 super._update(map, mapIsRef);
3436 3569
3437 code = map['_code']; 3570 code = map['_code'];
3438 if (mapIsRef) { 3571 if (mapIsRef) {
3439 return; 3572 return;
3440 } 3573 }
3441 objectPool = map['_objectPool']; 3574 objectPool = map['_objectPool'];
3442 } 3575 }
3443 } 3576 }
3444 3577
3445 class TokenStream extends HeapObject { 3578 class TokenStream extends HeapObject implements M.TokenStreamRef {
3446 bool get immutable => true; 3579 bool get immutable => true;
3447 3580
3448 @observable String privateKey; 3581 @observable String privateKey;
3449 3582
3450 TokenStream._empty(ServiceObjectOwner owner) : super._empty(owner); 3583 TokenStream._empty(ServiceObjectOwner owner) : super._empty(owner);
3451 3584
3452 void _update(ObservableMap map, bool mapIsRef) { 3585 void _update(ObservableMap map, bool mapIsRef) {
3453 _upgradeCollection(map, isolate); 3586 _upgradeCollection(map, isolate);
3454 super._update(map, mapIsRef); 3587 super._update(map, mapIsRef);
3455 3588
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 var v = list[i]; 4227 var v = list[i];
4095 if ((v is ObservableMap) && _isServiceMap(v)) { 4228 if ((v is ObservableMap) && _isServiceMap(v)) {
4096 list[i] = owner.getFromMap(v); 4229 list[i] = owner.getFromMap(v);
4097 } else if (v is ObservableList) { 4230 } else if (v is ObservableList) {
4098 _upgradeObservableList(v, owner); 4231 _upgradeObservableList(v, owner);
4099 } else if (v is ObservableMap) { 4232 } else if (v is ObservableMap) {
4100 _upgradeObservableMap(v, owner); 4233 _upgradeObservableMap(v, owner);
4101 } 4234 }
4102 } 4235 }
4103 } 4236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698