Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: runtime/vm/profiler.cc

Issue 2513173002: Attempt to fix win64 test failures. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 return reinterpret_cast<uintptr_t>(_ReturnAddress()); 924 return reinterpret_cast<uintptr_t>(_ReturnAddress());
925 } 925 }
926 #else 926 #else
927 static uintptr_t __attribute__((noinline)) GetProgramCounter() { 927 static uintptr_t __attribute__((noinline)) GetProgramCounter() {
928 return reinterpret_cast<uintptr_t>( 928 return reinterpret_cast<uintptr_t>(
929 __builtin_extract_return_addr(__builtin_return_address(0))); 929 __builtin_extract_return_addr(__builtin_return_address(0)));
930 } 930 }
931 #endif 931 #endif
932 932
933 933
934 #if defined(TARGET_OS_WINDOWS)
935 static uintptr_t GetFramePointer() {
936 #if defined(HOST_ARCH_IA32)
937 uintptr_t fp = 0;
938 COPY_FP_REGISTER(fp);
939 return fp;
940 #else
941 // We don't have the asm equivalent to get at the frame pointer on
942 // windows x64, return the stack pointer instead.
943 return Thread::GetCurrentStackPointer();
944 #endif // defined(HOST_ARCH_IA32).
945 }
946 #else
947 static uintptr_t GetFramePointer() {
948 uintptr_t fp = 0;
949 COPY_FP_REGISTER(fp);
950 return fp;
951 }
952 #endif // defined(TARGET_OS_WINDOWS).
953
954
934 void Profiler::DumpStackTrace() { 955 void Profiler::DumpStackTrace() {
935 // Allow only one stack trace to prevent recursively printing stack traces if 956 // Allow only one stack trace to prevent recursively printing stack traces if
936 // we hit an assert while printing the stack. 957 // we hit an assert while printing the stack.
937 static uintptr_t started_dump = 0; 958 static uintptr_t started_dump = 0;
938 if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) { 959 if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) {
939 OS::PrintErr("Aborting re-entrant request for stack trace.\n"); 960 OS::PrintErr("Aborting re-entrant request for stack trace.\n");
940 return; 961 return;
941 } 962 }
942 963
943 Thread* thread = Thread::Current(); 964 Thread* thread = Thread::Current();
944 if (thread == NULL) { 965 if (thread == NULL) {
945 return; 966 return;
946 } 967 }
947 OSThread* os_thread = thread->os_thread(); 968 OSThread* os_thread = thread->os_thread();
948 ASSERT(os_thread != NULL); 969 ASSERT(os_thread != NULL);
949 Isolate* isolate = thread->isolate(); 970 Isolate* isolate = thread->isolate();
950 if (!CheckIsolate(isolate)) { 971 if (!CheckIsolate(isolate)) {
951 return; 972 return;
952 } 973 }
953 974
954 OS::PrintErr("Dumping native stack trace for thread %" Px "\n", 975 OS::PrintErr("Dumping native stack trace for thread %" Px "\n",
955 OSThread::ThreadIdToIntPtr(os_thread->trace_id())); 976 OSThread::ThreadIdToIntPtr(os_thread->trace_id()));
956 977
957 uintptr_t sp = Thread::GetCurrentStackPointer(); 978 uintptr_t sp = Thread::GetCurrentStackPointer();
958 uintptr_t fp = 0; 979 uintptr_t fp = GetFramePointer();
959 uintptr_t pc = GetProgramCounter(); 980 uintptr_t pc = GetProgramCounter();
960
961 COPY_FP_REGISTER(fp);
962
963 uword stack_lower = 0; 981 uword stack_lower = 0;
964 uword stack_upper = 0; 982 uword stack_upper = 0;
965 983
966 if (!InitialRegisterCheck(pc, fp, sp)) { 984 if (!InitialRegisterCheck(pc, fp, sp)) {
967 OS::PrintErr("Stack dump aborted because InitialRegisterCheck.\n"); 985 OS::PrintErr("Stack dump aborted because InitialRegisterCheck.\n");
968 return; 986 return;
969 } 987 }
970 988
971 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, 989 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower,
972 &stack_upper)) { 990 &stack_upper)) {
(...skipping 20 matching lines...) Expand all
993 1011
994 const bool exited_dart_code = thread->HasExitedDartCode(); 1012 const bool exited_dart_code = thread->HasExitedDartCode();
995 1013
996 SampleBuffer* sample_buffer = Profiler::sample_buffer(); 1014 SampleBuffer* sample_buffer = Profiler::sample_buffer();
997 if (sample_buffer == NULL) { 1015 if (sample_buffer == NULL) {
998 // Profiler not initialized. 1016 // Profiler not initialized.
999 return; 1017 return;
1000 } 1018 }
1001 1019
1002 uintptr_t sp = Thread::GetCurrentStackPointer(); 1020 uintptr_t sp = Thread::GetCurrentStackPointer();
1003 uintptr_t fp = 0; 1021 uintptr_t fp = GetFramePointer();
1004 uintptr_t pc = GetProgramCounter(); 1022 uintptr_t pc = GetProgramCounter();
1005
1006 COPY_FP_REGISTER(fp);
1007
1008 uword stack_lower = 0; 1023 uword stack_lower = 0;
1009 uword stack_upper = 0; 1024 uword stack_upper = 0;
1010 1025
1011 if (!InitialRegisterCheck(pc, fp, sp)) { 1026 if (!InitialRegisterCheck(pc, fp, sp)) {
1012 return; 1027 return;
1013 } 1028 }
1014 1029
1015 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower, 1030 if (!GetAndValidateIsolateStackBounds(thread, fp, sp, &stack_lower,
1016 &stack_upper)) { 1031 &stack_upper)) {
1017 // Could not get stack boundary. 1032 // Could not get stack boundary.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 1515
1501 1516
1502 ProcessedSampleBuffer::ProcessedSampleBuffer() 1517 ProcessedSampleBuffer::ProcessedSampleBuffer()
1503 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { 1518 : code_lookup_table_(new CodeLookupTable(Thread::Current())) {
1504 ASSERT(code_lookup_table_ != NULL); 1519 ASSERT(code_lookup_table_ != NULL);
1505 } 1520 }
1506 1521
1507 #endif // !PRODUCT 1522 #endif // !PRODUCT
1508 1523
1509 } // namespace dart 1524 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698