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 /// A [ServiceObject] represents a persistent object within the vm. | 7 /// A [ServiceObject] represents a persistent object within the vm. |
8 abstract class ServiceObject extends Observable { | 8 abstract class ServiceObject extends Observable { |
9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
10 return o1.name.compareTo(o2.name); | 10 return o1.name.compareTo(o2.name); |
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 | 1797 |
1798 String toString() => 'Context($length)'; | 1798 String toString() => 'Context($length)'; |
1799 } | 1799 } |
1800 | 1800 |
1801 | 1801 |
1802 // TODO(koda): Sync this with VM. | 1802 // TODO(koda): Sync this with VM. |
1803 class FunctionKind { | 1803 class FunctionKind { |
1804 final String _strValue; | 1804 final String _strValue; |
1805 FunctionKind._internal(this._strValue); | 1805 FunctionKind._internal(this._strValue); |
1806 toString() => _strValue; | 1806 toString() => _strValue; |
1807 bool isSynthetic() => [kCollected, kNative, kTag, kReused].contains(this); | 1807 bool isSynthetic() => [kCollected, kNative, kStub, kTag].contains(this); |
1808 | 1808 bool isDart() => !isSynthetic(); |
| 1809 bool isStub() => (this == kStub); |
| 1810 bool hasDartCode() => isDart() || isStub(); |
1809 static FunctionKind fromJSON(String value) { | 1811 static FunctionKind fromJSON(String value) { |
1810 switch(value) { | 1812 switch(value) { |
1811 case 'kRegularFunction': return kRegularFunction; | 1813 case 'kRegularFunction': return kRegularFunction; |
1812 case 'kClosureFunction': return kClosureFunction; | 1814 case 'kClosureFunction': return kClosureFunction; |
1813 case 'kGetterFunction': return kGetterFunction; | 1815 case 'kGetterFunction': return kGetterFunction; |
1814 case 'kSetterFunction': return kSetterFunction; | 1816 case 'kSetterFunction': return kSetterFunction; |
1815 case 'kConstructor': return kConstructor; | 1817 case 'kConstructor': return kConstructor; |
1816 case 'kImplicitGetter': return kImplicitGetterFunction; | 1818 case 'kImplicitGetter': return kImplicitGetterFunction; |
1817 case 'kImplicitSetter': return kImplicitSetterFunction; | 1819 case 'kImplicitSetter': return kImplicitSetterFunction; |
| 1820 case 'kImplicitStaticFinalGetter': return kImplicitStaticFinalGetter; |
| 1821 case 'kIrregexpFunction': return kIrregexpFunction; |
1818 case 'kStaticInitializer': return kStaticInitializer; | 1822 case 'kStaticInitializer': return kStaticInitializer; |
1819 case 'kMethodExtractor': return kMethodExtractor; | 1823 case 'kMethodExtractor': return kMethodExtractor; |
1820 case 'kNoSuchMethodDispatcher': return kNoSuchMethodDispatcher; | 1824 case 'kNoSuchMethodDispatcher': return kNoSuchMethodDispatcher; |
1821 case 'kInvokeFieldDispatcher': return kInvokeFieldDispatcher; | 1825 case 'kInvokeFieldDispatcher': return kInvokeFieldDispatcher; |
1822 case 'Collected': return kCollected; | 1826 case 'Collected': return kCollected; |
1823 case 'Native': return kNative; | 1827 case 'Native': return kNative; |
| 1828 case 'Stub': return kStub; |
1824 case 'Tag': return kTag; | 1829 case 'Tag': return kTag; |
1825 case 'Reused': return kReused; | |
1826 } | 1830 } |
1827 return kUNKNOWN; | 1831 print('did not understand $value'); |
| 1832 throw new FallThroughError(); |
1828 } | 1833 } |
1829 | 1834 |
1830 static FunctionKind kRegularFunction = new FunctionKind._internal('function'); | 1835 static FunctionKind kRegularFunction = new FunctionKind._internal('function'); |
1831 static FunctionKind kClosureFunction = new FunctionKind._internal('closure fun
ction'); | 1836 static FunctionKind kClosureFunction = new FunctionKind._internal('closure fun
ction'); |
1832 static FunctionKind kGetterFunction = new FunctionKind._internal('getter funct
ion'); | 1837 static FunctionKind kGetterFunction = new FunctionKind._internal('getter funct
ion'); |
1833 static FunctionKind kSetterFunction = new FunctionKind._internal('setter funct
ion'); | 1838 static FunctionKind kSetterFunction = new FunctionKind._internal('setter funct
ion'); |
1834 static FunctionKind kConstructor = new FunctionKind._internal('constructor'); | 1839 static FunctionKind kConstructor = new FunctionKind._internal('constructor'); |
1835 static FunctionKind kImplicitGetterFunction = new FunctionKind._internal('impl
icit getter function'); | 1840 static FunctionKind kImplicitGetterFunction = new FunctionKind._internal('impl
icit getter function'); |
1836 static FunctionKind kImplicitSetterFunction = new FunctionKind._internal('impl
icit setter function'); | 1841 static FunctionKind kImplicitSetterFunction = new FunctionKind._internal('impl
icit setter function'); |
| 1842 static FunctionKind kImplicitStaticFinalGetter = new FunctionKind._internal('i
mplicit static final getter'); |
| 1843 static FunctionKind kIrregexpFunction = new FunctionKind._internal('ir regexp
function'); |
1837 static FunctionKind kStaticInitializer = new FunctionKind._internal('static in
itializer'); | 1844 static FunctionKind kStaticInitializer = new FunctionKind._internal('static in
itializer'); |
1838 static FunctionKind kMethodExtractor = new FunctionKind._internal('method extr
actor'); | 1845 static FunctionKind kMethodExtractor = new FunctionKind._internal('method extr
actor'); |
1839 static FunctionKind kNoSuchMethodDispatcher = new FunctionKind._internal('noSu
chMethod dispatcher'); | 1846 static FunctionKind kNoSuchMethodDispatcher = new FunctionKind._internal('noSu
chMethod dispatcher'); |
1840 static FunctionKind kInvokeFieldDispatcher = new FunctionKind._internal('invok
e field dispatcher'); | 1847 static FunctionKind kInvokeFieldDispatcher = new FunctionKind._internal('invok
e field dispatcher'); |
1841 static FunctionKind kCollected = new FunctionKind._internal('Collected'); | 1848 static FunctionKind kCollected = new FunctionKind._internal('Collected'); |
1842 static FunctionKind kNative = new FunctionKind._internal('Native'); | 1849 static FunctionKind kNative = new FunctionKind._internal('Native'); |
1843 static FunctionKind kTag = new FunctionKind._internal('Tag'); | 1850 static FunctionKind kTag = new FunctionKind._internal('Tag'); |
1844 static FunctionKind kReused = new FunctionKind._internal('Reused'); | 1851 static FunctionKind kStub = new FunctionKind._internal('Stub'); |
1845 static FunctionKind kUNKNOWN = new FunctionKind._internal('UNKNOWN'); | 1852 static FunctionKind kUNKNOWN = new FunctionKind._internal('UNKNOWN'); |
1846 } | 1853 } |
1847 | 1854 |
1848 class ServiceFunction extends ServiceObject with Coverage { | 1855 class ServiceFunction extends ServiceObject with Coverage { |
1849 @observable Class owningClass; | 1856 @observable Class owningClass; |
1850 @observable Library owningLibrary; | 1857 @observable Library owningLibrary; |
1851 @observable bool isStatic; | 1858 @observable bool isStatic; |
1852 @observable bool isConst; | 1859 @observable bool isConst; |
1853 @observable ServiceFunction parent; | 1860 @observable ServiceFunction parent; |
1854 @observable Script script; | 1861 @observable Script script; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 return; | 2344 return; |
2338 } | 2345 } |
2339 } | 2346 } |
2340 } | 2347 } |
2341 } | 2348 } |
2342 | 2349 |
2343 class CodeKind { | 2350 class CodeKind { |
2344 final _value; | 2351 final _value; |
2345 const CodeKind._internal(this._value); | 2352 const CodeKind._internal(this._value); |
2346 String toString() => '$_value'; | 2353 String toString() => '$_value'; |
2347 | 2354 bool isSynthetic() => [Collected, Native, Tag].contains(this); |
| 2355 bool isDart() => !isSynthetic(); |
2348 static CodeKind fromString(String s) { | 2356 static CodeKind fromString(String s) { |
2349 if (s == 'Native') { | 2357 if (s == 'Native') { |
2350 return Native; | 2358 return Native; |
2351 } else if (s == 'Dart') { | 2359 } else if (s == 'Dart') { |
2352 return Dart; | 2360 return Dart; |
2353 } else if (s == 'Collected') { | 2361 } else if (s == 'Collected') { |
2354 return Collected; | 2362 return Collected; |
2355 } else if (s == 'Reused') { | |
2356 return Reused; | |
2357 } else if (s == 'Tag') { | 2363 } else if (s == 'Tag') { |
2358 return Tag; | 2364 return Tag; |
| 2365 } else if (s == 'Stub') { |
| 2366 return Stub; |
2359 } | 2367 } |
2360 Logger.root.warning('Unknown code kind $s'); | 2368 print('do not understand code kind $s'); |
2361 throw new FallThroughError(); | 2369 throw new FallThroughError(); |
2362 } | 2370 } |
| 2371 static const Collected = const CodeKind._internal('Collected'); |
| 2372 static const Dart = const CodeKind._internal('Dart'); |
2363 static const Native = const CodeKind._internal('Native'); | 2373 static const Native = const CodeKind._internal('Native'); |
2364 static const Dart = const CodeKind._internal('Dart'); | 2374 static const Stub = const CodeKind._internal('Stub'); |
2365 static const Collected = const CodeKind._internal('Collected'); | |
2366 static const Reused = const CodeKind._internal('Reused'); | |
2367 static const Tag = const CodeKind._internal('Tag'); | 2375 static const Tag = const CodeKind._internal('Tag'); |
2368 } | 2376 } |
2369 | 2377 |
2370 class CodeInlineInterval { | 2378 class CodeInlineInterval { |
2371 final int start; | 2379 final int start; |
2372 final int end; | 2380 final int end; |
2373 final List<ServiceFunction> functions = new List<ServiceFunction>(); | 2381 final List<ServiceFunction> functions = new List<ServiceFunction>(); |
2374 bool contains(int pc) => (pc >= start) && (pc < end); | 2382 bool contains(int pc) => (pc >= start) && (pc < end); |
2375 CodeInlineInterval(this.start, this.end); | 2383 CodeInlineInterval(this.start, this.end); |
2376 } | 2384 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 for (Map descriptor in descriptors) { | 2573 for (Map descriptor in descriptors) { |
2566 _processDescriptor(descriptor); | 2574 _processDescriptor(descriptor); |
2567 } | 2575 } |
2568 } | 2576 } |
2569 | 2577 |
2570 /// Returns true if [address] is contained inside [this]. | 2578 /// Returns true if [address] is contained inside [this]. |
2571 bool contains(int address) { | 2579 bool contains(int address) { |
2572 return (address >= startAddress) && (address < endAddress); | 2580 return (address >= startAddress) && (address < endAddress); |
2573 } | 2581 } |
2574 | 2582 |
2575 @reflectable bool get isDartCode => kind == CodeKind.Dart; | 2583 @reflectable bool get isDartCode => (kind == CodeKind.Dart) || |
| 2584 (kind == CodeKind.Stub); |
2576 } | 2585 } |
2577 | 2586 |
2578 | 2587 |
2579 class SocketKind { | 2588 class SocketKind { |
2580 final _value; | 2589 final _value; |
2581 const SocketKind._internal(this._value); | 2590 const SocketKind._internal(this._value); |
2582 String toString() => '$_value'; | 2591 String toString() => '$_value'; |
2583 | 2592 |
2584 static SocketKind fromString(String s) { | 2593 static SocketKind fromString(String s) { |
2585 if (s == 'Listening') { | 2594 if (s == 'Listening') { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 var v = list[i]; | 2832 var v = list[i]; |
2824 if ((v is ObservableMap) && _isServiceMap(v)) { | 2833 if ((v is ObservableMap) && _isServiceMap(v)) { |
2825 list[i] = owner.getFromMap(v); | 2834 list[i] = owner.getFromMap(v); |
2826 } else if (v is ObservableList) { | 2835 } else if (v is ObservableList) { |
2827 _upgradeObservableList(v, owner); | 2836 _upgradeObservableList(v, owner); |
2828 } else if (v is ObservableMap) { | 2837 } else if (v is ObservableMap) { |
2829 _upgradeObservableMap(v, owner); | 2838 _upgradeObservableMap(v, owner); |
2830 } | 2839 } |
2831 } | 2840 } |
2832 } | 2841 } |
OLD | NEW |