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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 #elif defined(TARGET_ARCH_ARM64) | 283 #elif defined(TARGET_ARCH_ARM64) |
284 bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { | 284 bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { |
285 ASSERT(return_address != NULL); | 285 ASSERT(return_address != NULL); |
286 return false; | 286 return false; |
287 } | 287 } |
288 #elif defined(TARGET_ARCH_MIPS) | 288 #elif defined(TARGET_ARCH_MIPS) |
289 bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { | 289 bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { |
290 ASSERT(return_address != NULL); | 290 ASSERT(return_address != NULL); |
291 return false; | 291 return false; |
292 } | 292 } |
| 293 #elif defined(TARGET_ARCH_DBC) |
| 294 bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) { |
| 295 ASSERT(return_address != NULL); |
| 296 return false; |
| 297 } |
293 #else | 298 #else |
294 #error ReturnAddressLocator implementation missing for this architecture. | 299 #error ReturnAddressLocator implementation missing for this architecture. |
295 #endif | 300 #endif |
296 | 301 |
297 | 302 |
298 bool SampleFilter::TimeFilterSample(Sample* sample) { | 303 bool SampleFilter::TimeFilterSample(Sample* sample) { |
299 if ((time_origin_micros_ == -1) || | 304 if ((time_origin_micros_ == -1) || |
300 (time_extent_micros_ == -1)) { | 305 (time_extent_micros_ == -1)) { |
301 // No time filter passed in, always pass. | 306 // No time filter passed in, always pass. |
302 return true; | 307 return true; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 | 837 |
833 static Sample* SetupSample(Thread* thread, | 838 static Sample* SetupSample(Thread* thread, |
834 SampleBuffer* sample_buffer, | 839 SampleBuffer* sample_buffer, |
835 ThreadId tid) { | 840 ThreadId tid) { |
836 ASSERT(thread != NULL); | 841 ASSERT(thread != NULL); |
837 Isolate* isolate = thread->isolate(); | 842 Isolate* isolate = thread->isolate(); |
838 ASSERT(sample_buffer != NULL); | 843 ASSERT(sample_buffer != NULL); |
839 Sample* sample = sample_buffer->ReserveSample(); | 844 Sample* sample = sample_buffer->ReserveSample(); |
840 sample->Init(isolate, OS::GetCurrentMonotonicMicros(), tid); | 845 sample->Init(isolate, OS::GetCurrentMonotonicMicros(), tid); |
841 uword vm_tag = thread->vm_tag(); | 846 uword vm_tag = thread->vm_tag(); |
842 #if defined(USING_SIMULATOR) | 847 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
843 // When running in the simulator, the runtime entry function address | 848 // When running in the simulator, the runtime entry function address |
844 // (stored as the vm tag) is the address of a redirect function. | 849 // (stored as the vm tag) is the address of a redirect function. |
845 // Attempt to find the real runtime entry function address and use that. | 850 // Attempt to find the real runtime entry function address and use that. |
846 uword redirect_vm_tag = Simulator::FunctionForRedirect(vm_tag); | 851 uword redirect_vm_tag = Simulator::FunctionForRedirect(vm_tag); |
847 if (redirect_vm_tag != 0) { | 852 if (redirect_vm_tag != 0) { |
848 vm_tag = redirect_vm_tag; | 853 vm_tag = redirect_vm_tag; |
849 } | 854 } |
850 #endif | 855 #endif |
851 sample->set_vm_tag(vm_tag); | 856 sample->set_vm_tag(vm_tag); |
852 sample->set_user_tag(isolate->user_tag()); | 857 sample->set_user_tag(isolate->user_tag()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 counters->Increment(sample->vm_tag()); | 971 counters->Increment(sample->vm_tag()); |
967 } | 972 } |
968 | 973 |
969 // Write the single pc value. | 974 // Write the single pc value. |
970 sample->SetAt(0, pc); | 975 sample->SetAt(0, pc); |
971 } | 976 } |
972 | 977 |
973 | 978 |
974 void Profiler::SampleThread(Thread* thread, | 979 void Profiler::SampleThread(Thread* thread, |
975 const InterruptedThreadState& state) { | 980 const InterruptedThreadState& state) { |
| 981 #if defined(TARGET_ARCH_DBC) |
| 982 // TODO(vegorov) implement simulator stack sampling. |
| 983 return; |
| 984 #endif |
| 985 |
976 ASSERT(thread != NULL); | 986 ASSERT(thread != NULL); |
977 OSThread* os_thread = thread->os_thread(); | 987 OSThread* os_thread = thread->os_thread(); |
978 ASSERT(os_thread != NULL); | 988 ASSERT(os_thread != NULL); |
979 Isolate* isolate = thread->isolate(); | 989 Isolate* isolate = thread->isolate(); |
980 | 990 |
981 // Thread is not doing VM work. | 991 // Thread is not doing VM work. |
982 if (thread->task_kind() == Thread::kUnknownTask) { | 992 if (thread->task_kind() == Thread::kUnknownTask) { |
983 return; | 993 return; |
984 } | 994 } |
985 | 995 |
986 if (StubCode::HasBeenInitialized() && | 996 if (StubCode::HasBeenInitialized() && |
987 StubCode::InJumpToExceptionHandlerStub(state.pc)) { | 997 StubCode::InJumpToExceptionHandlerStub(state.pc)) { |
988 // The JumpToExceptionHandler stub manually adjusts the stack pointer, | 998 // The JumpToExceptionHandler stub manually adjusts the stack pointer, |
989 // frame pointer, and some isolate state before jumping to a catch entry. | 999 // frame pointer, and some isolate state before jumping to a catch entry. |
990 // It is not safe to walk the stack when executing this stub. | 1000 // It is not safe to walk the stack when executing this stub. |
991 return; | 1001 return; |
992 } | 1002 } |
993 | 1003 |
994 const bool in_dart_code = thread->IsExecutingDartCode(); | 1004 const bool in_dart_code = thread->IsExecutingDartCode(); |
995 | 1005 |
996 uintptr_t sp = 0; | 1006 uintptr_t sp = 0; |
997 uintptr_t fp = state.fp; | 1007 uintptr_t fp = state.fp; |
998 uintptr_t pc = state.pc; | 1008 uintptr_t pc = state.pc; |
999 #if defined(USING_SIMULATOR) | 1009 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
1000 Simulator* simulator = NULL; | 1010 Simulator* simulator = NULL; |
1001 #endif | 1011 #endif |
1002 | 1012 |
1003 if (in_dart_code) { | 1013 if (in_dart_code) { |
1004 // If we're in Dart code, use the Dart stack pointer. | 1014 // If we're in Dart code, use the Dart stack pointer. |
1005 #if defined(USING_SIMULATOR) | 1015 #if defined(TARGET_ARCH_DBC) |
| 1016 UNIMPLEMENTED(); |
| 1017 #elif defined(USING_SIMULATOR) |
1006 simulator = isolate->simulator(); | 1018 simulator = isolate->simulator(); |
1007 sp = simulator->get_register(SPREG); | 1019 sp = simulator->get_register(SPREG); |
1008 fp = simulator->get_register(FPREG); | 1020 fp = simulator->get_register(FPREG); |
1009 pc = simulator->get_pc(); | 1021 pc = simulator->get_pc(); |
1010 #else | 1022 #else |
1011 sp = state.dsp; | 1023 sp = state.dsp; |
1012 #endif | 1024 #endif |
1013 } else { | 1025 } else { |
1014 // If we're in runtime code, use the C stack pointer. | 1026 // If we're in runtime code, use the C stack pointer. |
1015 sp = state.csp; | 1027 sp = state.csp; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 | 1435 |
1424 | 1436 |
1425 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1437 ProcessedSampleBuffer::ProcessedSampleBuffer() |
1426 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1438 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
1427 ASSERT(code_lookup_table_ != NULL); | 1439 ASSERT(code_lookup_table_ != NULL); |
1428 } | 1440 } |
1429 | 1441 |
1430 #endif // !PRODUCT | 1442 #endif // !PRODUCT |
1431 | 1443 |
1432 } // namespace dart | 1444 } // namespace dart |
OLD | NEW |