OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library code_view_element; | 5 library code_view_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/cpu_profile.dart'; | 9 import 'package:observatory/cpu_profile.dart'; |
10 import 'package:observatory/service.dart' as S; | 10 import 'package:observatory/service.dart' as S; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 M.VM _vm; | 58 M.VM _vm; |
59 M.IsolateRef _isolate; | 59 M.IsolateRef _isolate; |
60 M.EventRepository _events; | 60 M.EventRepository _events; |
61 M.NotificationRepository _notifications; | 61 M.NotificationRepository _notifications; |
62 M.Code _code; | 62 M.Code _code; |
63 M.RetainedSizeRepository _retainedSizes; | 63 M.RetainedSizeRepository _retainedSizes; |
64 M.ReachableSizeRepository _reachableSizes; | 64 M.ReachableSizeRepository _reachableSizes; |
65 M.InboundReferencesRepository _references; | 65 M.InboundReferencesRepository _references; |
66 M.RetainingPathRepository _retainingPaths; | 66 M.RetainingPathRepository _retainingPaths; |
67 M.InstanceRepository _instances; | 67 M.ObjectRepository _objects; |
68 DisassemblyTable disassemblyTable; | 68 DisassemblyTable disassemblyTable; |
69 InlineTable inlineTable; | 69 InlineTable inlineTable; |
70 | 70 |
71 static const kDisassemblyColumnIndex = 3; | 71 static const kDisassemblyColumnIndex = 3; |
72 | 72 |
73 M.VMRef get vm => _vm; | 73 M.VMRef get vm => _vm; |
74 M.IsolateRef get isolate => _isolate; | 74 M.IsolateRef get isolate => _isolate; |
75 M.NotificationRepository get notifications => _notifications; | 75 M.NotificationRepository get notifications => _notifications; |
76 M.Code get context => _code; | 76 M.Code get context => _code; |
77 | 77 |
78 factory CodeViewElement( | 78 factory CodeViewElement( |
79 M.VM vm, | 79 M.VM vm, |
80 M.IsolateRef isolate, | 80 M.IsolateRef isolate, |
81 M.Code code, | 81 M.Code code, |
82 M.EventRepository events, | 82 M.EventRepository events, |
83 M.NotificationRepository notifications, | 83 M.NotificationRepository notifications, |
84 M.RetainedSizeRepository retainedSizes, | 84 M.RetainedSizeRepository retainedSizes, |
85 M.ReachableSizeRepository reachableSizes, | 85 M.ReachableSizeRepository reachableSizes, |
86 M.InboundReferencesRepository references, | 86 M.InboundReferencesRepository references, |
87 M.RetainingPathRepository retainingPaths, | 87 M.RetainingPathRepository retainingPaths, |
88 M.InstanceRepository instances, | 88 M.ObjectRepository objects, |
89 {RenderingQueue queue}) { | 89 {RenderingQueue queue}) { |
90 assert(vm != null); | 90 assert(vm != null); |
91 assert(isolate != null); | 91 assert(isolate != null); |
92 assert(events != null); | 92 assert(events != null); |
93 assert(notifications != null); | 93 assert(notifications != null); |
94 assert(code != null); | 94 assert(code != null); |
95 assert(instances != null); | 95 assert(objects != null); |
96 assert(retainedSizes != null); | 96 assert(retainedSizes != null); |
97 assert(reachableSizes != null); | 97 assert(reachableSizes != null); |
98 assert(references != null); | 98 assert(references != null); |
99 assert(retainingPaths != null); | 99 assert(retainingPaths != null); |
100 CodeViewElement e = document.createElement(tag.name); | 100 CodeViewElement e = document.createElement(tag.name); |
101 e._r = new RenderingScheduler(e, queue: queue); | 101 e._r = new RenderingScheduler(e, queue: queue); |
102 e._vm = vm; | 102 e._vm = vm; |
103 e._isolate = isolate; | 103 e._isolate = isolate; |
104 e._events = events; | 104 e._events = events; |
105 e._notifications = notifications; | 105 e._notifications = notifications; |
106 e._code = code; | 106 e._code = code; |
107 e._instances = instances; | 107 e._objects = objects; |
108 e._retainedSizes = retainedSizes; | 108 e._retainedSizes = retainedSizes; |
109 e._reachableSizes = reachableSizes; | 109 e._reachableSizes = reachableSizes; |
110 e._references = references; | 110 e._references = references; |
111 e._retainingPaths = retainingPaths; | 111 e._retainingPaths = retainingPaths; |
112 return e; | 112 return e; |
113 } | 113 } |
114 | 114 |
115 CodeViewElement.created() : super.created() { | 115 CodeViewElement.created() : super.created() { |
116 var columns = [ | 116 var columns = [ |
117 new SortedTableColumn('Address'), | 117 new SortedTableColumn('Address'), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 ]), | 218 ]), |
219 new DivElement() | 219 new DivElement() |
220 ..classes = ['content-centered-big'] | 220 ..classes = ['content-centered-big'] |
221 ..children = [ | 221 ..children = [ |
222 new HeadingElement.h1() | 222 new HeadingElement.h1() |
223 ..text = (M.isDartCode(_code.kind) && _code.isOptimized) | 223 ..text = (M.isDartCode(_code.kind) && _code.isOptimized) |
224 ? 'Optimized code for ${_code.name}' | 224 ? 'Optimized code for ${_code.name}' |
225 : 'Code for ${_code.name}', | 225 : 'Code for ${_code.name}', |
226 new HRElement(), | 226 new HRElement(), |
227 new ObjectCommonElement(_isolate, _code, _retainedSizes, | 227 new ObjectCommonElement(_isolate, _code, _retainedSizes, |
228 _reachableSizes, _references, _retainingPaths, _instances, | 228 _reachableSizes, _references, _retainingPaths, _objects, |
229 queue: _r.queue), | 229 queue: _r.queue), |
230 new BRElement(), | 230 new BRElement(), |
231 new DivElement() | 231 new DivElement() |
232 ..classes = ['memberList'] | 232 ..classes = ['memberList'] |
233 ..children = [ | 233 ..children = [ |
234 new DivElement() | 234 new DivElement() |
235 ..classes = ['memberItem'] | 235 ..classes = ['memberItem'] |
236 ..children = [ | 236 ..children = [ |
237 new DivElement() | 237 new DivElement() |
238 ..classes = ['memberName'] | 238 ..classes = ['memberName'] |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 tableBody.children.add(tr); | 469 tableBody.children.add(tr); |
470 } | 470 } |
471 | 471 |
472 void _fillDisassemblyDOMRow(TableRowElement tr, int rowIndex) { | 472 void _fillDisassemblyDOMRow(TableRowElement tr, int rowIndex) { |
473 final row = disassemblyTable.rows[rowIndex]; | 473 final row = disassemblyTable.rows[rowIndex]; |
474 final n = row.values.length; | 474 final n = row.values.length; |
475 for (var i = 0; i < n; i++) { | 475 for (var i = 0; i < n; i++) { |
476 final cell = tr.children[i]; | 476 final cell = tr.children[i]; |
477 final content = row.values[i]; | 477 final content = row.values[i]; |
478 if (content is S.HeapObject) { | 478 if (content is S.HeapObject) { |
479 cell.children = [ | 479 cell.children = [anyRef(_isolate, content, _objects, queue: _r.queue)]; |
480 anyRef(_isolate, content, _instances, queue: _r.queue) | |
481 ]; | |
482 } else if (content != null) { | 480 } else if (content != null) { |
483 String text = '$content'; | 481 String text = '$content'; |
484 if (i == kDisassemblyColumnIndex) { | 482 if (i == kDisassemblyColumnIndex) { |
485 // Disassembly might be a comment. Reduce indentation, change styling, | 483 // Disassembly might be a comment. Reduce indentation, change styling, |
486 // widen to span next column (which should be empty). | 484 // widen to span next column (which should be empty). |
487 if (text.startsWith(' ;;')) { | 485 if (text.startsWith(' ;;')) { |
488 cell.attributes['colspan'] = '2'; | 486 cell.attributes['colspan'] = '2'; |
489 cell.classes.add('code-comment'); | 487 cell.classes.add('code-comment'); |
490 text = text.substring(6); | 488 text = text.substring(6); |
491 } else { | 489 } else { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 case M.CodeKind.stub: | 638 case M.CodeKind.stub: |
641 return 'stub'; | 639 return 'stub'; |
642 case M.CodeKind.tag: | 640 case M.CodeKind.tag: |
643 return 'tag'; | 641 return 'tag'; |
644 case M.CodeKind.collected: | 642 case M.CodeKind.collected: |
645 return 'collected'; | 643 return 'collected'; |
646 } | 644 } |
647 throw new Exception('Unknown CodeKind ($kind)'); | 645 throw new Exception('Unknown CodeKind ($kind)'); |
648 } | 646 } |
649 } | 647 } |
OLD | NEW |