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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 } | 691 } |
692 | 692 |
693 void SampleContext(Sampler* sampler) { | 693 void SampleContext(Sampler* sampler) { |
694 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); | 694 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); |
695 if (profiled_thread == NULL) return; | 695 if (profiled_thread == NULL) return; |
696 | 696 |
697 // Context used for sampling the register state of the profiled thread. | 697 // Context used for sampling the register state of the profiled thread. |
698 CONTEXT context; | 698 CONTEXT context; |
699 memset(&context, 0, sizeof(context)); | 699 memset(&context, 0, sizeof(context)); |
700 | 700 |
| 701 TickSample sample_obj; |
701 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); | 702 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); |
702 if (sample == NULL) return; | 703 if (sample == NULL) sample = &sample_obj; |
703 | 704 |
704 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); | 705 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); |
705 if (SuspendThread(profiled_thread) == kSuspendFailed) return; | 706 if (SuspendThread(profiled_thread) == kSuspendFailed) return; |
706 sample->state = sampler->isolate()->current_vm_state(); | 707 sample->state = sampler->isolate()->current_vm_state(); |
707 | 708 |
708 context.ContextFlags = CONTEXT_FULL; | 709 context.ContextFlags = CONTEXT_FULL; |
709 if (GetThreadContext(profiled_thread, &context) != 0) { | 710 if (GetThreadContext(profiled_thread, &context) != 0) { |
710 #if V8_HOST_ARCH_X64 | 711 #if V8_HOST_ARCH_X64 |
711 sample->pc = reinterpret_cast<Address>(context.Rip); | 712 sample->pc = reinterpret_cast<Address>(context.Rip); |
712 sample->sp = reinterpret_cast<Address>(context.Rsp); | 713 sample->sp = reinterpret_cast<Address>(context.Rsp); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 787 } |
787 | 788 |
788 | 789 |
789 void Sampler::Stop() { | 790 void Sampler::Stop() { |
790 ASSERT(IsActive()); | 791 ASSERT(IsActive()); |
791 SamplerThread::RemoveActiveSampler(this); | 792 SamplerThread::RemoveActiveSampler(this); |
792 SetActive(false); | 793 SetActive(false); |
793 } | 794 } |
794 | 795 |
795 | 796 |
| 797 void Sampler::StartSampling() { |
| 798 } |
| 799 |
| 800 |
| 801 void Sampler::StopSampling() { |
| 802 } |
| 803 |
| 804 |
796 } } // namespace v8::internal | 805 } } // namespace v8::internal |
OLD | NEW |