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

Side by Side Diff: src/sampler.cc

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime-profiler.cc ('k') | src/scanner-character-streams.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 #include "sampler.h" 28 #include "sampler.h"
29 29
30 #if V8_OS_POSIX && !V8_OS_CYGWIN 30 #if V8_OS_POSIX && !V8_OS_CYGWIN
31 31
32 #define USE_SIGNALS 32 #define USE_SIGNALS
33 33
34 #include <errno.h> 34 #include <errno.h>
35 #include <pthread.h> 35 #include <pthread.h>
36 #include <signal.h> 36 #include <signal.h>
37 #include <sys/time.h> 37 #include <sys/time.h>
38
39 #if !V8_OS_QNX
38 #include <sys/syscall.h> 40 #include <sys/syscall.h>
41 #endif
39 42
40 #if V8_OS_MACOSX 43 #if V8_OS_MACOSX
41 #include <mach/mach.h> 44 #include <mach/mach.h>
42 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h> 45 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
43 // and is a typedef for struct sigcontext. There is no uc_mcontext. 46 // and is a typedef for struct sigcontext. There is no uc_mcontext.
44 #elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) \ 47 #elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) \
45 && !V8_OS_OPENBSD 48 && !V8_OS_OPENBSD
46 #include <ucontext.h> 49 #include <ucontext.h>
47 #endif 50 #endif
51
48 #include <unistd.h> 52 #include <unistd.h>
49 53
50 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. 54 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
51 // Old versions of the C library <signal.h> didn't define the type. 55 // Old versions of the C library <signal.h> didn't define the type.
52 #if V8_OS_ANDROID && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ 56 #if V8_OS_ANDROID && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
53 (defined(__arm__) || defined(__aarch64__)) && \ 57 (defined(__arm__) || defined(__aarch64__)) && \
54 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) 58 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
55 #include <asm/sigcontext.h> 59 #include <asm/sigcontext.h>
56 #endif 60 #endif
57 61
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 290
287 static bool Installed() { 291 static bool Installed() {
288 return signal_handler_installed_; 292 return signal_handler_installed_;
289 } 293 }
290 294
291 private: 295 private:
292 static void Install() { 296 static void Install() {
293 struct sigaction sa; 297 struct sigaction sa;
294 sa.sa_sigaction = &HandleProfilerSignal; 298 sa.sa_sigaction = &HandleProfilerSignal;
295 sigemptyset(&sa.sa_mask); 299 sigemptyset(&sa.sa_mask);
300 #if V8_OS_QNX
301 sa.sa_flags = SA_SIGINFO;
302 #else
296 sa.sa_flags = SA_RESTART | SA_SIGINFO; 303 sa.sa_flags = SA_RESTART | SA_SIGINFO;
304 #endif
297 signal_handler_installed_ = 305 signal_handler_installed_ =
298 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0); 306 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
299 } 307 }
300 308
301 static void Restore() { 309 static void Restore() {
302 if (signal_handler_installed_) { 310 if (signal_handler_installed_) {
303 sigaction(SIGPROF, &old_signal_handler_, 0); 311 sigaction(SIGPROF, &old_signal_handler_, 0);
304 signal_handler_installed_ = false; 312 signal_handler_installed_ = false;
305 } 313 }
306 } 314 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp); 453 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp);
446 #elif V8_HOST_ARCH_X64 454 #elif V8_HOST_ARCH_X64
447 state.pc = reinterpret_cast<Address>(ucontext->sc_rip); 455 state.pc = reinterpret_cast<Address>(ucontext->sc_rip);
448 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp); 456 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp);
449 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp); 457 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp);
450 #endif // V8_HOST_ARCH_* 458 #endif // V8_HOST_ARCH_*
451 #elif V8_OS_SOLARIS 459 #elif V8_OS_SOLARIS
452 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]); 460 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]);
453 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]); 461 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]);
454 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]); 462 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]);
455 #endif // V8_OS_SOLARIS 463 #elif V8_OS_QNX
464 #if V8_HOST_ARCH_IA32
465 state.pc = reinterpret_cast<Address>(mcontext.cpu.eip);
466 state.sp = reinterpret_cast<Address>(mcontext.cpu.esp);
467 state.fp = reinterpret_cast<Address>(mcontext.cpu.ebp);
468 #elif V8_HOST_ARCH_ARM
469 state.pc = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_PC]);
470 state.sp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_SP]);
471 state.fp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_FP]);
472 #endif // V8_HOST_ARCH_*
473 #endif // V8_OS_QNX
456 #endif // USE_SIMULATOR 474 #endif // USE_SIMULATOR
457 sampler->SampleStack(state); 475 sampler->SampleStack(state);
458 #endif // V8_OS_NACL 476 #endif // V8_OS_NACL
459 } 477 }
460 478
461 #endif 479 #endif
462 480
463 481
464 class SamplerThread : public Thread { 482 class SamplerThread : public Thread {
465 public: 483 public:
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 #endif // USE_SIMULATOR 733 #endif // USE_SIMULATOR
716 SampleStack(state); 734 SampleStack(state);
717 } 735 }
718 ResumeThread(profiled_thread); 736 ResumeThread(profiled_thread);
719 } 737 }
720 738
721 #endif // USE_SIGNALS 739 #endif // USE_SIGNALS
722 740
723 741
724 } } // namespace v8::internal 742 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime-profiler.cc ('k') | src/scanner-character-streams.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698