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

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

Issue 1439893002: - Annotate instructions that load objects from the ObjectPool or Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 /// Helper function for canceling a Future<StreamSubscription>. 7 /// Helper function for canceling a Future<StreamSubscription>.
8 Future cancelFutureSubscription( 8 Future cancelFutureSubscription(
9 Future<StreamSubscription> subscriptionFuture) async { 9 Future<StreamSubscription> subscriptionFuture) async {
10 if (subscriptionFuture != null) { 10 if (subscriptionFuture != null) {
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 // owner is a Library, Class, or ServiceFunction. 2561 // owner is a Library, Class, or ServiceFunction.
2562 @observable ServiceObject dartOwner; 2562 @observable ServiceObject dartOwner;
2563 @observable Library library; 2563 @observable Library library;
2564 @observable bool isStatic; 2564 @observable bool isStatic;
2565 @observable bool isConst; 2565 @observable bool isConst;
2566 @observable SourceLocation location; 2566 @observable SourceLocation location;
2567 @observable Code code; 2567 @observable Code code;
2568 @observable Code unoptimizedCode; 2568 @observable Code unoptimizedCode;
2569 @observable bool isOptimizable; 2569 @observable bool isOptimizable;
2570 @observable bool isInlinable; 2570 @observable bool isInlinable;
2571 @observable bool hasIntrinsic;
2572 @observable bool isRecognized;
2573 @observable bool isNative;
2571 @observable FunctionKind kind; 2574 @observable FunctionKind kind;
2572 @observable int deoptimizations; 2575 @observable int deoptimizations;
2573 @observable String qualifiedName; 2576 @observable String qualifiedName;
2574 @observable int usageCounter; 2577 @observable int usageCounter;
2575 @observable bool isDart; 2578 @observable bool isDart;
2576 @observable ProfileFunction profile; 2579 @observable ProfileFunction profile;
2577 @observable Instance icDataArray; 2580 @observable Instance icDataArray;
2578 2581
2579 bool get canCache => true; 2582 bool get canCache => true;
2580 bool get immutable => false; 2583 bool get immutable => false;
(...skipping 19 matching lines...) Expand all
2600 } else if (dartOwner is Class) { 2603 } else if (dartOwner is Class) {
2601 Class ownerClass = dartOwner; 2604 Class ownerClass = dartOwner;
2602 library = ownerClass.library; 2605 library = ownerClass.library;
2603 qualifiedName = "${ownerClass.name}.${name}"; 2606 qualifiedName = "${ownerClass.name}.${name}";
2604 2607
2605 } else { 2608 } else {
2606 library = dartOwner; 2609 library = dartOwner;
2607 qualifiedName = name; 2610 qualifiedName = name;
2608 } 2611 }
2609 2612
2613 hasIntrinsic = map['_intrinsic'];
2614 isNative = map['_native'];
2615
2610 if (mapIsRef) { 2616 if (mapIsRef) {
2611 return; 2617 return;
2612 } 2618 }
2613 2619
2614 _loaded = true; 2620 _loaded = true;
2615 isStatic = map['static']; 2621 isStatic = map['static'];
2616 isConst = map['const']; 2622 isConst = map['const'];
2617 location = map['location']; 2623 location = map['location'];
2618 code = map['code']; 2624 code = map['code'];
2619 isOptimizable = map['_optimizable']; 2625 isOptimizable = map['_optimizable'];
2620 isInlinable = map['_inlinable']; 2626 isInlinable = map['_inlinable'];
2627 isRecognized = map['_recognized'];
2621 unoptimizedCode = map['_unoptimizedCode']; 2628 unoptimizedCode = map['_unoptimizedCode'];
2622 deoptimizations = map['_deoptimizations']; 2629 deoptimizations = map['_deoptimizations'];
2623 usageCounter = map['_usageCounter']; 2630 usageCounter = map['_usageCounter'];
2624 icDataArray = map['_icDataArray']; 2631 icDataArray = map['_icDataArray'];
2625 } 2632 }
2626 } 2633 }
2627 2634
2628 2635
2629 class Field extends HeapObject { 2636 class Field extends HeapObject {
2630 // Library or Class. 2637 // Library or Class.
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 } 3411 }
3405 privateKey = map['privateKey']; 3412 privateKey = map['privateKey'];
3406 } 3413 }
3407 } 3414 }
3408 3415
3409 class CodeInstruction extends Observable { 3416 class CodeInstruction extends Observable {
3410 @observable final int address; 3417 @observable final int address;
3411 @observable final int pcOffset; 3418 @observable final int pcOffset;
3412 @observable final String machine; 3419 @observable final String machine;
3413 @observable final String human; 3420 @observable final String human;
3421 @observable final ServiceObject object;
3414 @observable CodeInstruction jumpTarget; 3422 @observable CodeInstruction jumpTarget;
3415 @reflectable List<PcDescriptor> descriptors = 3423 @reflectable List<PcDescriptor> descriptors =
3416 new ObservableList<PcDescriptor>(); 3424 new ObservableList<PcDescriptor>();
3417 3425
3418 CodeInstruction(this.address, this.pcOffset, this.machine, this.human); 3426 CodeInstruction(this.address,
3427 this.pcOffset,
3428 this.machine,
3429 this.human,
3430 this.object);
3419 3431
3420 @reflectable bool get isComment => address == 0; 3432 @reflectable bool get isComment => address == 0;
3421 @reflectable bool get hasDescriptors => descriptors.length > 0; 3433 @reflectable bool get hasDescriptors => descriptors.length > 0;
3422 3434
3423 bool _isJumpInstruction() { 3435 bool _isJumpInstruction() {
3424 return human.startsWith('j'); 3436 return human.startsWith('j');
3425 } 3437 }
3426 3438
3427 int _getJumpAddress() { 3439 int _getJumpAddress() {
3428 assert(_isJumpInstruction()); 3440 assert(_isJumpInstruction());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3499 final List<ServiceFunction> functions = new List<ServiceFunction>(); 3511 final List<ServiceFunction> functions = new List<ServiceFunction>();
3500 bool contains(int pc) => (pc >= start) && (pc < end); 3512 bool contains(int pc) => (pc >= start) && (pc < end);
3501 CodeInlineInterval(this.start, this.end); 3513 CodeInlineInterval(this.start, this.end);
3502 } 3514 }
3503 3515
3504 class Code extends HeapObject { 3516 class Code extends HeapObject {
3505 @observable CodeKind kind; 3517 @observable CodeKind kind;
3506 @observable ServiceObject objectPool; 3518 @observable ServiceObject objectPool;
3507 @observable ServiceFunction function; 3519 @observable ServiceFunction function;
3508 @observable Script script; 3520 @observable Script script;
3509 @observable bool isOptimized = false; 3521 @observable bool isOptimized;
3522 @observable bool hasIntrinsic;
3523 @observable bool isNative;
3524
3510 @reflectable int startAddress = 0; 3525 @reflectable int startAddress = 0;
3511 @reflectable int endAddress = 0; 3526 @reflectable int endAddress = 0;
3512 @reflectable final instructions = new ObservableList<CodeInstruction>(); 3527 @reflectable final instructions = new ObservableList<CodeInstruction>();
3513 List<CodeInstruction> instructionsByAddressOffset; 3528 List<CodeInstruction> instructionsByAddressOffset;
3514 3529
3515 @observable ProfileCode profile; 3530 @observable ProfileCode profile;
3516 final List<CodeInlineInterval> inlineIntervals = 3531 final List<CodeInlineInterval> inlineIntervals =
3517 new List<CodeInlineInterval>(); 3532 new List<CodeInlineInterval>();
3518 final ObservableList<ServiceFunction> inlinedFunctions = 3533 final ObservableList<ServiceFunction> inlinedFunctions =
3519 new ObservableList<ServiceFunction>(); 3534 new ObservableList<ServiceFunction>();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3569 return super.reload(); 3584 return super.reload();
3570 } 3585 }
3571 return new Future.value(this); 3586 return new Future.value(this);
3572 } 3587 }
3573 3588
3574 void _update(ObservableMap m, bool mapIsRef) { 3589 void _update(ObservableMap m, bool mapIsRef) {
3575 name = m['name']; 3590 name = m['name'];
3576 vmName = (m.containsKey('_vmName') ? m['_vmName'] : name); 3591 vmName = (m.containsKey('_vmName') ? m['_vmName'] : name);
3577 isOptimized = m['_optimized']; 3592 isOptimized = m['_optimized'];
3578 kind = CodeKind.fromString(m['kind']); 3593 kind = CodeKind.fromString(m['kind']);
3594 hasIntrinsic = m['_intrinsic'];
3595 isNative = m['_native'];
3579 if (mapIsRef) { 3596 if (mapIsRef) {
3580 return; 3597 return;
3581 } 3598 }
3582 _loaded = true; 3599 _loaded = true;
3583 startAddress = int.parse(m['_startAddress'], radix:16); 3600 startAddress = int.parse(m['_startAddress'], radix:16);
3584 endAddress = int.parse(m['_endAddress'], radix:16); 3601 endAddress = int.parse(m['_endAddress'], radix:16);
3585 function = isolate.getFromMap(m['function']); 3602 function = isolate.getFromMap(m['function']);
3586 objectPool = isolate.getFromMap(m['_objectPool']); 3603 objectPool = isolate.getFromMap(m['_objectPool']);
3587 var disassembly = m['_disassembly']; 3604 var disassembly = m['_disassembly'];
3588 if (disassembly != null) { 3605 if (disassembly != null) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3648 } 3665 }
3649 } 3666 }
3650 3667
3651 @observable bool hasDisassembly = false; 3668 @observable bool hasDisassembly = false;
3652 3669
3653 void _processDisassembly(List<String> disassembly){ 3670 void _processDisassembly(List<String> disassembly){
3654 assert(disassembly != null); 3671 assert(disassembly != null);
3655 instructions.clear(); 3672 instructions.clear();
3656 instructionsByAddressOffset = new List(endAddress - startAddress); 3673 instructionsByAddressOffset = new List(endAddress - startAddress);
3657 3674
3658 assert((disassembly.length % 3) == 0); 3675 assert((disassembly.length % 4) == 0);
3659 for (var i = 0; i < disassembly.length; i += 3) { 3676 for (var i = 0; i < disassembly.length; i += 4) {
3660 var address = 0; // Assume code comment. 3677 var address = 0; // Assume code comment.
3661 var machine = disassembly[i + 1]; 3678 var machine = disassembly[i + 1];
3662 var human = disassembly[i + 2]; 3679 var human = disassembly[i + 2];
3680 var object = disassembly[i + 3];
3681 if (object != null) {
3682 object = new ServiceObject._fromMap(owner, object);
3683 }
3663 var pcOffset = 0; 3684 var pcOffset = 0;
3664 if (disassembly[i] != '') { 3685 if (disassembly[i] != null) {
3665 // Not a code comment, extract address. 3686 // Not a code comment, extract address.
3666 address = int.parse(disassembly[i], radix:16); 3687 address = int.parse(disassembly[i], radix:16);
3667 pcOffset = address - startAddress; 3688 pcOffset = address - startAddress;
3668 } 3689 }
3669 var instruction = new CodeInstruction(address, pcOffset, machine, human); 3690 var instruction =
3691 new CodeInstruction(address, pcOffset, machine, human, object);
3670 instructions.add(instruction); 3692 instructions.add(instruction);
3671 if (disassembly[i] != '') { 3693 if (disassembly[i] != null) {
3672 // Not a code comment. 3694 // Not a code comment.
3673 instructionsByAddressOffset[pcOffset] = instruction; 3695 instructionsByAddressOffset[pcOffset] = instruction;
3674 } 3696 }
3675 } 3697 }
3676 for (var instruction in instructions) { 3698 for (var instruction in instructions) {
3677 instruction._resolveJumpTarget(instructionsByAddressOffset, startAddress); 3699 instruction._resolveJumpTarget(instructionsByAddressOffset, startAddress);
3678 } 3700 }
3679 } 3701 }
3680 3702
3681 void _processDescriptors(List<Map> descriptors) { 3703 void _processDescriptors(List<Map> descriptors) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 var v = list[i]; 4020 var v = list[i];
3999 if ((v is ObservableMap) && _isServiceMap(v)) { 4021 if ((v is ObservableMap) && _isServiceMap(v)) {
4000 list[i] = owner.getFromMap(v); 4022 list[i] = owner.getFromMap(v);
4001 } else if (v is ObservableList) { 4023 } else if (v is ObservableList) {
4002 _upgradeObservableList(v, owner); 4024 _upgradeObservableList(v, owner);
4003 } else if (v is ObservableMap) { 4025 } else if (v is ObservableMap) {
4004 _upgradeObservableMap(v, owner); 4026 _upgradeObservableMap(v, owner);
4005 } 4027 }
4006 } 4028 }
4007 } 4029 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698