| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 | 831 |
| 827 static Sample* SetupSample(Thread* thread, | 832 static Sample* SetupSample(Thread* thread, |
| 828 SampleBuffer* sample_buffer, | 833 SampleBuffer* sample_buffer, |
| 829 ThreadId tid) { | 834 ThreadId tid) { |
| 830 ASSERT(thread != NULL); | 835 ASSERT(thread != NULL); |
| 831 Isolate* isolate = thread->isolate(); | 836 Isolate* isolate = thread->isolate(); |
| 832 ASSERT(sample_buffer != NULL); | 837 ASSERT(sample_buffer != NULL); |
| 833 Sample* sample = sample_buffer->ReserveSample(); | 838 Sample* sample = sample_buffer->ReserveSample(); |
| 834 sample->Init(isolate, OS::GetCurrentMonotonicMicros(), tid); | 839 sample->Init(isolate, OS::GetCurrentMonotonicMicros(), tid); |
| 835 uword vm_tag = thread->vm_tag(); | 840 uword vm_tag = thread->vm_tag(); |
| 836 #if defined(USING_SIMULATOR) | 841 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
| 837 // When running in the simulator, the runtime entry function address | 842 // When running in the simulator, the runtime entry function address |
| 838 // (stored as the vm tag) is the address of a redirect function. | 843 // (stored as the vm tag) is the address of a redirect function. |
| 839 // Attempt to find the real runtime entry function address and use that. | 844 // Attempt to find the real runtime entry function address and use that. |
| 840 uword redirect_vm_tag = Simulator::FunctionForRedirect(vm_tag); | 845 uword redirect_vm_tag = Simulator::FunctionForRedirect(vm_tag); |
| 841 if (redirect_vm_tag != 0) { | 846 if (redirect_vm_tag != 0) { |
| 842 vm_tag = redirect_vm_tag; | 847 vm_tag = redirect_vm_tag; |
| 843 } | 848 } |
| 844 #endif | 849 #endif |
| 845 sample->set_vm_tag(vm_tag); | 850 sample->set_vm_tag(vm_tag); |
| 846 sample->set_user_tag(isolate->user_tag()); | 851 sample->set_user_tag(isolate->user_tag()); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 uintptr_t pc = GetProgramCounter(); | 938 uintptr_t pc = GetProgramCounter(); |
| 934 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); | 939 Sample* sample = SetupSample(thread, sample_buffer, os_thread->trace_id()); |
| 935 sample->SetAllocationCid(cid); | 940 sample->SetAllocationCid(cid); |
| 936 sample->SetAt(0, pc); | 941 sample->SetAt(0, pc); |
| 937 } | 942 } |
| 938 } | 943 } |
| 939 | 944 |
| 940 | 945 |
| 941 void Profiler::SampleThread(Thread* thread, | 946 void Profiler::SampleThread(Thread* thread, |
| 942 const InterruptedThreadState& state) { | 947 const InterruptedThreadState& state) { |
| 948 #if defined(TARGET_ARCH_DBC) |
| 949 // TODO(vegorov) implement simulator stack sampling. |
| 950 return; |
| 951 #endif |
| 952 |
| 943 ASSERT(thread != NULL); | 953 ASSERT(thread != NULL); |
| 944 OSThread* os_thread = thread->os_thread(); | 954 OSThread* os_thread = thread->os_thread(); |
| 945 ASSERT(os_thread != NULL); | 955 ASSERT(os_thread != NULL); |
| 946 Isolate* isolate = thread->isolate(); | 956 Isolate* isolate = thread->isolate(); |
| 947 | 957 |
| 948 if (StubCode::HasBeenInitialized() && | 958 if (StubCode::HasBeenInitialized() && |
| 949 StubCode::InJumpToExceptionHandlerStub(state.pc)) { | 959 StubCode::InJumpToExceptionHandlerStub(state.pc)) { |
| 950 // The JumpToExceptionHandler stub manually adjusts the stack pointer, | 960 // The JumpToExceptionHandler stub manually adjusts the stack pointer, |
| 951 // frame pointer, and some isolate state before jumping to a catch entry. | 961 // frame pointer, and some isolate state before jumping to a catch entry. |
| 952 // It is not safe to walk the stack when executing this stub. | 962 // It is not safe to walk the stack when executing this stub. |
| 953 return; | 963 return; |
| 954 } | 964 } |
| 955 | 965 |
| 956 const bool in_dart_code = thread->IsExecutingDartCode(); | 966 const bool in_dart_code = thread->IsExecutingDartCode(); |
| 957 | 967 |
| 958 uintptr_t sp = 0; | 968 uintptr_t sp = 0; |
| 959 uintptr_t fp = state.fp; | 969 uintptr_t fp = state.fp; |
| 960 uintptr_t pc = state.pc; | 970 uintptr_t pc = state.pc; |
| 961 #if defined(USING_SIMULATOR) | 971 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
| 962 Simulator* simulator = NULL; | 972 Simulator* simulator = NULL; |
| 963 #endif | 973 #endif |
| 964 | 974 |
| 965 if (in_dart_code) { | 975 if (in_dart_code) { |
| 966 // If we're in Dart code, use the Dart stack pointer. | 976 // If we're in Dart code, use the Dart stack pointer. |
| 967 #if defined(USING_SIMULATOR) | 977 #if defined(TARGET_ARCH_DBC) |
| 978 UNIMPLEMENTED(); |
| 979 #elif defined(USING_SIMULATOR) |
| 968 simulator = isolate->simulator(); | 980 simulator = isolate->simulator(); |
| 969 sp = simulator->get_register(SPREG); | 981 sp = simulator->get_register(SPREG); |
| 970 fp = simulator->get_register(FPREG); | 982 fp = simulator->get_register(FPREG); |
| 971 pc = simulator->get_pc(); | 983 pc = simulator->get_pc(); |
| 972 #else | 984 #else |
| 973 sp = state.dsp; | 985 sp = state.dsp; |
| 974 #endif | 986 #endif |
| 975 } else { | 987 } else { |
| 976 // If we're in runtime code, use the C stack pointer. | 988 // If we're in runtime code, use the C stack pointer. |
| 977 sp = state.csp; | 989 sp = state.csp; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 | 1392 |
| 1381 | 1393 |
| 1382 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1394 ProcessedSampleBuffer::ProcessedSampleBuffer() |
| 1383 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1395 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
| 1384 ASSERT(code_lookup_table_ != NULL); | 1396 ASSERT(code_lookup_table_ != NULL); |
| 1385 } | 1397 } |
| 1386 | 1398 |
| 1387 #endif // !PRODUCT | 1399 #endif // !PRODUCT |
| 1388 | 1400 |
| 1389 } // namespace dart | 1401 } // namespace dart |
| OLD | NEW |