| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 ASSERT(ep->ExceptionRecord->ExceptionInformation[0] == 0); | 941 ASSERT(ep->ExceptionRecord->ExceptionInformation[0] == 0); |
| 942 return EXCEPTION_EXECUTE_HANDLER; | 942 return EXCEPTION_EXECUTE_HANDLER; |
| 943 } | 943 } |
| 944 #endif | 944 #endif |
| 945 | 945 |
| 946 // All memory access done to collect the sample is performed in CollectSample. | 946 // All memory access done to collect the sample is performed in CollectSample. |
| 947 static void CollectSample(Isolate* isolate, | 947 static void CollectSample(Isolate* isolate, |
| 948 bool exited_dart_code, | 948 bool exited_dart_code, |
| 949 bool in_dart_code, | 949 bool in_dart_code, |
| 950 Sample* sample, | 950 Sample* sample, |
| 951 uword stack_lower, | 951 ProfilerNativeStackWalker* native_stack_walker, |
| 952 uword stack_upper, | 952 ProfilerDartExitStackWalker* dart_exit_stack_walker, |
| 953 uword pc, | 953 ProfilerDartStackWalker* dart_stack_walker, |
| 954 uword fp, | 954 uword pc) { |
| 955 uword sp) { | |
| 956 ProfilerNativeStackWalker nativeStackWalker(sample, | |
| 957 stack_lower, | |
| 958 stack_upper, | |
| 959 pc, | |
| 960 fp, | |
| 961 sp); | |
| 962 | |
| 963 ProfilerDartExitStackWalker dartExitStackWalker(isolate, sample); | |
| 964 | |
| 965 ProfilerDartStackWalker dartStackWalker(isolate, | |
| 966 sample, | |
| 967 stack_lower, | |
| 968 stack_upper, | |
| 969 pc, | |
| 970 fp, | |
| 971 sp); | |
| 972 | |
| 973 #if defined(TARGET_OS_WINDOWS) | 955 #if defined(TARGET_OS_WINDOWS) |
| 974 // Use structured exception handling to trap guard page access on Windows. | 956 // Use structured exception handling to trap guard page access on Windows. |
| 975 __try { | 957 __try { |
| 976 #endif | 958 #endif |
| 977 | 959 |
| 978 CopyStackBuffer(sample); | 960 CopyStackBuffer(sample); |
| 979 CopyPCMarkerIfSafe(sample); | 961 CopyPCMarkerIfSafe(sample); |
| 980 | 962 |
| 981 if (FLAG_profile_vm) { | 963 if (FLAG_profile_vm) { |
| 982 // Always walk the native stack collecting both native and Dart frames. | 964 // Always walk the native stack collecting both native and Dart frames. |
| 983 nativeStackWalker.walk(); | 965 native_stack_walker->walk(); |
| 984 } else if (exited_dart_code) { | 966 } else if (exited_dart_code) { |
| 985 // We have a valid exit frame info, use the Dart stack walker. | 967 // We have a valid exit frame info, use the Dart stack walker. |
| 986 dartExitStackWalker.walk(); | 968 dart_exit_stack_walker->walk(); |
| 987 } else if (in_dart_code) { | 969 } else if (in_dart_code) { |
| 988 // We are executing Dart code. We have frame pointers. | 970 // We are executing Dart code. We have frame pointers. |
| 989 dartStackWalker.walk(); | 971 dart_stack_walker->walk(); |
| 990 } else { | 972 } else { |
| 991 sample->set_vm_tag(VMTag::kEmbedderTagId); | 973 sample->set_vm_tag(VMTag::kEmbedderTagId); |
| 992 sample->SetAt(0, pc); | 974 sample->SetAt(0, pc); |
| 993 } | 975 } |
| 994 | 976 |
| 995 #if defined(TARGET_OS_WINDOWS) | 977 #if defined(TARGET_OS_WINDOWS) |
| 996 // Use structured exception handling to trap guard page access. | 978 // Use structured exception handling to trap guard page access. |
| 997 } __except(GuardPageExceptionFilter(GetExceptionInformation())) { | 979 } __except(GuardPageExceptionFilter(GetExceptionInformation())) { |
| 998 // Sample collection triggered a guard page fault: | 980 // Sample collection triggered a guard page fault: |
| 999 // 1) discard entire sample. | 981 // 1) discard entire sample. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 // Increment counter for vm tag. | 1129 // Increment counter for vm tag. |
| 1148 VMTagCounters* counters = isolate->vm_tag_counters(); | 1130 VMTagCounters* counters = isolate->vm_tag_counters(); |
| 1149 ASSERT(counters != NULL); | 1131 ASSERT(counters != NULL); |
| 1150 counters->Increment(vm_tag); | 1132 counters->Increment(vm_tag); |
| 1151 sample->set_vm_tag(vm_tag); | 1133 sample->set_vm_tag(vm_tag); |
| 1152 sample->set_user_tag(isolate->user_tag()); | 1134 sample->set_user_tag(isolate->user_tag()); |
| 1153 sample->set_sp(sp); | 1135 sample->set_sp(sp); |
| 1154 sample->set_fp(fp); | 1136 sample->set_fp(fp); |
| 1155 sample->set_lr(lr); | 1137 sample->set_lr(lr); |
| 1156 | 1138 |
| 1139 ProfilerNativeStackWalker native_stack_walker(sample, |
| 1140 stack_lower, |
| 1141 stack_upper, |
| 1142 pc, |
| 1143 fp, |
| 1144 sp); |
| 1145 |
| 1146 ProfilerDartExitStackWalker dart_exit_stack_walker(isolate, sample); |
| 1147 |
| 1148 ProfilerDartStackWalker dart_stack_walker(isolate, |
| 1149 sample, |
| 1150 stack_lower, |
| 1151 stack_upper, |
| 1152 pc, |
| 1153 fp, |
| 1154 sp); |
| 1155 |
| 1157 // All memory access is done inside CollectSample. | 1156 // All memory access is done inside CollectSample. |
| 1158 CollectSample(isolate, | 1157 CollectSample(isolate, |
| 1159 exited_dart_code, | 1158 exited_dart_code, |
| 1160 in_dart_code, | 1159 in_dart_code, |
| 1161 sample, | 1160 sample, |
| 1162 stack_lower, | 1161 &native_stack_walker, |
| 1163 stack_upper, | 1162 &dart_exit_stack_walker, |
| 1164 pc, | 1163 &dart_stack_walker, |
| 1165 fp, | 1164 pc); |
| 1166 sp); | |
| 1167 } | 1165 } |
| 1168 | 1166 |
| 1169 } // namespace dart | 1167 } // namespace dart |
| OLD | NEW |