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

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

Issue 965593002: Improved profiler view and inclusive profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
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 /// 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 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1796
1797 String toString() => 'Context($length)'; 1797 String toString() => 'Context($length)';
1798 } 1798 }
1799 1799
1800 1800
1801 // TODO(koda): Sync this with VM. 1801 // TODO(koda): Sync this with VM.
1802 class FunctionKind { 1802 class FunctionKind {
1803 final String _strValue; 1803 final String _strValue;
1804 FunctionKind._internal(this._strValue); 1804 FunctionKind._internal(this._strValue);
1805 toString() => _strValue; 1805 toString() => _strValue;
1806 bool isSynthetic() => [kCollected, kNative, kTag, kReused].contains(this); 1806 bool isSynthetic() => [kCollected, kNative, kStub, kTag].contains(this);
1807 1807 bool isDart() => !isSynthetic();
1808 bool isStub() => (this == kStub);
1809 bool hasDartCode() => isDart() || isStub();
1808 static FunctionKind fromJSON(String value) { 1810 static FunctionKind fromJSON(String value) {
1809 switch(value) { 1811 switch(value) {
1810 case 'kRegularFunction': return kRegularFunction; 1812 case 'kRegularFunction': return kRegularFunction;
1811 case 'kClosureFunction': return kClosureFunction; 1813 case 'kClosureFunction': return kClosureFunction;
1812 case 'kGetterFunction': return kGetterFunction; 1814 case 'kGetterFunction': return kGetterFunction;
1813 case 'kSetterFunction': return kSetterFunction; 1815 case 'kSetterFunction': return kSetterFunction;
1814 case 'kConstructor': return kConstructor; 1816 case 'kConstructor': return kConstructor;
1815 case 'kImplicitGetter': return kImplicitGetterFunction; 1817 case 'kImplicitGetter': return kImplicitGetterFunction;
1816 case 'kImplicitSetter': return kImplicitSetterFunction; 1818 case 'kImplicitSetter': return kImplicitSetterFunction;
1819 case 'kImplicitStaticFinalGetter': return kImplicitStaticFinalGetter;
1820 case 'kIrregexpFunction': return kIrregexpFunction;
1817 case 'kStaticInitializer': return kStaticInitializer; 1821 case 'kStaticInitializer': return kStaticInitializer;
1818 case 'kMethodExtractor': return kMethodExtractor; 1822 case 'kMethodExtractor': return kMethodExtractor;
1819 case 'kNoSuchMethodDispatcher': return kNoSuchMethodDispatcher; 1823 case 'kNoSuchMethodDispatcher': return kNoSuchMethodDispatcher;
1820 case 'kInvokeFieldDispatcher': return kInvokeFieldDispatcher; 1824 case 'kInvokeFieldDispatcher': return kInvokeFieldDispatcher;
1821 case 'Collected': return kCollected; 1825 case 'Collected': return kCollected;
1822 case 'Native': return kNative; 1826 case 'Native': return kNative;
1827 case 'Stub': return kStub;
1823 case 'Tag': return kTag; 1828 case 'Tag': return kTag;
1824 case 'Reused': return kReused;
1825 } 1829 }
1826 return kUNKNOWN; 1830 print('did not understand $value');
1831 throw new FallThroughError();
1827 } 1832 }
1828 1833
1829 static FunctionKind kRegularFunction = new FunctionKind._internal('function'); 1834 static FunctionKind kRegularFunction = new FunctionKind._internal('function');
1830 static FunctionKind kClosureFunction = new FunctionKind._internal('closure fun ction'); 1835 static FunctionKind kClosureFunction = new FunctionKind._internal('closure fun ction');
1831 static FunctionKind kGetterFunction = new FunctionKind._internal('getter funct ion'); 1836 static FunctionKind kGetterFunction = new FunctionKind._internal('getter funct ion');
1832 static FunctionKind kSetterFunction = new FunctionKind._internal('setter funct ion'); 1837 static FunctionKind kSetterFunction = new FunctionKind._internal('setter funct ion');
1833 static FunctionKind kConstructor = new FunctionKind._internal('constructor'); 1838 static FunctionKind kConstructor = new FunctionKind._internal('constructor');
1834 static FunctionKind kImplicitGetterFunction = new FunctionKind._internal('impl icit getter function'); 1839 static FunctionKind kImplicitGetterFunction = new FunctionKind._internal('impl icit getter function');
1835 static FunctionKind kImplicitSetterFunction = new FunctionKind._internal('impl icit setter function'); 1840 static FunctionKind kImplicitSetterFunction = new FunctionKind._internal('impl icit setter function');
1841 static FunctionKind kImplicitStaticFinalGetter = new FunctionKind._internal('i mplicit static final getter');
1842 static FunctionKind kIrregexpFunction = new FunctionKind._internal('ir regexp function');
1836 static FunctionKind kStaticInitializer = new FunctionKind._internal('static in itializer'); 1843 static FunctionKind kStaticInitializer = new FunctionKind._internal('static in itializer');
1837 static FunctionKind kMethodExtractor = new FunctionKind._internal('method extr actor'); 1844 static FunctionKind kMethodExtractor = new FunctionKind._internal('method extr actor');
1838 static FunctionKind kNoSuchMethodDispatcher = new FunctionKind._internal('noSu chMethod dispatcher'); 1845 static FunctionKind kNoSuchMethodDispatcher = new FunctionKind._internal('noSu chMethod dispatcher');
1839 static FunctionKind kInvokeFieldDispatcher = new FunctionKind._internal('invok e field dispatcher'); 1846 static FunctionKind kInvokeFieldDispatcher = new FunctionKind._internal('invok e field dispatcher');
1840 static FunctionKind kCollected = new FunctionKind._internal('Collected'); 1847 static FunctionKind kCollected = new FunctionKind._internal('Collected');
1841 static FunctionKind kNative = new FunctionKind._internal('Native'); 1848 static FunctionKind kNative = new FunctionKind._internal('Native');
1842 static FunctionKind kTag = new FunctionKind._internal('Tag'); 1849 static FunctionKind kTag = new FunctionKind._internal('Tag');
1843 static FunctionKind kReused = new FunctionKind._internal('Reused'); 1850 static FunctionKind kStub = new FunctionKind._internal('Stub');
1844 static FunctionKind kUNKNOWN = new FunctionKind._internal('UNKNOWN'); 1851 static FunctionKind kUNKNOWN = new FunctionKind._internal('UNKNOWN');
1845 } 1852 }
1846 1853
1847 class ServiceFunction extends ServiceObject with Coverage { 1854 class ServiceFunction extends ServiceObject with Coverage {
1848 @observable Class owningClass; 1855 @observable Class owningClass;
1849 @observable Library owningLibrary; 1856 @observable Library owningLibrary;
1850 @observable bool isStatic; 1857 @observable bool isStatic;
1851 @observable bool isConst; 1858 @observable bool isConst;
1852 @observable ServiceFunction parent; 1859 @observable ServiceFunction parent;
1853 @observable Script script; 1860 @observable Script script;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 return; 2339 return;
2333 } 2340 }
2334 } 2341 }
2335 } 2342 }
2336 } 2343 }
2337 2344
2338 class CodeKind { 2345 class CodeKind {
2339 final _value; 2346 final _value;
2340 const CodeKind._internal(this._value); 2347 const CodeKind._internal(this._value);
2341 String toString() => '$_value'; 2348 String toString() => '$_value';
2342 2349 bool isSynthetic() => [Collected, Native, Tag].contains(this);
2350 bool isDart() => !isSynthetic();
2343 static CodeKind fromString(String s) { 2351 static CodeKind fromString(String s) {
2344 if (s == 'Native') { 2352 if (s == 'Native') {
2345 return Native; 2353 return Native;
2346 } else if (s == 'Dart') { 2354 } else if (s == 'Dart') {
2347 return Dart; 2355 return Dart;
2348 } else if (s == 'Collected') { 2356 } else if (s == 'Collected') {
2349 return Collected; 2357 return Collected;
2350 } else if (s == 'Reused') {
2351 return Reused;
2352 } else if (s == 'Tag') { 2358 } else if (s == 'Tag') {
2353 return Tag; 2359 return Tag;
2360 } else if (s == 'Stub') {
2361 return Stub;
2354 } 2362 }
2355 Logger.root.warning('Unknown code kind $s');
2356 throw new FallThroughError(); 2363 throw new FallThroughError();
2357 } 2364 }
2365 static const Collected = const CodeKind._internal('Collected');
2366 static const Dart = const CodeKind._internal('Dart');
2358 static const Native = const CodeKind._internal('Native'); 2367 static const Native = const CodeKind._internal('Native');
2359 static const Dart = const CodeKind._internal('Dart'); 2368 static const Stub = const CodeKind._internal('Stub');
2360 static const Collected = const CodeKind._internal('Collected');
2361 static const Reused = const CodeKind._internal('Reused');
2362 static const Tag = const CodeKind._internal('Tag'); 2369 static const Tag = const CodeKind._internal('Tag');
2363 } 2370 }
2364 2371
2365 class CodeInlineInterval { 2372 class CodeInlineInterval {
2366 final int start; 2373 final int start;
2367 final int end; 2374 final int end;
2368 final List<ServiceFunction> functions = new List<ServiceFunction>(); 2375 final List<ServiceFunction> functions = new List<ServiceFunction>();
2369 bool contains(int pc) => (pc >= start) && (pc < end); 2376 bool contains(int pc) => (pc >= start) && (pc < end);
2370 CodeInlineInterval(this.start, this.end); 2377 CodeInlineInterval(this.start, this.end);
2371 } 2378 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 for (Map descriptor in descriptors) { 2567 for (Map descriptor in descriptors) {
2561 _processDescriptor(descriptor); 2568 _processDescriptor(descriptor);
2562 } 2569 }
2563 } 2570 }
2564 2571
2565 /// Returns true if [address] is contained inside [this]. 2572 /// Returns true if [address] is contained inside [this].
2566 bool contains(int address) { 2573 bool contains(int address) {
2567 return (address >= startAddress) && (address < endAddress); 2574 return (address >= startAddress) && (address < endAddress);
2568 } 2575 }
2569 2576
2570 @reflectable bool get isDartCode => kind == CodeKind.Dart; 2577 @reflectable bool get isDartCode => (kind == CodeKind.Dart) ||
2578 (kind == CodeKind.Stub);
2571 } 2579 }
2572 2580
2573 2581
2574 class SocketKind { 2582 class SocketKind {
2575 final _value; 2583 final _value;
2576 const SocketKind._internal(this._value); 2584 const SocketKind._internal(this._value);
2577 String toString() => '$_value'; 2585 String toString() => '$_value';
2578 2586
2579 static SocketKind fromString(String s) { 2587 static SocketKind fromString(String s) {
2580 if (s == 'Listening') { 2588 if (s == 'Listening') {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 var v = list[i]; 2826 var v = list[i];
2819 if ((v is ObservableMap) && _isServiceMap(v)) { 2827 if ((v is ObservableMap) && _isServiceMap(v)) {
2820 list[i] = owner.getFromMap(v); 2828 list[i] = owner.getFromMap(v);
2821 } else if (v is ObservableList) { 2829 } else if (v is ObservableList) {
2822 _upgradeObservableList(v, owner); 2830 _upgradeObservableList(v, owner);
2823 } else if (v is ObservableMap) { 2831 } else if (v is ObservableMap) {
2824 _upgradeObservableMap(v, owner); 2832 _upgradeObservableMap(v, owner);
2825 } 2833 }
2826 } 2834 }
2827 } 2835 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698