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 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1862 ASSERT(counters != NULL); | 1862 ASSERT(counters != NULL); |
1863 counters->Increment(isolate->vm_tag()); | 1863 counters->Increment(isolate->vm_tag()); |
1864 IsolateProfilerData* profiler_data = isolate->profiler_data(); | 1864 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
1865 if (profiler_data == NULL) { | 1865 if (profiler_data == NULL) { |
1866 return; | 1866 return; |
1867 } | 1867 } |
1868 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); | 1868 SampleBuffer* sample_buffer = profiler_data->sample_buffer(); |
1869 if (sample_buffer == NULL) { | 1869 if (sample_buffer == NULL) { |
1870 return; | 1870 return; |
1871 } | 1871 } |
1872 if (StubCode::InJumpToExceptionHandlerStub(state.pc)) { | |
1873 // The JumpToExceptionHandler stub manually adjusts the stack pointer, | |
1874 // frame pointer, and some isolate state before jumping to a catch entry. | |
1875 // It is not safe to walk the stack when executing this stub. | |
1876 return; | |
1877 } | |
siva
2014/07/16 17:54:09
Maybe move this bail out further up.
| |
1872 Sample* sample = sample_buffer->ReserveSample(); | 1878 Sample* sample = sample_buffer->ReserveSample(); |
1873 sample->Init(isolate, OS::GetCurrentTimeMicros(), state.tid); | 1879 sample->Init(isolate, OS::GetCurrentTimeMicros(), state.tid); |
1874 sample->set_vm_tag(isolate->vm_tag()); | 1880 sample->set_vm_tag(isolate->vm_tag()); |
1875 sample->set_user_tag(isolate->user_tag()); | 1881 sample->set_user_tag(isolate->user_tag()); |
1876 sample->set_sp(state.sp); | 1882 sample->set_sp(state.sp); |
1877 sample->set_fp(state.fp); | 1883 sample->set_fp(state.fp); |
1878 | 1884 |
1879 uword stack_lower = 0; | 1885 uword stack_lower = 0; |
1880 uword stack_upper = 0; | 1886 uword stack_upper = 0; |
1881 isolate->GetStackBounds(&stack_lower, &stack_upper); | 1887 isolate->GetStackBounds(&stack_lower, &stack_upper); |
1882 if ((stack_lower == 0) || (stack_upper == 0)) { | 1888 if ((stack_lower == 0) || (stack_upper == 0)) { |
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 |