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

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
« no previous file with comments | « runtime/observatory/lib/src/elements/service_ref.html ('k') | runtime/vm/disassembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @observable Field field; 2581 @observable Field field;
2579 2582
2580 bool get canCache => true; 2583 bool get canCache => true;
(...skipping 20 matching lines...) Expand all
2601 } else if (dartOwner is Class) { 2604 } else if (dartOwner is Class) {
2602 Class ownerClass = dartOwner; 2605 Class ownerClass = dartOwner;
2603 library = ownerClass.library; 2606 library = ownerClass.library;
2604 qualifiedName = "${ownerClass.name}.${name}"; 2607 qualifiedName = "${ownerClass.name}.${name}";
2605 2608
2606 } else { 2609 } else {
2607 library = dartOwner; 2610 library = dartOwner;
2608 qualifiedName = name; 2611 qualifiedName = name;
2609 } 2612 }
2610 2613
2614 hasIntrinsic = map['_intrinsic'];
2615 isNative = map['_native'];
2616
2611 if (mapIsRef) { 2617 if (mapIsRef) {
2612 return; 2618 return;
2613 } 2619 }
2614 2620
2615 _loaded = true; 2621 _loaded = true;
2616 isStatic = map['static']; 2622 isStatic = map['static'];
2617 isConst = map['const']; 2623 isConst = map['const'];
2618 location = map['location']; 2624 location = map['location'];
2619 code = map['code']; 2625 code = map['code'];
2620 isOptimizable = map['_optimizable']; 2626 isOptimizable = map['_optimizable'];
2621 isInlinable = map['_inlinable']; 2627 isInlinable = map['_inlinable'];
2628 isRecognized = map['_recognized'];
2622 unoptimizedCode = map['_unoptimizedCode']; 2629 unoptimizedCode = map['_unoptimizedCode'];
2623 deoptimizations = map['_deoptimizations']; 2630 deoptimizations = map['_deoptimizations'];
2624 usageCounter = map['_usageCounter']; 2631 usageCounter = map['_usageCounter'];
2625 icDataArray = map['_icDataArray']; 2632 icDataArray = map['_icDataArray'];
2626 field = map['_field']; 2633 field = map['_field'];
2627 } 2634 }
2628 } 2635 }
2629 2636
2630 2637
2631 class Field extends HeapObject { 2638 class Field extends HeapObject {
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 } 3413 }
3407 privateKey = map['privateKey']; 3414 privateKey = map['privateKey'];
3408 } 3415 }
3409 } 3416 }
3410 3417
3411 class CodeInstruction extends Observable { 3418 class CodeInstruction extends Observable {
3412 @observable final int address; 3419 @observable final int address;
3413 @observable final int pcOffset; 3420 @observable final int pcOffset;
3414 @observable final String machine; 3421 @observable final String machine;
3415 @observable final String human; 3422 @observable final String human;
3423 @observable final ServiceObject object;
3416 @observable CodeInstruction jumpTarget; 3424 @observable CodeInstruction jumpTarget;
3417 @reflectable List<PcDescriptor> descriptors = 3425 @reflectable List<PcDescriptor> descriptors =
3418 new ObservableList<PcDescriptor>(); 3426 new ObservableList<PcDescriptor>();
3419 3427
3420 CodeInstruction(this.address, this.pcOffset, this.machine, this.human); 3428 CodeInstruction(this.address,
3429 this.pcOffset,
3430 this.machine,
3431 this.human,
3432 this.object);
3421 3433
3422 @reflectable bool get isComment => address == 0; 3434 @reflectable bool get isComment => address == 0;
3423 @reflectable bool get hasDescriptors => descriptors.length > 0; 3435 @reflectable bool get hasDescriptors => descriptors.length > 0;
3424 3436
3425 bool _isJumpInstruction() { 3437 bool _isJumpInstruction() {
3426 return human.startsWith('j'); 3438 return human.startsWith('j');
3427 } 3439 }
3428 3440
3429 int _getJumpAddress() { 3441 int _getJumpAddress() {
3430 assert(_isJumpInstruction()); 3442 assert(_isJumpInstruction());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3501 final List<ServiceFunction> functions = new List<ServiceFunction>(); 3513 final List<ServiceFunction> functions = new List<ServiceFunction>();
3502 bool contains(int pc) => (pc >= start) && (pc < end); 3514 bool contains(int pc) => (pc >= start) && (pc < end);
3503 CodeInlineInterval(this.start, this.end); 3515 CodeInlineInterval(this.start, this.end);
3504 } 3516 }
3505 3517
3506 class Code extends HeapObject { 3518 class Code extends HeapObject {
3507 @observable CodeKind kind; 3519 @observable CodeKind kind;
3508 @observable ServiceObject objectPool; 3520 @observable ServiceObject objectPool;
3509 @observable ServiceFunction function; 3521 @observable ServiceFunction function;
3510 @observable Script script; 3522 @observable Script script;
3511 @observable bool isOptimized = false; 3523 @observable bool isOptimized;
3524 @observable bool hasIntrinsic;
3525 @observable bool isNative;
3526
3512 @reflectable int startAddress = 0; 3527 @reflectable int startAddress = 0;
3513 @reflectable int endAddress = 0; 3528 @reflectable int endAddress = 0;
3514 @reflectable final instructions = new ObservableList<CodeInstruction>(); 3529 @reflectable final instructions = new ObservableList<CodeInstruction>();
3515 List<CodeInstruction> instructionsByAddressOffset; 3530 List<CodeInstruction> instructionsByAddressOffset;
3516 3531
3517 @observable ProfileCode profile; 3532 @observable ProfileCode profile;
3518 final List<CodeInlineInterval> inlineIntervals = 3533 final List<CodeInlineInterval> inlineIntervals =
3519 new List<CodeInlineInterval>(); 3534 new List<CodeInlineInterval>();
3520 final ObservableList<ServiceFunction> inlinedFunctions = 3535 final ObservableList<ServiceFunction> inlinedFunctions =
3521 new ObservableList<ServiceFunction>(); 3536 new ObservableList<ServiceFunction>();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 return super.reload(); 3586 return super.reload();
3572 } 3587 }
3573 return new Future.value(this); 3588 return new Future.value(this);
3574 } 3589 }
3575 3590
3576 void _update(ObservableMap m, bool mapIsRef) { 3591 void _update(ObservableMap m, bool mapIsRef) {
3577 name = m['name']; 3592 name = m['name'];
3578 vmName = (m.containsKey('_vmName') ? m['_vmName'] : name); 3593 vmName = (m.containsKey('_vmName') ? m['_vmName'] : name);
3579 isOptimized = m['_optimized']; 3594 isOptimized = m['_optimized'];
3580 kind = CodeKind.fromString(m['kind']); 3595 kind = CodeKind.fromString(m['kind']);
3596 hasIntrinsic = m['_intrinsic'];
3597 isNative = m['_native'];
3581 if (mapIsRef) { 3598 if (mapIsRef) {
3582 return; 3599 return;
3583 } 3600 }
3584 _loaded = true; 3601 _loaded = true;
3585 startAddress = int.parse(m['_startAddress'], radix:16); 3602 startAddress = int.parse(m['_startAddress'], radix:16);
3586 endAddress = int.parse(m['_endAddress'], radix:16); 3603 endAddress = int.parse(m['_endAddress'], radix:16);
3587 function = isolate.getFromMap(m['function']); 3604 function = isolate.getFromMap(m['function']);
3588 objectPool = isolate.getFromMap(m['_objectPool']); 3605 objectPool = isolate.getFromMap(m['_objectPool']);
3589 var disassembly = m['_disassembly']; 3606 var disassembly = m['_disassembly'];
3590 if (disassembly != null) { 3607 if (disassembly != null) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3650 } 3667 }
3651 } 3668 }
3652 3669
3653 @observable bool hasDisassembly = false; 3670 @observable bool hasDisassembly = false;
3654 3671
3655 void _processDisassembly(List<String> disassembly){ 3672 void _processDisassembly(List<String> disassembly){
3656 assert(disassembly != null); 3673 assert(disassembly != null);
3657 instructions.clear(); 3674 instructions.clear();
3658 instructionsByAddressOffset = new List(endAddress - startAddress); 3675 instructionsByAddressOffset = new List(endAddress - startAddress);
3659 3676
3660 assert((disassembly.length % 3) == 0); 3677 assert((disassembly.length % 4) == 0);
3661 for (var i = 0; i < disassembly.length; i += 3) { 3678 for (var i = 0; i < disassembly.length; i += 4) {
3662 var address = 0; // Assume code comment. 3679 var address = 0; // Assume code comment.
3663 var machine = disassembly[i + 1]; 3680 var machine = disassembly[i + 1];
3664 var human = disassembly[i + 2]; 3681 var human = disassembly[i + 2];
3682 var object = disassembly[i + 3];
3683 if (object != null) {
3684 object = new ServiceObject._fromMap(owner, object);
3685 }
3665 var pcOffset = 0; 3686 var pcOffset = 0;
3666 if (disassembly[i] != '') { 3687 if (disassembly[i] != null) {
3667 // Not a code comment, extract address. 3688 // Not a code comment, extract address.
3668 address = int.parse(disassembly[i], radix:16); 3689 address = int.parse(disassembly[i], radix:16);
3669 pcOffset = address - startAddress; 3690 pcOffset = address - startAddress;
3670 } 3691 }
3671 var instruction = new CodeInstruction(address, pcOffset, machine, human); 3692 var instruction =
3693 new CodeInstruction(address, pcOffset, machine, human, object);
3672 instructions.add(instruction); 3694 instructions.add(instruction);
3673 if (disassembly[i] != '') { 3695 if (disassembly[i] != null) {
3674 // Not a code comment. 3696 // Not a code comment.
3675 instructionsByAddressOffset[pcOffset] = instruction; 3697 instructionsByAddressOffset[pcOffset] = instruction;
3676 } 3698 }
3677 } 3699 }
3678 for (var instruction in instructions) { 3700 for (var instruction in instructions) {
3679 instruction._resolveJumpTarget(instructionsByAddressOffset, startAddress); 3701 instruction._resolveJumpTarget(instructionsByAddressOffset, startAddress);
3680 } 3702 }
3681 } 3703 }
3682 3704
3683 void _processDescriptors(List<Map> descriptors) { 3705 void _processDescriptors(List<Map> descriptors) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4000 var v = list[i]; 4022 var v = list[i];
4001 if ((v is ObservableMap) && _isServiceMap(v)) { 4023 if ((v is ObservableMap) && _isServiceMap(v)) {
4002 list[i] = owner.getFromMap(v); 4024 list[i] = owner.getFromMap(v);
4003 } else if (v is ObservableList) { 4025 } else if (v is ObservableList) {
4004 _upgradeObservableList(v, owner); 4026 _upgradeObservableList(v, owner);
4005 } else if (v is ObservableMap) { 4027 } else if (v is ObservableMap) {
4006 _upgradeObservableMap(v, owner); 4028 _upgradeObservableMap(v, owner);
4007 } 4029 }
4008 } 4030 }
4009 } 4031 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/service_ref.html ('k') | runtime/vm/disassembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698