| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 protected: | 412 protected: |
| 413 Isolate* isolate_; | 413 Isolate* isolate_; |
| 414 Sample* sample_; | 414 Sample* sample_; |
| 415 SampleBuffer* sample_buffer_; | 415 SampleBuffer* sample_buffer_; |
| 416 intptr_t frame_index_; | 416 intptr_t frame_index_; |
| 417 intptr_t total_frames_; | 417 intptr_t total_frames_; |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 | 420 |
| 421 // Given an exit frame, walk the Dart stack. | |
| 422 class ProfilerDartExitStackWalker : public ProfilerStackWalker { | |
| 423 public: | |
| 424 ProfilerDartExitStackWalker(Thread* thread, | |
| 425 Isolate* isolate, | |
| 426 Sample* sample, | |
| 427 SampleBuffer* sample_buffer) | |
| 428 : ProfilerStackWalker(isolate, sample, sample_buffer), | |
| 429 frame_iterator_(thread) {} | |
| 430 | |
| 431 void walk() { | |
| 432 // Mark that this sample was collected from an exit frame. | |
| 433 sample_->set_exit_frame_sample(true); | |
| 434 | |
| 435 StackFrame* frame = frame_iterator_.NextFrame(); | |
| 436 if (sample_ == NULL) { | |
| 437 // Only when we are dumping the stack trace for debug purposes. | |
| 438 Code& code = Code::Handle(); | |
| 439 while (frame != NULL) { | |
| 440 code ^= frame->LookupDartCode(); | |
| 441 if (!Append(frame->pc(), code)) { | |
| 442 return; | |
| 443 } | |
| 444 frame = frame_iterator_.NextFrame(); | |
| 445 } | |
| 446 } else { | |
| 447 while (frame != NULL) { | |
| 448 if (!Append(frame->pc())) { | |
| 449 return; | |
| 450 } | |
| 451 frame = frame_iterator_.NextFrame(); | |
| 452 } | |
| 453 } | |
| 454 } | |
| 455 | |
| 456 private: | |
| 457 DartFrameIterator frame_iterator_; | |
| 458 }; | |
| 459 | |
| 460 | |
| 461 // Executing Dart code, walk the stack. | 421 // Executing Dart code, walk the stack. |
| 462 class ProfilerDartStackWalker : public ProfilerStackWalker { | 422 class ProfilerDartStackWalker : public ProfilerStackWalker { |
| 463 public: | 423 public: |
| 464 ProfilerDartStackWalker(Isolate* isolate, | 424 ProfilerDartStackWalker(Thread* thread, |
| 465 Sample* sample, | 425 Sample* sample, |
| 466 SampleBuffer* sample_buffer, | 426 SampleBuffer* sample_buffer, |
| 467 uword stack_lower, | 427 uword stack_lower, |
| 468 uword stack_upper, | 428 uword stack_upper, |
| 469 uword pc, | 429 uword pc, |
| 470 uword fp, | 430 uword fp, |
| 471 uword sp) | 431 uword sp, |
| 472 : ProfilerStackWalker(isolate, sample, sample_buffer), | 432 bool exited_dart_code, |
| 433 bool allocation_sample) |
| 434 : ProfilerStackWalker(thread->isolate(), sample, sample_buffer), |
| 435 pc_(reinterpret_cast<uword*>(pc)), |
| 436 fp_(reinterpret_cast<uword*>(fp)), |
| 437 sp_(reinterpret_cast<uword*>(sp)), |
| 473 stack_upper_(stack_upper), | 438 stack_upper_(stack_upper), |
| 474 stack_lower_(stack_lower) { | 439 stack_lower_(stack_lower), |
| 475 pc_ = reinterpret_cast<uword*>(pc); | 440 has_exit_frame_(exited_dart_code) { |
| 476 fp_ = reinterpret_cast<uword*>(fp); | 441 if (exited_dart_code) { |
| 477 sp_ = reinterpret_cast<uword*>(sp); | 442 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames, |
| 443 thread); |
| 444 pc_ = NULL; |
| 445 fp_ = NULL; |
| 446 sp_ = NULL; |
| 447 if (!iterator.HasNextFrame()) { |
| 448 return; |
| 449 } |
| 450 // Ensure we are able to get to the exit frame. |
| 451 StackFrame* frame = iterator.NextFrame(); |
| 452 if (!frame->IsExitFrame()) { |
| 453 return; |
| 454 } |
| 455 // Skip the exit frame. |
| 456 if (!iterator.HasNextFrame()) { |
| 457 return; |
| 458 } |
| 459 frame = iterator.NextFrame(); |
| 460 // Record frame details of the first frame from which we start walking. |
| 461 pc_ = reinterpret_cast<uword*>(frame->pc()); |
| 462 fp_ = reinterpret_cast<uword*>(frame->fp()); |
| 463 sp_ = reinterpret_cast<uword*>(frame->sp()); |
| 464 } |
| 478 } | 465 } |
| 479 | 466 |
| 480 void walk() { | 467 void walk() { |
| 481 sample_->set_exit_frame_sample(false); | 468 sample_->set_exit_frame_sample(has_exit_frame_); |
| 482 if (!ValidFramePointer()) { | 469 if (!ValidFramePointer()) { |
| 483 sample_->set_ignore_sample(true); | 470 sample_->set_ignore_sample(true); |
| 484 return; | 471 return; |
| 485 } | 472 } |
| 486 ASSERT(ValidFramePointer()); | 473 ASSERT(ValidFramePointer()); |
| 487 uword return_pc = InitialReturnAddress(); | 474 uword return_pc = InitialReturnAddress(); |
| 488 if (StubCode::InInvocationStub(return_pc)) { | 475 if (StubCode::InInvocationStub(return_pc)) { |
| 489 // Edge case- we have called out from the Invocation Stub but have not | 476 // Edge case- we have called out from the Invocation Stub but have not |
| 490 // created the stack frame of the callee. Attempt to locate the exit | 477 // created the stack frame of the callee. Attempt to locate the exit |
| 491 // frame before walking the stack. | 478 // frame before walking the stack. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 585 } |
| 599 uword cursor = reinterpret_cast<uword>(fp); | 586 uword cursor = reinterpret_cast<uword>(fp); |
| 600 cursor += sizeof(fp); | 587 cursor += sizeof(fp); |
| 601 return (cursor >= stack_lower_) && (cursor < stack_upper_); | 588 return (cursor >= stack_lower_) && (cursor < stack_upper_); |
| 602 } | 589 } |
| 603 | 590 |
| 604 uword* pc_; | 591 uword* pc_; |
| 605 uword* fp_; | 592 uword* fp_; |
| 606 uword* sp_; | 593 uword* sp_; |
| 607 const uword stack_upper_; | 594 const uword stack_upper_; |
| 608 uword stack_lower_; | 595 const uword stack_lower_; |
| 596 bool has_exit_frame_; |
| 609 }; | 597 }; |
| 610 | 598 |
| 611 | 599 |
| 612 // If the VM is compiled without frame pointers (which is the default on | 600 // If the VM is compiled without frame pointers (which is the default on |
| 613 // recent GCC versions with optimizing enabled) the stack walking code may | 601 // recent GCC versions with optimizing enabled) the stack walking code may |
| 614 // fail. | 602 // fail. |
| 615 // | 603 // |
| 616 class ProfilerNativeStackWalker : public ProfilerStackWalker { | 604 class ProfilerNativeStackWalker : public ProfilerStackWalker { |
| 617 public: | 605 public: |
| 618 ProfilerNativeStackWalker(Isolate* isolate, | 606 ProfilerNativeStackWalker(Isolate* isolate, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 return EXCEPTION_EXECUTE_HANDLER; | 739 return EXCEPTION_EXECUTE_HANDLER; |
| 752 } | 740 } |
| 753 #endif | 741 #endif |
| 754 | 742 |
| 755 // All memory access done to collect the sample is performed in CollectSample. | 743 // All memory access done to collect the sample is performed in CollectSample. |
| 756 static void CollectSample(Isolate* isolate, | 744 static void CollectSample(Isolate* isolate, |
| 757 bool exited_dart_code, | 745 bool exited_dart_code, |
| 758 bool in_dart_code, | 746 bool in_dart_code, |
| 759 Sample* sample, | 747 Sample* sample, |
| 760 ProfilerNativeStackWalker* native_stack_walker, | 748 ProfilerNativeStackWalker* native_stack_walker, |
| 761 ProfilerDartExitStackWalker* dart_exit_stack_walker, | |
| 762 ProfilerDartStackWalker* dart_stack_walker, | 749 ProfilerDartStackWalker* dart_stack_walker, |
| 763 uword pc, | 750 uword pc, |
| 764 uword fp, | 751 uword fp, |
| 765 uword sp, | 752 uword sp, |
| 766 ProfilerCounters* counters) { | 753 ProfilerCounters* counters) { |
| 767 ASSERT(counters != NULL); | 754 ASSERT(counters != NULL); |
| 768 #if defined(TARGET_OS_WINDOWS) | 755 #if defined(TARGET_OS_WINDOWS) |
| 769 // Use structured exception handling to trap guard page access on Windows. | 756 // Use structured exception handling to trap guard page access on Windows. |
| 770 __try { | 757 __try { |
| 771 #endif | 758 #endif |
| 772 | 759 |
| 773 if (in_dart_code) { | 760 if (in_dart_code) { |
| 774 // We can only trust the stack pointer if we are executing Dart code. | 761 // We can only trust the stack pointer if we are executing Dart code. |
| 775 // See http://dartbug.com/20421 for details. | 762 // See http://dartbug.com/20421 for details. |
| 776 CopyStackBuffer(sample, sp); | 763 CopyStackBuffer(sample, sp); |
| 777 } | 764 } |
| 778 | 765 |
| 779 if (FLAG_profile_vm) { | 766 if (FLAG_profile_vm) { |
| 780 // Always walk the native stack collecting both native and Dart frames. | 767 // Always walk the native stack collecting both native and Dart frames. |
| 781 AtomicOperations::IncrementInt64By(&counters->stack_walker_native, 1); | 768 AtomicOperations::IncrementInt64By(&counters->stack_walker_native, 1); |
| 782 native_stack_walker->walk(); | 769 native_stack_walker->walk(); |
| 783 } else if (StubCode::HasBeenInitialized() && exited_dart_code) { | 770 } else if (StubCode::HasBeenInitialized() && exited_dart_code) { |
| 784 AtomicOperations::IncrementInt64By(&counters->stack_walker_dart_exit, 1); | 771 AtomicOperations::IncrementInt64By(&counters->stack_walker_dart_exit, 1); |
| 785 // We have a valid exit frame info, use the Dart stack walker. | 772 // We have a valid exit frame info, use the Dart stack walker. |
| 786 dart_exit_stack_walker->walk(); | 773 dart_stack_walker->walk(); |
| 787 } else if (StubCode::HasBeenInitialized() && in_dart_code) { | 774 } else if (StubCode::HasBeenInitialized() && in_dart_code) { |
| 788 AtomicOperations::IncrementInt64By(&counters->stack_walker_dart, 1); | 775 AtomicOperations::IncrementInt64By(&counters->stack_walker_dart, 1); |
| 789 // We are executing Dart code. We have frame pointers. | 776 // We are executing Dart code. We have frame pointers. |
| 790 dart_stack_walker->walk(); | 777 dart_stack_walker->walk(); |
| 791 } else { | 778 } else { |
| 792 AtomicOperations::IncrementInt64By(&counters->stack_walker_none, 1); | 779 AtomicOperations::IncrementInt64By(&counters->stack_walker_none, 1); |
| 793 sample->SetAt(0, pc); | 780 sample->SetAt(0, pc); |
| 794 } | 781 } |
| 795 | 782 |
| 796 #if defined(TARGET_OS_WINDOWS) | 783 #if defined(TARGET_OS_WINDOWS) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 return reinterpret_cast<uintptr_t>(_ReturnAddress()); | 924 return reinterpret_cast<uintptr_t>(_ReturnAddress()); |
| 938 } | 925 } |
| 939 #else | 926 #else |
| 940 static uintptr_t __attribute__((noinline)) GetProgramCounter() { | 927 static uintptr_t __attribute__((noinline)) GetProgramCounter() { |
| 941 return reinterpret_cast<uintptr_t>( | 928 return reinterpret_cast<uintptr_t>( |
| 942 __builtin_extract_return_addr(__builtin_return_address(0))); | 929 __builtin_extract_return_addr(__builtin_return_address(0))); |
| 943 } | 930 } |
| 944 #endif | 931 #endif |
| 945 | 932 |
| 946 | 933 |
| 947 void Profiler::DumpStackTrace(bool native_stack_trace) { | 934 void Profiler::DumpStackTrace() { |
| 948 // Allow only one stack trace to prevent recursively printing stack traces if | 935 // Allow only one stack trace to prevent recursively printing stack traces if |
| 949 // we hit an assert while printing the stack. | 936 // we hit an assert while printing the stack. |
| 950 static uintptr_t started_dump = 0; | 937 static uintptr_t started_dump = 0; |
| 951 if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) { | 938 if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) { |
| 952 OS::PrintErr("Aborting re-entrant request for stack trace.\n"); | 939 OS::PrintErr("Aborting re-entrant request for stack trace.\n"); |
| 953 return; | 940 return; |
| 954 } | 941 } |
| 955 | 942 |
| 956 Thread* thread = Thread::Current(); | 943 Thread* thread = Thread::Current(); |
| 957 if (thread == NULL) { | 944 if (thread == NULL) { |
| 958 return; | 945 return; |
| 959 } | 946 } |
| 960 OSThread* os_thread = thread->os_thread(); | 947 OSThread* os_thread = thread->os_thread(); |
| 961 ASSERT(os_thread != NULL); | 948 ASSERT(os_thread != NULL); |
| 962 Isolate* isolate = thread->isolate(); | 949 Isolate* isolate = thread->isolate(); |
| 963 if (!CheckIsolate(isolate)) { | 950 if (!CheckIsolate(isolate)) { |
| 964 return; | 951 return; |
| 965 } | 952 } |
| 966 | 953 |
| 967 const bool exited_dart_code = thread->HasExitedDartCode(); | 954 OS::PrintErr("Dumping native stack trace for thread %" Px "\n", |
| 968 | |
| 969 OS::PrintErr("Dumping %s stack trace for thread %" Px "\n", | |
| 970 native_stack_trace ? "native" : "dart-only", | |
| 971 OSThread::ThreadIdToIntPtr(os_thread->trace_id())); | 955 OSThread::ThreadIdToIntPtr(os_thread->trace_id())); |
| 972 | 956 |
| 973 uintptr_t sp = Thread::GetCurrentStackPointer(); | 957 uintptr_t sp = Thread::GetCurrentStackPointer(); |
| 974 uintptr_t fp = 0; | 958 uintptr_t fp = 0; |
| 975 uintptr_t pc = GetProgramCounter(); | 959 uintptr_t pc = GetProgramCounter(); |
| 976 | 960 |
| 977 COPY_FP_REGISTER(fp); | 961 COPY_FP_REGISTER(fp); |
| 978 | 962 |
| 979 uword stack_lower = 0; | 963 uword stack_lower = 0; |
| 980 uword stack_upper = 0; | 964 uword stack_upper = 0; |
| 981 | 965 |
| 982 if (!InitialRegisterCheck(pc, fp, sp)) { | 966 if (!InitialRegisterCheck(pc, fp, sp)) { |
| 983 OS::PrintErr("Stack dump aborted because InitialRegisterCheck.\n"); | 967 OS::PrintErr("Stack dump aborted because InitialRegisterCheck.\n"); |
| 984 return; | 968 return; |
| 985 } | 969 } |
| 986 | 970 |
| 987 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, | 971 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, |
| 988 &stack_upper)) { | 972 &stack_upper)) { |
| 989 OS::PrintErr( | 973 OS::PrintErr( |
| 990 "Stack dump aborted because GetAndValidateIsolateStackBounds.\n"); | 974 "Stack dump aborted because GetAndValidateIsolateStackBounds.\n"); |
| 991 return; | 975 return; |
| 992 } | 976 } |
| 993 | 977 |
| 994 if (native_stack_trace) { | 978 ProfilerNativeStackWalker native_stack_walker( |
| 995 ProfilerNativeStackWalker native_stack_walker( | 979 isolate, NULL, NULL, stack_lower, stack_upper, pc, fp, sp); |
| 996 isolate, NULL, NULL, stack_lower, stack_upper, pc, fp, sp); | 980 native_stack_walker.walk(); |
| 997 native_stack_walker.walk(); | |
| 998 } else if (exited_dart_code) { | |
| 999 ProfilerDartExitStackWalker dart_exit_stack_walker(thread, isolate, NULL, | |
| 1000 NULL); | |
| 1001 dart_exit_stack_walker.walk(); | |
| 1002 } else { | |
| 1003 ProfilerDartStackWalker dart_stack_walker(isolate, NULL, NULL, stack_lower, | |
| 1004 stack_upper, pc, fp, sp); | |
| 1005 } | |
| 1006 OS::PrintErr("-- End of DumpStackTrace\n"); | 981 OS::PrintErr("-- End of DumpStackTrace\n"); |
| 1007 } | 982 } |
| 1008 | 983 |
| 1009 | 984 |
| 1010 void Profiler::SampleAllocation(Thread* thread, intptr_t cid) { | 985 void Profiler::SampleAllocation(Thread* thread, intptr_t cid) { |
| 1011 ASSERT(thread != NULL); | 986 ASSERT(thread != NULL); |
| 1012 OSThread* os_thread = thread->os_thread(); | 987 OSThread* os_thread = thread->os_thread(); |
| 1013 ASSERT(os_thread != NULL); | 988 ASSERT(os_thread != NULL); |
| 1014 Isolate* isolate = thread->isolate(); | 989 Isolate* isolate = thread->isolate(); |
| 1015 if (!CheckIsolate(isolate)) { | 990 if (!CheckIsolate(isolate)) { |
| 1016 return; | 991 return; |
| 1017 } | 992 } |
| 1018 | 993 |
| 1019 const bool exited_dart_code = thread->HasExitedDartCode(); | 994 const bool exited_dart_code = thread->HasExitedDartCode(); |
| 1020 | 995 |
| 1021 SampleBuffer* sample_buffer = Profiler::sample_buffer(); | 996 SampleBuffer* sample_buffer = Profiler::sample_buffer(); |
| 1022 if (sample_buffer == NULL) { | 997 if (sample_buffer == NULL) { |
| 1023 // Profiler not initialized. | 998 // Profiler not initialized. |
| 1024 return; | 999 return; |
| 1025 } | 1000 } |
| 1026 | 1001 |
| 1002 uintptr_t sp = Thread::GetCurrentStackPointer(); |
| 1003 uintptr_t fp = 0; |
| 1004 uintptr_t pc = GetProgramCounter(); |
| 1005 |
| 1006 COPY_FP_REGISTER(fp); |
| 1007 |
| 1008 uword stack_lower = 0; |
| 1009 uword stack_upper = 0; |
| 1010 |
| 1011 if (!InitialRegisterCheck(pc, fp, sp)) { |
| 1012 return; |
| 1013 } |
| 1014 |
| 1015 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, |
| 1016 &stack_upper)) { |
| 1017 // Could not get stack boundary. |
| 1018 return; |
| 1019 } |
| 1020 |
| 1021 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| 1022 sample->SetAllocationCid(cid); |
| 1023 |
| 1027 if (FLAG_profile_vm) { | 1024 if (FLAG_profile_vm) { |
| 1028 uintptr_t sp = Thread::GetCurrentStackPointer(); | |
| 1029 uintptr_t fp = 0; | |
| 1030 uintptr_t pc = GetProgramCounter(); | |
| 1031 | |
| 1032 COPY_FP_REGISTER(fp); | |
| 1033 | |
| 1034 uword stack_lower = 0; | |
| 1035 uword stack_upper = 0; | |
| 1036 | |
| 1037 if (!InitialRegisterCheck(pc, fp, sp)) { | |
| 1038 return; | |
| 1039 } | |
| 1040 | |
| 1041 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, | |
| 1042 &stack_upper)) { | |
| 1043 // Could not get stack boundary. | |
| 1044 return; | |
| 1045 } | |
| 1046 | |
| 1047 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | |
| 1048 sample->SetAllocationCid(cid); | |
| 1049 ProfilerNativeStackWalker native_stack_walker( | 1025 ProfilerNativeStackWalker native_stack_walker( |
| 1050 isolate, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp); | 1026 isolate, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp); |
| 1051 native_stack_walker.walk(); | 1027 native_stack_walker.walk(); |
| 1052 } else if (exited_dart_code) { | 1028 } else if (exited_dart_code) { |
| 1053 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | 1029 ProfilerDartStackWalker dart_exit_stack_walker( |
| 1054 sample->SetAllocationCid(cid); | 1030 thread, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp, |
| 1055 ProfilerDartExitStackWalker dart_exit_stack_walker(thread, isolate, sample, | 1031 exited_dart_code, true); |
| 1056 sample_buffer); | |
| 1057 dart_exit_stack_walker.walk(); | 1032 dart_exit_stack_walker.walk(); |
| 1058 } else { | 1033 } else { |
| 1059 // Fall back. | 1034 // Fall back. |
| 1060 uintptr_t pc = GetProgramCounter(); | 1035 uintptr_t pc = GetProgramCounter(); |
| 1061 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | 1036 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| 1062 sample->SetAllocationCid(cid); | 1037 sample->SetAllocationCid(cid); |
| 1063 sample->SetAt(0, pc); | 1038 sample->SetAt(0, pc); |
| 1064 } | 1039 } |
| 1065 } | 1040 } |
| 1066 | 1041 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | 1160 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| 1186 // Increment counter for vm tag. | 1161 // Increment counter for vm tag. |
| 1187 VMTagCounters* counters = isolate->vm_tag_counters(); | 1162 VMTagCounters* counters = isolate->vm_tag_counters(); |
| 1188 ASSERT(counters != NULL); | 1163 ASSERT(counters != NULL); |
| 1189 if (thread->IsMutatorThread()) { | 1164 if (thread->IsMutatorThread()) { |
| 1190 counters->Increment(sample->vm_tag()); | 1165 counters->Increment(sample->vm_tag()); |
| 1191 } | 1166 } |
| 1192 | 1167 |
| 1193 ProfilerNativeStackWalker native_stack_walker( | 1168 ProfilerNativeStackWalker native_stack_walker( |
| 1194 isolate, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp); | 1169 isolate, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp); |
| 1195 | |
| 1196 ProfilerDartExitStackWalker dart_exit_stack_walker(thread, isolate, sample, | |
| 1197 sample_buffer); | |
| 1198 | |
| 1199 ProfilerDartStackWalker dart_stack_walker( | |
| 1200 isolate, sample, sample_buffer, stack_lower, stack_upper, pc, fp, sp); | |
| 1201 | |
| 1202 const bool exited_dart_code = thread->HasExitedDartCode(); | 1170 const bool exited_dart_code = thread->HasExitedDartCode(); |
| 1171 ProfilerDartStackWalker dart_stack_walker(thread, sample, sample_buffer, |
| 1172 stack_lower, stack_upper, pc, fp, |
| 1173 sp, exited_dart_code, false); |
| 1203 | 1174 |
| 1204 // All memory access is done inside CollectSample. | 1175 // All memory access is done inside CollectSample. |
| 1205 CollectSample(isolate, exited_dart_code, in_dart_code, sample, | 1176 CollectSample(isolate, exited_dart_code, in_dart_code, sample, |
| 1206 &native_stack_walker, &dart_exit_stack_walker, | 1177 &native_stack_walker, &dart_stack_walker, pc, fp, sp, |
| 1207 &dart_stack_walker, pc, fp, sp, &counters_); | 1178 &counters_); |
| 1208 } | 1179 } |
| 1209 | 1180 |
| 1210 | 1181 |
| 1211 CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) { | 1182 CodeDescriptor::CodeDescriptor(const Code& code) : code_(code) { |
| 1212 ASSERT(!code_.IsNull()); | 1183 ASSERT(!code_.IsNull()); |
| 1213 } | 1184 } |
| 1214 | 1185 |
| 1215 | 1186 |
| 1216 uword CodeDescriptor::Start() const { | 1187 uword CodeDescriptor::Start() const { |
| 1217 return code_.PayloadStart(); | 1188 return code_.PayloadStart(); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 | 1500 |
| 1530 | 1501 |
| 1531 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1502 ProcessedSampleBuffer::ProcessedSampleBuffer() |
| 1532 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1503 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
| 1533 ASSERT(code_lookup_table_ != NULL); | 1504 ASSERT(code_lookup_table_ != NULL); |
| 1534 } | 1505 } |
| 1535 | 1506 |
| 1536 #endif // !PRODUCT | 1507 #endif // !PRODUCT |
| 1537 | 1508 |
| 1538 } // namespace dart | 1509 } // namespace dart |
| OLD | NEW |