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/utils.h" | 5 #include "platform/utils.h" |
6 | 6 |
7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
8 #include "vm/atomic.h" | 8 #include "vm/atomic.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 | 1851 |
1852 | 1852 |
1853 void Profiler::RecordSampleInterruptCallback( | 1853 void Profiler::RecordSampleInterruptCallback( |
1854 const InterruptedThreadState& state, | 1854 const InterruptedThreadState& state, |
1855 void* data) { | 1855 void* data) { |
1856 Isolate* isolate = reinterpret_cast<Isolate*>(data); | 1856 Isolate* isolate = reinterpret_cast<Isolate*>(data); |
1857 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { | 1857 if ((isolate == NULL) || (Dart::vm_isolate() == NULL)) { |
1858 return; | 1858 return; |
1859 } | 1859 } |
1860 ASSERT(isolate != Dart::vm_isolate()); | 1860 ASSERT(isolate != Dart::vm_isolate()); |
| 1861 if (StubCode::InJumpToExceptionHandlerStub(state.pc)) { |
| 1862 // The JumpToExceptionHandler stub manually adjusts the stack pointer, |
| 1863 // frame pointer, and some isolate state before jumping to a catch entry. |
| 1864 // It is not safe to walk the stack when executing this stub. |
| 1865 return; |
| 1866 } |
1861 VMTagCounters* counters = isolate->vm_tag_counters(); | 1867 VMTagCounters* counters = isolate->vm_tag_counters(); |
1862 ASSERT(counters != NULL); | 1868 ASSERT(counters != NULL); |
1863 counters->Increment(isolate->vm_tag()); | 1869 counters->Increment(isolate->vm_tag()); |
1864 IsolateProfilerData* profiler_data = isolate->profiler_data(); | 1870 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
1865 if (profiler_data == NULL) { | 1871 if (profiler_data == NULL) { |
1866 return; | 1872 return; |
1867 } | 1873 } |
1868 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); | 1874 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); |
1869 if (sample_buffer == NULL) { | 1875 if (sample_buffer == NULL) { |
1870 return; | 1876 return; |
(...skipping 12 matching lines...) Expand all Loading... |
1883 stack_lower = 0; | 1889 stack_lower = 0; |
1884 stack_upper = 0; | 1890 stack_upper = 0; |
1885 } | 1891 } |
1886 if (FLAG_profile_vm) { | 1892 if (FLAG_profile_vm) { |
1887 // Collect native and Dart frames. | 1893 // Collect native and Dart frames. |
1888 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, | 1894 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, |
1889 state.pc, state.fp, state.sp); | 1895 state.pc, state.fp, state.sp); |
1890 stackWalker.walk(isolate->heap()); | 1896 stackWalker.walk(isolate->heap()); |
1891 } else { | 1897 } else { |
1892 if ((isolate->stub_code() != NULL) && | 1898 if ((isolate->stub_code() != NULL) && |
1893 (isolate->top_exit_frame_info() != 0)) { | 1899 (isolate->top_exit_frame_info() != 0) && |
1894 // Collect only Dart frames. | 1900 (isolate->vm_tag() != VMTag::kScriptTagId)) { |
| 1901 // We have a valid exit frame info, use the Dart stack walker. |
1895 ProfilerDartStackWalker stackWalker(isolate, sample); | 1902 ProfilerDartStackWalker stackWalker(isolate, sample); |
1896 stackWalker.walk(); | 1903 stackWalker.walk(); |
1897 } else { | 1904 } else { |
1898 // Collect native and Dart frames. | 1905 // Collect native and Dart frames. |
1899 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, | 1906 ProfilerNativeStackWalker stackWalker(sample, stack_lower, stack_upper, |
1900 state.pc, state.fp, state.sp); | 1907 state.pc, state.fp, state.sp); |
1901 stackWalker.walk(isolate->heap()); | 1908 stackWalker.walk(isolate->heap()); |
1902 } | 1909 } |
1903 } | 1910 } |
1904 } | 1911 } |
1905 | 1912 |
1906 } // namespace dart | 1913 } // namespace dart |
OLD | NEW |