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

Side by Side Diff: src/platform-solaris.cc

Issue 6676019: Sample correct registers on solaris
Patch Set: Created 9 years, 9 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
« 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 27 matching lines...) Expand all
38 #include <ucontext.h> // walkstack(), getcontext() 38 #include <ucontext.h> // walkstack(), getcontext()
39 #include <dlfcn.h> // dladdr 39 #include <dlfcn.h> // dladdr
40 #include <pthread.h> 40 #include <pthread.h>
41 #include <sched.h> // for sched_yield 41 #include <sched.h> // for sched_yield
42 #include <semaphore.h> 42 #include <semaphore.h>
43 #include <time.h> 43 #include <time.h>
44 #include <sys/time.h> // gettimeofday(), timeradd() 44 #include <sys/time.h> // gettimeofday(), timeradd()
45 #include <errno.h> 45 #include <errno.h>
46 #include <ieeefp.h> // finite() 46 #include <ieeefp.h> // finite()
47 #include <signal.h> // sigemptyset(), etc 47 #include <signal.h> // sigemptyset(), etc
48 #include <sys/kdi_regs.h> 48 #include <sys/regset.h>
49 49
50 50
51 #undef MAP_TYPE 51 #undef MAP_TYPE
52 52
53 #include "v8.h" 53 #include "v8.h"
54 54
55 #include "platform.h" 55 #include "platform.h"
56 #include "vm-state-inl.h" 56 #include "vm-state-inl.h"
57 57
58 58
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 TickSample sample_obj; 626 TickSample sample_obj;
627 TickSample* sample = CpuProfiler::TickSampleEvent(); 627 TickSample* sample = CpuProfiler::TickSampleEvent();
628 if (sample == NULL) sample = &sample_obj; 628 if (sample == NULL) sample = &sample_obj;
629 629
630 // Extracting the sample from the context is extremely machine dependent. 630 // Extracting the sample from the context is extremely machine dependent.
631 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 631 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
632 mcontext_t& mcontext = ucontext->uc_mcontext; 632 mcontext_t& mcontext = ucontext->uc_mcontext;
633 sample->state = Top::current_vm_state(); 633 sample->state = Top::current_vm_state();
634 634
635 #if V8_HOST_ARCH_IA32 635 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]);
636 sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EIP]); 636 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]);
637 sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_ESP]); 637 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]);
638 sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EBP]); 638
639 #elif V8_HOST_ARCH_X64
640 sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RIP]);
641 sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RSP]);
642 sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RBP]);
643 #else
644 UNIMPLEMENTED();
645 #endif
646 active_sampler_->SampleStack(sample); 639 active_sampler_->SampleStack(sample);
647 active_sampler_->Tick(sample); 640 active_sampler_->Tick(sample);
648 } 641 }
649 642
650 643
651 class Sampler::PlatformData : public Malloced { 644 class Sampler::PlatformData : public Malloced {
652 public: 645 public:
653 enum SleepInterval { 646 enum SleepInterval {
654 FULL_INTERVAL, 647 FULL_INTERVAL,
655 HALF_INTERVAL 648 HALF_INTERVAL
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 data_->signal_handler_installed_ = false; 776 data_->signal_handler_installed_ = false;
784 } 777 }
785 778
786 // This sampler is no longer the active sampler. 779 // This sampler is no longer the active sampler.
787 active_sampler_ = NULL; 780 active_sampler_ = NULL;
788 } 781 }
789 782
790 #endif // ENABLE_LOGGING_AND_PROFILING 783 #endif // ENABLE_LOGGING_AND_PROFILING
791 784
792 } } // namespace v8::internal 785 } } // namespace v8::internal
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