| 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 #include "platform/address_sanitizer.h" | 5 #include "platform/address_sanitizer.h" |
| 6 #include "platform/memory_sanitizer.h" | 6 #include "platform/memory_sanitizer.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 | 8 |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 432 |
| 433 private: | 433 private: |
| 434 Sample* sample_; | 434 Sample* sample_; |
| 435 DartFrameIterator frame_iterator_; | 435 DartFrameIterator frame_iterator_; |
| 436 }; | 436 }; |
| 437 | 437 |
| 438 | 438 |
| 439 // Executing Dart code, walk the stack. | 439 // Executing Dart code, walk the stack. |
| 440 class ProfilerDartStackWalker : public ValueObject { | 440 class ProfilerDartStackWalker : public ValueObject { |
| 441 public: | 441 public: |
| 442 ProfilerDartStackWalker(Isolate* isolate, | 442 ProfilerDartStackWalker(Sample* sample, |
| 443 Sample* sample, | |
| 444 uword stack_lower, | 443 uword stack_lower, |
| 445 uword stack_upper, | 444 uword stack_upper, |
| 446 uword pc, | 445 uword pc, |
| 447 uword fp, | 446 uword fp, |
| 448 uword sp) | 447 uword sp) |
| 449 : isolate_(isolate), | 448 : sample_(sample), |
| 450 sample_(sample), | |
| 451 stack_upper_(stack_upper), | 449 stack_upper_(stack_upper), |
| 452 stack_lower_(stack_lower) { | 450 stack_lower_(stack_lower) { |
| 453 ASSERT(sample_ != NULL); | 451 ASSERT(sample_ != NULL); |
| 454 pc_ = reinterpret_cast<uword*>(pc); | 452 pc_ = reinterpret_cast<uword*>(pc); |
| 455 fp_ = reinterpret_cast<uword*>(fp); | 453 fp_ = reinterpret_cast<uword*>(fp); |
| 456 sp_ = reinterpret_cast<uword*>(sp); | 454 sp_ = reinterpret_cast<uword*>(sp); |
| 457 } | 455 } |
| 458 | 456 |
| 459 void walk() { | 457 void walk() { |
| 460 sample_->set_exit_frame_sample(false); | 458 sample_->set_exit_frame_sample(false); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 return false; | 574 return false; |
| 577 } | 575 } |
| 578 uword cursor = reinterpret_cast<uword>(fp); | 576 uword cursor = reinterpret_cast<uword>(fp); |
| 579 cursor += sizeof(fp); | 577 cursor += sizeof(fp); |
| 580 return (cursor >= stack_lower_) && (cursor < stack_upper_); | 578 return (cursor >= stack_lower_) && (cursor < stack_upper_); |
| 581 } | 579 } |
| 582 | 580 |
| 583 uword* pc_; | 581 uword* pc_; |
| 584 uword* fp_; | 582 uword* fp_; |
| 585 uword* sp_; | 583 uword* sp_; |
| 586 Isolate* isolate_; | |
| 587 Sample* sample_; | 584 Sample* sample_; |
| 588 const uword stack_upper_; | 585 const uword stack_upper_; |
| 589 uword stack_lower_; | 586 uword stack_lower_; |
| 590 }; | 587 }; |
| 591 | 588 |
| 592 | 589 |
| 593 // If the VM is compiled without frame pointers (which is the default on | 590 // If the VM is compiled without frame pointers (which is the default on |
| 594 // recent GCC versions with optimizing enabled) the stack walking code may | 591 // recent GCC versions with optimizing enabled) the stack walking code may |
| 595 // fail. | 592 // fail. |
| 596 // | 593 // |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 | 1003 |
| 1007 ProfilerNativeStackWalker native_stack_walker(sample, | 1004 ProfilerNativeStackWalker native_stack_walker(sample, |
| 1008 stack_lower, | 1005 stack_lower, |
| 1009 stack_upper, | 1006 stack_upper, |
| 1010 pc, | 1007 pc, |
| 1011 fp, | 1008 fp, |
| 1012 sp); | 1009 sp); |
| 1013 | 1010 |
| 1014 ProfilerDartExitStackWalker dart_exit_stack_walker(isolate, sample); | 1011 ProfilerDartExitStackWalker dart_exit_stack_walker(isolate, sample); |
| 1015 | 1012 |
| 1016 ProfilerDartStackWalker dart_stack_walker(isolate, | 1013 ProfilerDartStackWalker dart_stack_walker(sample, |
| 1017 sample, | |
| 1018 stack_lower, | 1014 stack_lower, |
| 1019 stack_upper, | 1015 stack_upper, |
| 1020 pc, | 1016 pc, |
| 1021 fp, | 1017 fp, |
| 1022 sp); | 1018 sp); |
| 1023 | 1019 |
| 1024 // All memory access is done inside CollectSample. | 1020 // All memory access is done inside CollectSample. |
| 1025 CollectSample(isolate, | 1021 CollectSample(isolate, |
| 1026 exited_dart_code, | 1022 exited_dart_code, |
| 1027 in_dart_code, | 1023 in_dart_code, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 uword pc) { | 1223 uword pc) { |
| 1228 return vm_isolate->heap()->CodeContains(pc) | 1224 return vm_isolate->heap()->CodeContains(pc) |
| 1229 || isolate->heap()->CodeContains(pc); | 1225 || isolate->heap()->CodeContains(pc); |
| 1230 } | 1226 } |
| 1231 | 1227 |
| 1232 | 1228 |
| 1233 ProcessedSampleBuffer::ProcessedSampleBuffer() { | 1229 ProcessedSampleBuffer::ProcessedSampleBuffer() { |
| 1234 } | 1230 } |
| 1235 | 1231 |
| 1236 } // namespace dart | 1232 } // namespace dart |
| OLD | NEW |