| 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 // 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 Loading... |
| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 break; | 249 break; |
| 250 case 'ObjectPool': | 250 case 'ObjectPool': |
| 251 obj = new ObjectPool._empty(owner); | 251 obj = new ObjectPool._empty(owner); |
| 252 break; | 252 break; |
| 253 case 'PcDescriptors': | 253 case 'PcDescriptors': |
| 254 obj = new PcDescriptors._empty(owner); | 254 obj = new PcDescriptors._empty(owner); |
| 255 break; | 255 break; |
| 256 case 'TokenStream': | 256 case 'TokenStream': |
| 257 obj = new TokenStream._empty(owner); | 257 obj = new TokenStream._empty(owner); |
| 258 break; | 258 break; |
| 259 default: |
| 260 obj = new UnknownObject._empty(owner); |
| 259 } | 261 } |
| 260 break; | 262 break; |
| 261 case 'Event': | 263 case 'Event': |
| 262 obj = new ServiceEvent._empty(owner); | 264 obj = new ServiceEvent._empty(owner); |
| 263 break; | 265 break; |
| 264 case 'Script': | 266 case 'Script': |
| 265 obj = new Script._empty(owner); | 267 obj = new Script._empty(owner); |
| 266 break; | 268 break; |
| 267 case 'Socket': | 269 case 'Socket': |
| 268 obj = new Socket._empty(owner); | 270 obj = new Socket._empty(owner); |
| 269 break; | 271 break; |
| 272 case 'Sentinel': |
| 273 obj = new Sentinel._empty(owner); |
| 274 break; |
| 270 case 'Instance': | 275 case 'Instance': |
| 271 case 'Sentinel': // TODO(rmacnak): Separate this out. | |
| 272 obj = new Instance._empty(owner); | 276 obj = new Instance._empty(owner); |
| 273 break; | 277 break; |
| 274 default: | 278 default: |
| 275 break; | 279 break; |
| 276 } | 280 } |
| 277 if (obj == null) { | 281 if (obj == null) { |
| 278 obj = new ServiceMap._empty(owner); | 282 obj = new ServiceMap._empty(owner); |
| 279 } | 283 } |
| 280 obj.update(map); | 284 obj.update(map); |
| 281 return obj; | 285 return obj; |
| (...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 } | 1866 } |
| 1863 Logger.root.severe('Unrecognized error kind: $value'); | 1867 Logger.root.severe('Unrecognized error kind: $value'); |
| 1864 throw new FallThroughError(); | 1868 throw new FallThroughError(); |
| 1865 } | 1869 } |
| 1866 | 1870 |
| 1867 /// A [DartError] is peered to a Dart Error object. | 1871 /// A [DartError] is peered to a Dart Error object. |
| 1868 class DartError extends ServiceObject implements M.Error { | 1872 class DartError extends ServiceObject implements M.Error { |
| 1869 DartError._empty(ServiceObject owner) : super._empty(owner); | 1873 DartError._empty(ServiceObject owner) : super._empty(owner); |
| 1870 | 1874 |
| 1871 M.ErrorKind kind; | 1875 M.ErrorKind kind; |
| 1876 final M.ClassRef clazz = null; |
| 1877 final int size = null; |
| 1872 @observable String message; | 1878 @observable String message; |
| 1873 @observable Instance exception; | 1879 @observable Instance exception; |
| 1874 @observable Instance stacktrace; | 1880 @observable Instance stacktrace; |
| 1875 | 1881 |
| 1876 void _update(ObservableMap map, bool mapIsRef) { | 1882 void _update(ObservableMap map, bool mapIsRef) { |
| 1877 message = map['message']; | 1883 message = map['message']; |
| 1878 kind = stringToErrorKind(map['kind']); | 1884 kind = stringToErrorKind(map['kind']); |
| 1879 exception = new ServiceObject._fromMap(owner, map['exception']); | 1885 exception = new ServiceObject._fromMap(owner, map['exception']); |
| 1880 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); | 1886 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); |
| 1881 name = 'DartError($message)'; | 1887 name = 'DartError($message)'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 } else { | 2058 } else { |
| 2053 return "ServiceEvent(owner='${ownerName}', kind='${kind}', " | 2059 return "ServiceEvent(owner='${ownerName}', kind='${kind}', " |
| 2054 "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})"; | 2060 "data.lengthInBytes=${data.lengthInBytes}, time=${timestamp})"; |
| 2055 } | 2061 } |
| 2056 } | 2062 } |
| 2057 } | 2063 } |
| 2058 | 2064 |
| 2059 class Breakpoint extends ServiceObject implements M.Breakpoint { | 2065 class Breakpoint extends ServiceObject implements M.Breakpoint { |
| 2060 Breakpoint._empty(ServiceObjectOwner owner) : super._empty(owner); | 2066 Breakpoint._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2061 | 2067 |
| 2068 final M.ClassRef clazz = null; |
| 2069 final int size = null; |
| 2070 |
| 2062 // TODO(turnidge): Add state to track if a breakpoint has been | 2071 // TODO(turnidge): Add state to track if a breakpoint has been |
| 2063 // removed from the program. Remove from the cache when deleted. | 2072 // removed from the program. Remove from the cache when deleted. |
| 2064 bool get immutable => false; | 2073 bool get immutable => false; |
| 2065 | 2074 |
| 2066 // A unique integer identifier for this breakpoint. | 2075 // A unique integer identifier for this breakpoint. |
| 2067 @observable int number; | 2076 @observable int number; |
| 2068 | 2077 |
| 2069 // Either SourceLocation or UnresolvedSourceLocation. | 2078 // Either SourceLocation or UnresolvedSourceLocation. |
| 2070 @observable Location location; | 2079 @observable Location location; |
| 2071 | 2080 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 | 2392 |
| 2384 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { | 2393 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { |
| 2385 var params = { 'tags': tags, | 2394 var params = { 'tags': tags, |
| 2386 'classId': id }; | 2395 'classId': id }; |
| 2387 return isolate.invokeRpc('_getAllocationSamples', params); | 2396 return isolate.invokeRpc('_getAllocationSamples', params); |
| 2388 } | 2397 } |
| 2389 | 2398 |
| 2390 String toString() => 'Class($vmName)'; | 2399 String toString() => 'Class($vmName)'; |
| 2391 } | 2400 } |
| 2392 | 2401 |
| 2402 M.InstanceKind stringToInstanceKind(String s) { |
| 2403 switch (s) { |
| 2404 case 'PlainInstance': |
| 2405 return M.InstanceKind.plainInstance; |
| 2406 case 'Null': |
| 2407 return M.InstanceKind.vNull; |
| 2408 case 'Bool': |
| 2409 return M.InstanceKind.bool; |
| 2410 case 'Double': |
| 2411 return M.InstanceKind.double; |
| 2412 case 'Int': |
| 2413 return M.InstanceKind.int; |
| 2414 case 'String': |
| 2415 return M.InstanceKind.string; |
| 2416 case 'List': |
| 2417 return M.InstanceKind.list; |
| 2418 case 'Map': |
| 2419 return M.InstanceKind.map; |
| 2420 case 'Float32x4': |
| 2421 return M.InstanceKind.float32x4; |
| 2422 case 'Float64x2': |
| 2423 return M.InstanceKind.float64x2; |
| 2424 case 'Int32x4': |
| 2425 return M.InstanceKind.int32x4; |
| 2426 case 'Uint8ClampedList': |
| 2427 return M.InstanceKind.uint8ClampedList; |
| 2428 case 'Uint8List': |
| 2429 return M.InstanceKind.uint8List; |
| 2430 case 'Uint16List': |
| 2431 return M.InstanceKind.uint16List; |
| 2432 case 'Uint32List': |
| 2433 return M.InstanceKind.uint32List; |
| 2434 case 'Uint64List': |
| 2435 return M.InstanceKind.uint64List; |
| 2436 case 'Int8List': |
| 2437 return M.InstanceKind.int8List; |
| 2438 case 'Int16List': |
| 2439 return M.InstanceKind.int16List; |
| 2440 case 'Int32List': |
| 2441 return M.InstanceKind.int32List; |
| 2442 case 'Int64List': |
| 2443 return M.InstanceKind.int64List; |
| 2444 case 'Float32List': |
| 2445 return M.InstanceKind.float32List; |
| 2446 case 'Float64List': |
| 2447 return M.InstanceKind.float64List; |
| 2448 case 'Int32x4List': |
| 2449 return M.InstanceKind.int32x4List; |
| 2450 case 'Float32x4List': |
| 2451 return M.InstanceKind.float32x4List; |
| 2452 case 'Float64x2List': |
| 2453 return M.InstanceKind.float64x2List; |
| 2454 case 'StackTrace': |
| 2455 return M.InstanceKind.stackTrace; |
| 2456 case 'Closure': |
| 2457 return M.InstanceKind.closure; |
| 2458 case 'MirrorReference': |
| 2459 return M.InstanceKind.mirrorReference; |
| 2460 case 'RegExp': |
| 2461 return M.InstanceKind.regExp; |
| 2462 case 'WeakProperty': |
| 2463 return M.InstanceKind.weakProperty; |
| 2464 case 'Type': |
| 2465 return M.InstanceKind.type; |
| 2466 case 'TypeParameter': |
| 2467 return M.InstanceKind.typeParameter; |
| 2468 case 'TypeRef': |
| 2469 return M.InstanceKind.typeRef; |
| 2470 case 'BoundedType': |
| 2471 return M.InstanceKind.boundedType; |
| 2472 } |
| 2473 Logger.root.severe("Unrecognized InstanceKind: '$s'"); |
| 2474 throw new FallThroughError(); |
| 2475 } |
| 2476 |
| 2477 class Guarded<T> implements M.Guarded<T> { |
| 2478 bool get isValue => asValue != null; |
| 2479 bool get isSentinel => asSentinel != null; |
| 2480 final Sentinel asSentinel; |
| 2481 final T asValue; |
| 2482 |
| 2483 factory Guarded(ServiceObject obj) { |
| 2484 if (obj is Sentinel) { |
| 2485 return new Guarded.fromSentinel(obj); |
| 2486 } else if (obj is T) { |
| 2487 return new Guarded.fromValue(obj); |
| 2488 } |
| 2489 throw new Exception('${obj.type} is neither Sentinel or $T'); |
| 2490 } |
| 2491 |
| 2492 Guarded.fromSentinel(this.asSentinel) |
| 2493 : asValue = null; |
| 2494 Guarded.fromValue(this.asValue) |
| 2495 : asSentinel = null; |
| 2496 } |
| 2497 |
| 2498 class BoundField implements M.BoundField { |
| 2499 final Field decl; |
| 2500 final Guarded<Instance> value; |
| 2501 BoundField(this.decl, value) |
| 2502 : value = new Guarded(value); |
| 2503 } |
| 2504 |
| 2505 class MapAssociation implements M.MapAssociation { |
| 2506 final Guarded<Instance> key; |
| 2507 final Guarded<Instance> value; |
| 2508 MapAssociation(key, value) |
| 2509 : key = new Guarded(key), |
| 2510 value = new Guarded(value); |
| 2511 } |
| 2512 |
| 2393 class Instance extends HeapObject implements M.Instance { | 2513 class Instance extends HeapObject implements M.Instance { |
| 2394 @observable String kind; | 2514 @observable M.InstanceKind kind; |
| 2395 @observable String valueAsString; // If primitive. | 2515 @observable String valueAsString; // If primitive. |
| 2396 @observable bool valueAsStringIsTruncated; | 2516 @observable bool valueAsStringIsTruncated; |
| 2397 @observable ServiceFunction function; // If a closure. | 2517 @observable ServiceFunction closureFunction; // If a closure. |
| 2398 @observable Context context; // If a closure. | 2518 @observable Context context; // If a closure. |
| 2399 @observable int length; // If a List, Map or TypedData. | 2519 @observable int length; // If a List, Map or TypedData. |
| 2520 int count; |
| 2521 int offset; |
| 2400 @observable Instance pattern; // If a RegExp. | 2522 @observable Instance pattern; // If a RegExp. |
| 2401 | 2523 |
| 2402 @observable String name; | 2524 @observable String name; |
| 2403 @observable Class typeClass; | 2525 @observable Class typeClass; |
| 2404 @observable Class parameterizedClass; | 2526 @observable Class parameterizedClass; |
| 2405 @observable ServiceObject typeArguments; | 2527 @observable ServiceObject typeArguments; |
| 2406 @observable int parameterIndex; | 2528 @observable int parameterIndex; |
| 2407 @observable Instance targetType; | 2529 @observable Instance targetType; |
| 2408 @observable Instance bound; | 2530 @observable Instance bound; |
| 2409 | 2531 |
| 2410 @observable var fields; | 2532 @observable Iterable<BoundField> fields; |
| 2411 @observable var nativeFields; | 2533 @observable var nativeFields; |
| 2412 @observable var elements; // If a List. | 2534 @observable Iterable<Guarded<ServiceObject>> elements; // If a List. |
| 2413 @observable var associations; // If a Map. | 2535 @observable Iterable<MapAssociation> associations; // If a Map. |
| 2414 @observable var typedElements; // If a TypedData. | 2536 @observable Iterable<dynamic> typedElements; // If a TypedData. |
| 2415 @observable var referent; // If a MirrorReference. | 2537 @observable Instance referent; // If a MirrorReference. |
| 2416 @observable Instance key; // If a WeakProperty. | 2538 @observable Instance key; // If a WeakProperty. |
| 2417 @observable Instance value; // If a WeakProperty. | 2539 @observable Instance value; // If a WeakProperty. |
| 2418 @observable Breakpoint activationBreakpoint; // If a Closure. | 2540 @observable Breakpoint activationBreakpoint; // If a Closure. |
| 2419 @observable ServiceFunction oneByteFunction; // If a RegExp. | 2541 @observable ServiceFunction oneByteFunction; // If a RegExp. |
| 2420 @observable ServiceFunction twoByteFunction; // If a RegExp. | 2542 @observable ServiceFunction twoByteFunction; // If a RegExp. |
| 2421 @observable ServiceFunction externalOneByteFunction; // If a RegExp. | 2543 @observable ServiceFunction externalOneByteFunction; // If a RegExp. |
| 2422 @observable ServiceFunction externalTwoByteFunction; // If a RegExp. | 2544 @observable ServiceFunction externalTwoByteFunction; // If a RegExp. |
| 2423 @observable Instance oneByteBytecode; // If a RegExp. | 2545 @observable Instance oneByteBytecode; // If a RegExp. |
| 2424 @observable Instance twoByteBytecode; // If a RegExp. | 2546 @observable Instance twoByteBytecode; // If a RegExp. |
| 2425 @observable bool isCaseSensitive; // If a RegExp. | 2547 @observable bool isCaseSensitive; // If a RegExp. |
| 2426 @observable bool isMultiLine; // If a RegExp. | 2548 @observable bool isMultiLine; // If a RegExp. |
| 2427 | 2549 |
| 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 { | 2550 bool get isStackOverflowError { |
| 2466 if (clazz == null) { | 2551 if (clazz == null) { |
| 2467 return false; | 2552 return false; |
| 2468 } | 2553 } |
| 2469 if (clazz.library == null) { | 2554 if (clazz.library == null) { |
| 2470 return false; | 2555 return false; |
| 2471 } | 2556 } |
| 2472 return (clazz.name == 'StackOverflowError') && clazz.library.isDart('core'); | 2557 return (clazz.name == 'StackOverflowError') && clazz.library.isDart('core'); |
| 2473 } | 2558 } |
| 2474 | 2559 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2486 // instance kinds are added? | 2571 // instance kinds are added? |
| 2487 bool get isPlainInstance => kind == 'PlainInstance'; | 2572 bool get isPlainInstance => kind == 'PlainInstance'; |
| 2488 | 2573 |
| 2489 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); | 2574 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2490 | 2575 |
| 2491 void _update(ObservableMap map, bool mapIsRef) { | 2576 void _update(ObservableMap map, bool mapIsRef) { |
| 2492 // Extract full properties.1 | 2577 // Extract full properties.1 |
| 2493 _upgradeCollection(map, isolate); | 2578 _upgradeCollection(map, isolate); |
| 2494 super._update(map, mapIsRef); | 2579 super._update(map, mapIsRef); |
| 2495 | 2580 |
| 2496 kind = map['kind']; | 2581 kind = stringToInstanceKind(map['kind']); |
| 2497 valueAsString = map['valueAsString']; | 2582 valueAsString = map['valueAsString']; |
| 2498 // Coerce absence to false. | 2583 // Coerce absence to false. |
| 2499 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true; | 2584 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true; |
| 2500 function = map['closureFunction']; | 2585 closureFunction = map['closureFunction']; |
| 2501 context = map['closureContext']; | 2586 context = map['closureContext']; |
| 2502 name = map['name']; | 2587 name = map['name']; |
| 2503 length = map['length']; | 2588 length = map['length']; |
| 2504 pattern = map['pattern']; | 2589 pattern = map['pattern']; |
| 2505 typeClass = map['typeClass']; | 2590 typeClass = map['typeClass']; |
| 2506 | 2591 |
| 2507 if (mapIsRef) { | 2592 if (mapIsRef) { |
| 2508 return; | 2593 return; |
| 2509 } | 2594 } |
| 2510 | 2595 |
| 2596 count = map['count']; |
| 2597 offset = map['offset']; |
| 2511 isCaseSensitive = map['isCaseSensitive']; | 2598 isCaseSensitive = map['isCaseSensitive']; |
| 2512 isMultiLine = map['isMultiLine']; | 2599 isMultiLine = map['isMultiLine']; |
| 2513 bool isCompiled = map['_oneByteFunction'] is ServiceFunction; | 2600 bool isCompiled = map['_oneByteFunction'] is ServiceFunction; |
| 2514 oneByteFunction = isCompiled ? map['_oneByteFunction'] : null; | 2601 oneByteFunction = isCompiled ? map['_oneByteFunction'] : null; |
| 2515 twoByteFunction = isCompiled ? map['_twoByteFunction'] : null; | 2602 twoByteFunction = isCompiled ? map['_twoByteFunction'] : null; |
| 2516 externalOneByteFunction = isCompiled ? map['_externalOneByteFunction'] : nul
l; | 2603 externalOneByteFunction = isCompiled ? map['_externalOneByteFunction'] : nul
l; |
| 2517 externalTwoByteFunction = isCompiled ? map['_externalTwoByteFunction'] : nul
l; | 2604 externalTwoByteFunction = isCompiled ? map['_externalTwoByteFunction'] : nul
l; |
| 2518 oneByteBytecode = map['_oneByteBytecode']; | 2605 oneByteBytecode = map['_oneByteBytecode']; |
| 2519 twoByteBytecode = map['_twoByteBytecode']; | 2606 twoByteBytecode = map['_twoByteBytecode']; |
| 2520 | 2607 |
| 2521 nativeFields = map['_nativeFields']; | 2608 nativeFields = map['_nativeFields']; |
| 2522 fields = map['fields']; | 2609 if (map['fields'] != null) { |
| 2523 elements = map['elements']; | 2610 fields = map['fields'] |
| 2524 associations = map['associations']; | 2611 .map((f) => new BoundField(f['decl'], f['value'])).toList(); |
| 2612 } |
| 2613 if (map['elements'] != null) { |
| 2614 // Should be: |
| 2615 // elements = map['elements'].map((e) => new Guarded<Instance>(e)).toList(); |
| 2616 // some times we obtain object that are not InstanceRef |
| 2617 elements = map['elements'].map((e) => new Guarded<ServiceObject>(e)) |
| 2618 .toList(); |
| 2619 } |
| 2620 if (map['associations'] != null) { |
| 2621 associations = map['associations'].map((a) => |
| 2622 new MapAssociation(a['key'], a['value'])).toList(); |
| 2623 }; |
| 2525 if (map['bytes'] != null) { | 2624 if (map['bytes'] != null) { |
| 2526 Uint8List bytes = BASE64.decode(map['bytes']); | 2625 Uint8List bytes = BASE64.decode(map['bytes']); |
| 2527 switch (map['kind']) { | 2626 switch (map['kind']) { |
| 2528 case "Uint8ClampedList": | 2627 case "Uint8ClampedList": |
| 2529 typedElements = bytes.buffer.asUint8ClampedList(); break; | 2628 typedElements = bytes.buffer.asUint8ClampedList(); break; |
| 2530 case "Uint8List": | 2629 case "Uint8List": |
| 2531 typedElements = bytes.buffer.asUint8List(); break; | 2630 typedElements = bytes.buffer.asUint8List(); break; |
| 2532 case "Uint16List": | 2631 case "Uint16List": |
| 2533 typedElements = bytes.buffer.asUint16List(); break; | 2632 typedElements = bytes.buffer.asUint16List(); break; |
| 2534 case "Uint32List": | 2633 case "Uint32List": |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2565 key = map['propertyKey']; | 2664 key = map['propertyKey']; |
| 2566 value = map['propertyValue']; | 2665 value = map['propertyValue']; |
| 2567 activationBreakpoint = map['_activationBreakpoint']; | 2666 activationBreakpoint = map['_activationBreakpoint']; |
| 2568 | 2667 |
| 2569 // We are fully loaded. | 2668 // We are fully loaded. |
| 2570 _loaded = true; | 2669 _loaded = true; |
| 2571 } | 2670 } |
| 2572 | 2671 |
| 2573 String get shortName { | 2672 String get shortName { |
| 2574 if (isClosure) { | 2673 if (isClosure) { |
| 2575 return function.qualifiedName; | 2674 return closureFunction.qualifiedName; |
| 2576 } | 2675 } |
| 2577 if (valueAsString != null) { | 2676 if (valueAsString != null) { |
| 2578 return valueAsString; | 2677 return valueAsString; |
| 2579 } | 2678 } |
| 2580 return 'a ${clazz.name}'; | 2679 return 'a ${clazz.name}'; |
| 2581 } | 2680 } |
| 2582 | 2681 |
| 2583 Future<ServiceObject> evaluate(String expression) { | 2682 Future<ServiceObject> evaluate(String expression) { |
| 2584 return isolate._eval(this, expression); | 2683 return isolate._eval(this, expression); |
| 2585 } | 2684 } |
| 2586 | 2685 |
| 2587 String toString() => 'Instance($shortName)'; | 2686 String toString() => 'Instance($shortName)'; |
| 2588 } | 2687 } |
| 2589 | 2688 |
| 2590 | 2689 |
| 2591 class Context extends HeapObject { | 2690 class Context extends HeapObject implements M.Context { |
| 2592 @observable var parentContext; | 2691 @observable Context parentContext; |
| 2593 @observable int length; | 2692 @observable int length; |
| 2594 @observable var variables; | 2693 @observable var variables; |
| 2595 | 2694 |
| 2596 Context._empty(ServiceObjectOwner owner) : super._empty(owner); | 2695 Context._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2597 | 2696 |
| 2598 void _update(ObservableMap map, bool mapIsRef) { | 2697 void _update(ObservableMap map, bool mapIsRef) { |
| 2599 // Extract full properties. | 2698 // Extract full properties. |
| 2600 _upgradeCollection(map, isolate); | 2699 _upgradeCollection(map, isolate); |
| 2601 super._update(map, mapIsRef); | 2700 super._update(map, mapIsRef); |
| 2602 | 2701 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2719 | 2818 |
| 2720 ServiceFunction get homeMethod { | 2819 ServiceFunction get homeMethod { |
| 2721 var m = this; | 2820 var m = this; |
| 2722 while (m.dartOwner is ServiceFunction) { | 2821 while (m.dartOwner is ServiceFunction) { |
| 2723 m = m.dartOwner; | 2822 m = m.dartOwner; |
| 2724 } | 2823 } |
| 2725 return m; | 2824 return m; |
| 2726 } | 2825 } |
| 2727 } | 2826 } |
| 2728 | 2827 |
| 2828 M.SentinelKind stringToSentinelKind(String s) { |
| 2829 switch (s) { |
| 2830 case 'Collected': |
| 2831 return M.SentinelKind.collected; |
| 2832 case 'Expired': |
| 2833 return M.SentinelKind.expired; |
| 2834 case 'NotInitialized': |
| 2835 return M.SentinelKind.notInitialized; |
| 2836 case 'BeingInitialized': |
| 2837 return M.SentinelKind.initializing; |
| 2838 case 'OptimizedOut': |
| 2839 return M.SentinelKind.optimizedOut; |
| 2840 case 'Free': |
| 2841 return M.SentinelKind.free; |
| 2842 } |
| 2843 Logger.root.severe("Unrecognized SentinelKind: '$s'"); |
| 2844 throw new FallThroughError(); |
| 2845 } |
| 2729 | 2846 |
| 2730 class Field extends HeapObject { | 2847 class Sentinel extends ServiceObject implements M.Sentinel { |
| 2848 |
| 2849 M.SentinelKind kind; |
| 2850 String valueAsString; |
| 2851 |
| 2852 Sentinel._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2853 |
| 2854 void _update(ObservableMap map, bool mapIsRef) { |
| 2855 // Extract full properties. |
| 2856 _upgradeCollection(map, isolate); |
| 2857 |
| 2858 kind = stringToSentinelKind(map['kind']); |
| 2859 valueAsString = map['valueAsString']; |
| 2860 _loaded = true; |
| 2861 } |
| 2862 |
| 2863 String toString() => 'Sentinel($kind)'; |
| 2864 } |
| 2865 |
| 2866 class Field extends HeapObject implements M.FieldRef { |
| 2731 // Library or Class. | 2867 // Library or Class. |
| 2732 @observable ServiceObject dartOwner; | 2868 @observable ServiceObject dartOwner; |
| 2733 @observable Library library; | 2869 @observable Library library; |
| 2734 @observable Instance declaredType; | 2870 @observable Instance declaredType; |
| 2735 @observable bool isStatic; | 2871 @observable bool isStatic; |
| 2736 @observable bool isFinal; | 2872 @observable bool isFinal; |
| 2737 @observable bool isConst; | 2873 @observable bool isConst; |
| 2738 @observable Instance staticValue; | 2874 @observable Instance staticValue; |
| 2739 @observable String name; | 2875 @observable String name; |
| 2740 @observable String vmName; | 2876 @observable String vmName; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3275 var line = script.tokenToLine(tokenPos); | 3411 var line = script.tokenToLine(tokenPos); |
| 3276 if (line == null) { | 3412 if (line == null) { |
| 3277 return; | 3413 return; |
| 3278 } | 3414 } |
| 3279 this.script = script; | 3415 this.script = script; |
| 3280 var scriptLine = script.getLine(line); | 3416 var scriptLine = script.getLine(line); |
| 3281 formattedLine = scriptLine.text; | 3417 formattedLine = scriptLine.text; |
| 3282 } | 3418 } |
| 3283 } | 3419 } |
| 3284 | 3420 |
| 3285 class PcDescriptors extends ServiceObject { | 3421 class PcDescriptors extends ServiceObject implements M.PcDescriptorsRef { |
| 3286 @observable Class clazz; | 3422 @observable Class clazz; |
| 3287 @observable int size; | 3423 @observable int size; |
| 3288 bool get immutable => true; | 3424 bool get immutable => true; |
| 3289 @reflectable final List<PcDescriptor> descriptors = | 3425 @reflectable final List<PcDescriptor> descriptors = |
| 3290 new ObservableList<PcDescriptor>(); | 3426 new ObservableList<PcDescriptor>(); |
| 3291 | 3427 |
| 3292 PcDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner) { | 3428 PcDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner) { |
| 3293 } | 3429 } |
| 3294 | 3430 |
| 3295 void _update(ObservableMap m, bool mapIsRef) { | 3431 void _update(ObservableMap m, bool mapIsRef) { |
| 3296 if (mapIsRef) { | 3432 if (mapIsRef) { |
| 3297 return; | 3433 return; |
| 3298 } | 3434 } |
| 3299 _upgradeCollection(m, isolate); | 3435 _upgradeCollection(m, isolate); |
| 3300 clazz = m['class']; | 3436 clazz = m['class']; |
| 3301 size = m['size']; | 3437 size = m['size']; |
| 3302 descriptors.clear(); | 3438 descriptors.clear(); |
| 3303 for (var descriptor in m['members']) { | 3439 for (var descriptor in m['members']) { |
| 3304 var pcOffset = int.parse(descriptor['pcOffset'], radix:16); | 3440 var pcOffset = int.parse(descriptor['pcOffset'], radix:16); |
| 3305 var deoptId = descriptor['deoptId']; | 3441 var deoptId = descriptor['deoptId']; |
| 3306 var tokenPos = descriptor['tokenPos']; | 3442 var tokenPos = descriptor['tokenPos']; |
| 3307 var tryIndex = descriptor['tryIndex']; | 3443 var tryIndex = descriptor['tryIndex']; |
| 3308 var kind = descriptor['kind'].trim(); | 3444 var kind = descriptor['kind'].trim(); |
| 3309 descriptors.add( | 3445 descriptors.add( |
| 3310 new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind)); | 3446 new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind)); |
| 3311 } | 3447 } |
| 3312 } | 3448 } |
| 3313 } | 3449 } |
| 3314 | 3450 |
| 3315 class LocalVarDescriptor extends Observable { | 3451 class LocalVarDescriptor extends Observable |
| 3452 implements M.LocalVarDescriptorsRef { |
| 3453 @reflectable final String id; |
| 3316 @reflectable final String name; | 3454 @reflectable final String name; |
| 3317 @reflectable final int index; | 3455 @reflectable final int index; |
| 3318 @reflectable final int beginPos; | 3456 @reflectable final int beginPos; |
| 3319 @reflectable final int endPos; | 3457 @reflectable final int endPos; |
| 3320 @reflectable final int scopeId; | 3458 @reflectable final int scopeId; |
| 3321 @reflectable final String kind; | 3459 @reflectable final String kind; |
| 3322 | 3460 |
| 3323 LocalVarDescriptor(this.name, this.index, this.beginPos, this.endPos, | 3461 LocalVarDescriptor(this.id, this.name, this.index, this.beginPos, this.endPos, |
| 3324 this.scopeId, this.kind); | 3462 this.scopeId, this.kind); |
| 3325 } | 3463 } |
| 3326 | 3464 |
| 3327 class LocalVarDescriptors extends ServiceObject { | 3465 class LocalVarDescriptors extends ServiceObject { |
| 3328 @observable Class clazz; | 3466 @observable Class clazz; |
| 3329 @observable int size; | 3467 @observable int size; |
| 3330 bool get immutable => true; | 3468 bool get immutable => true; |
| 3331 @reflectable final List<LocalVarDescriptor> descriptors = | 3469 @reflectable final List<LocalVarDescriptor> descriptors = |
| 3332 new ObservableList<LocalVarDescriptor>(); | 3470 new ObservableList<LocalVarDescriptor>(); |
| 3333 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner); | 3471 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3334 | 3472 |
| 3335 void _update(ObservableMap m, bool mapIsRef) { | 3473 void _update(ObservableMap m, bool mapIsRef) { |
| 3336 if (mapIsRef) { | 3474 if (mapIsRef) { |
| 3337 return; | 3475 return; |
| 3338 } | 3476 } |
| 3339 _upgradeCollection(m, isolate); | 3477 _upgradeCollection(m, isolate); |
| 3340 clazz = m['class']; | 3478 clazz = m['class']; |
| 3341 size = m['size']; | 3479 size = m['size']; |
| 3342 descriptors.clear(); | 3480 descriptors.clear(); |
| 3343 for (var descriptor in m['members']) { | 3481 for (var descriptor in m['members']) { |
| 3482 var id = descriptor['name']; |
| 3344 var name = descriptor['name']; | 3483 var name = descriptor['name']; |
| 3345 var index = descriptor['index']; | 3484 var index = descriptor['index']; |
| 3346 var beginPos = descriptor['beginPos']; | 3485 var beginPos = descriptor['beginPos']; |
| 3347 var endPos = descriptor['endPos']; | 3486 var endPos = descriptor['endPos']; |
| 3348 var scopeId = descriptor['scopeId']; | 3487 var scopeId = descriptor['scopeId']; |
| 3349 var kind = descriptor['kind'].trim(); | 3488 var kind = descriptor['kind'].trim(); |
| 3350 descriptors.add( | 3489 descriptors.add( |
| 3351 new LocalVarDescriptor(name, index, beginPos, endPos, scopeId, kind)); | 3490 new LocalVarDescriptor(id, name, index, beginPos, endPos, scopeId, |
| 3491 kind)); |
| 3352 } | 3492 } |
| 3353 } | 3493 } |
| 3354 } | 3494 } |
| 3355 | 3495 |
| 3356 class ObjectPool extends HeapObject { | 3496 class ObjectPool extends HeapObject implements M.ObjectPoolRef { |
| 3357 bool get immutable => false; | 3497 bool get immutable => false; |
| 3358 | 3498 |
| 3359 @observable int length; | 3499 @observable int length; |
| 3360 @observable List entries; | 3500 @observable List entries; |
| 3361 | 3501 |
| 3362 ObjectPool._empty(ServiceObjectOwner owner) : super._empty(owner); | 3502 ObjectPool._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3363 | 3503 |
| 3364 void _update(ObservableMap map, bool mapIsRef) { | 3504 void _update(ObservableMap map, bool mapIsRef) { |
| 3365 _upgradeCollection(map, isolate); | 3505 _upgradeCollection(map, isolate); |
| 3366 super._update(map, mapIsRef); | 3506 super._update(map, mapIsRef); |
| 3367 | 3507 |
| 3368 length = map['length']; | 3508 length = map['length']; |
| 3369 if (mapIsRef) { | 3509 if (mapIsRef) { |
| 3370 return; | 3510 return; |
| 3371 } | 3511 } |
| 3372 entries = map['_entries']; | 3512 entries = map['_entries']; |
| 3373 } | 3513 } |
| 3374 } | 3514 } |
| 3375 | 3515 |
| 3376 class ICData extends HeapObject { | 3516 class ICData extends HeapObject implements M.ICDataRef { |
| 3377 @observable ServiceObject dartOwner; | 3517 @observable ServiceObject dartOwner; |
| 3378 @observable String selector; | 3518 @observable String selector; |
| 3379 @observable Instance argumentsDescriptor; | 3519 @observable Instance argumentsDescriptor; |
| 3380 @observable Instance entries; | 3520 @observable Instance entries; |
| 3381 | 3521 |
| 3382 bool get immutable => false; | 3522 bool get immutable => false; |
| 3383 | 3523 |
| 3384 ICData._empty(ServiceObjectOwner owner) : super._empty(owner); | 3524 ICData._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3385 | 3525 |
| 3386 void _update(ObservableMap map, bool mapIsRef) { | 3526 void _update(ObservableMap map, bool mapIsRef) { |
| 3387 _upgradeCollection(map, isolate); | 3527 _upgradeCollection(map, isolate); |
| 3388 super._update(map, mapIsRef); | 3528 super._update(map, mapIsRef); |
| 3389 | 3529 |
| 3390 dartOwner = map['_owner']; | 3530 dartOwner = map['_owner']; |
| 3391 selector = map['_selector']; | 3531 selector = map['_selector']; |
| 3392 if (mapIsRef) { | 3532 if (mapIsRef) { |
| 3393 return; | 3533 return; |
| 3394 } | 3534 } |
| 3395 argumentsDescriptor = map['_argumentsDescriptor']; | 3535 argumentsDescriptor = map['_argumentsDescriptor']; |
| 3396 entries = map['_entries']; | 3536 entries = map['_entries']; |
| 3397 } | 3537 } |
| 3398 } | 3538 } |
| 3399 | 3539 |
| 3400 class MegamorphicCache extends HeapObject { | 3540 class MegamorphicCache extends HeapObject implements M.MegamorphicCacheRef { |
| 3401 @observable int mask; | 3541 @observable int mask; |
| 3402 @observable Instance buckets; | 3542 @observable Instance buckets; |
| 3403 @observable String selector; | 3543 @observable String selector; |
| 3404 @observable Instance argumentsDescriptor; | 3544 @observable Instance argumentsDescriptor; |
| 3405 | 3545 |
| 3406 bool get immutable => false; | 3546 bool get immutable => false; |
| 3407 | 3547 |
| 3408 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner); | 3548 MegamorphicCache._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3409 | 3549 |
| 3410 void _update(ObservableMap map, bool mapIsRef) { | 3550 void _update(ObservableMap map, bool mapIsRef) { |
| 3411 _upgradeCollection(map, isolate); | 3551 _upgradeCollection(map, isolate); |
| 3412 super._update(map, mapIsRef); | 3552 super._update(map, mapIsRef); |
| 3413 | 3553 |
| 3414 selector = map['_selector']; | 3554 selector = map['_selector']; |
| 3415 if (mapIsRef) { | 3555 if (mapIsRef) { |
| 3416 return; | 3556 return; |
| 3417 } | 3557 } |
| 3418 | 3558 |
| 3419 mask = map['_mask']; | 3559 mask = map['_mask']; |
| 3420 buckets = map['_buckets']; | 3560 buckets = map['_buckets']; |
| 3421 argumentsDescriptor = map['_argumentsDescriptor']; | 3561 argumentsDescriptor = map['_argumentsDescriptor']; |
| 3422 } | 3562 } |
| 3423 } | 3563 } |
| 3424 | 3564 |
| 3425 class Instructions extends HeapObject { | 3565 class Instructions extends HeapObject implements M.InstructionsRef { |
| 3426 bool get immutable => true; | 3566 bool get immutable => true; |
| 3427 | 3567 |
| 3428 @observable Code code; | 3568 @observable Code code; |
| 3429 @observable ObjectPool objectPool; | 3569 @observable ObjectPool objectPool; |
| 3430 | 3570 |
| 3431 Instructions._empty(ServiceObjectOwner owner) : super._empty(owner); | 3571 Instructions._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3432 | 3572 |
| 3433 void _update(ObservableMap map, bool mapIsRef) { | 3573 void _update(ObservableMap map, bool mapIsRef) { |
| 3434 _upgradeCollection(map, isolate); | 3574 _upgradeCollection(map, isolate); |
| 3435 super._update(map, mapIsRef); | 3575 super._update(map, mapIsRef); |
| 3436 | 3576 |
| 3437 code = map['_code']; | 3577 code = map['_code']; |
| 3438 if (mapIsRef) { | 3578 if (mapIsRef) { |
| 3439 return; | 3579 return; |
| 3440 } | 3580 } |
| 3441 objectPool = map['_objectPool']; | 3581 objectPool = map['_objectPool']; |
| 3442 } | 3582 } |
| 3443 } | 3583 } |
| 3444 | 3584 |
| 3445 class TokenStream extends HeapObject { | 3585 class UnknownObject extends HeapObject implements M.UnknownObjectRef { |
| 3586 bool get immutable => true; |
| 3587 |
| 3588 UnknownObject._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3589 |
| 3590 void _update(ObservableMap map, bool mapIsRef) { |
| 3591 _upgradeCollection(map, isolate); |
| 3592 super._update(map, mapIsRef); |
| 3593 |
| 3594 if (mapIsRef) { |
| 3595 return; |
| 3596 } |
| 3597 } |
| 3598 } |
| 3599 |
| 3600 class TokenStream extends HeapObject implements M.TokenStreamRef { |
| 3446 bool get immutable => true; | 3601 bool get immutable => true; |
| 3447 | 3602 |
| 3448 @observable String privateKey; | 3603 @observable String privateKey; |
| 3449 | 3604 |
| 3450 TokenStream._empty(ServiceObjectOwner owner) : super._empty(owner); | 3605 TokenStream._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 3451 | 3606 |
| 3452 void _update(ObservableMap map, bool mapIsRef) { | 3607 void _update(ObservableMap map, bool mapIsRef) { |
| 3453 _upgradeCollection(map, isolate); | 3608 _upgradeCollection(map, isolate); |
| 3454 super._update(map, mapIsRef); | 3609 super._update(map, mapIsRef); |
| 3455 | 3610 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 var v = list[i]; | 4249 var v = list[i]; |
| 4095 if ((v is ObservableMap) && _isServiceMap(v)) { | 4250 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 4096 list[i] = owner.getFromMap(v); | 4251 list[i] = owner.getFromMap(v); |
| 4097 } else if (v is ObservableList) { | 4252 } else if (v is ObservableList) { |
| 4098 _upgradeObservableList(v, owner); | 4253 _upgradeObservableList(v, owner); |
| 4099 } else if (v is ObservableMap) { | 4254 } else if (v is ObservableMap) { |
| 4100 _upgradeObservableMap(v, owner); | 4255 _upgradeObservableMap(v, owner); |
| 4101 } | 4256 } |
| 4102 } | 4257 } |
| 4103 } | 4258 } |
| OLD | NEW |