OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 return; | 677 return; |
678 } | 678 } |
679 if (v8::Locker::IsActive() && | 679 if (v8::Locker::IsActive() && |
680 !isolate->thread_manager()->IsLockedByCurrentThread()) { | 680 !isolate->thread_manager()->IsLockedByCurrentThread()) { |
681 return; | 681 return; |
682 } | 682 } |
683 | 683 |
684 Sampler* sampler = isolate->logger()->sampler(); | 684 Sampler* sampler = isolate->logger()->sampler(); |
685 if (sampler == NULL || !sampler->IsActive()) return; | 685 if (sampler == NULL || !sampler->IsActive()) return; |
686 | 686 |
| 687 TickSample sample_obj; |
687 TickSample* sample = CpuProfiler::StartTickSampleEvent(isolate); | 688 TickSample* sample = CpuProfiler::StartTickSampleEvent(isolate); |
688 if (sample == NULL) return; | 689 if (sample == NULL) sample = &sample_obj; |
689 | 690 |
690 // Extracting the sample from the context is extremely machine dependent. | 691 // Extracting the sample from the context is extremely machine dependent. |
691 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 692 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
692 mcontext_t& mcontext = ucontext->uc_mcontext; | 693 mcontext_t& mcontext = ucontext->uc_mcontext; |
693 sample->state = isolate->current_vm_state(); | 694 sample->state = isolate->current_vm_state(); |
694 #if V8_HOST_ARCH_IA32 | 695 #if V8_HOST_ARCH_IA32 |
695 sample->pc = reinterpret_cast<Address>(mcontext.mc_eip); | 696 sample->pc = reinterpret_cast<Address>(mcontext.mc_eip); |
696 sample->sp = reinterpret_cast<Address>(mcontext.mc_esp); | 697 sample->sp = reinterpret_cast<Address>(mcontext.mc_esp); |
697 sample->fp = reinterpret_cast<Address>(mcontext.mc_ebp); | 698 sample->fp = reinterpret_cast<Address>(mcontext.mc_ebp); |
698 #elif V8_HOST_ARCH_X64 | 699 #elif V8_HOST_ARCH_X64 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 } | 903 } |
903 | 904 |
904 | 905 |
905 void Sampler::Stop() { | 906 void Sampler::Stop() { |
906 ASSERT(IsActive()); | 907 ASSERT(IsActive()); |
907 SignalSender::RemoveActiveSampler(this); | 908 SignalSender::RemoveActiveSampler(this); |
908 SetActive(false); | 909 SetActive(false); |
909 } | 910 } |
910 | 911 |
911 | 912 |
| 913 void Sampler::StartSampling() { |
| 914 } |
| 915 |
| 916 |
| 917 void Sampler::StopSampling() { |
| 918 } |
| 919 |
| 920 |
912 } } // namespace v8::internal | 921 } } // namespace v8::internal |
OLD | NEW |