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

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

Issue 11193020: Revert recent CPU profiler changes because they broke --prof. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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/platform.h ('k') | src/platform-freebsd.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 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 685 }
686 686
687 void SampleContext(Sampler* sampler) { 687 void SampleContext(Sampler* sampler) {
688 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 688 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
689 if (profiled_thread == NULL) return; 689 if (profiled_thread == NULL) return;
690 690
691 // Context used for sampling the register state of the profiled thread. 691 // Context used for sampling the register state of the profiled thread.
692 CONTEXT context; 692 CONTEXT context;
693 memset(&context, 0, sizeof(context)); 693 memset(&context, 0, sizeof(context));
694 694
695 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 695 TickSample sample_obj;
696 if (sample == NULL) return; 696 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate());
697 if (sample == NULL) sample = &sample_obj;
697 698
698 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 699 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
699 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 700 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
700 sample->state = sampler->isolate()->current_vm_state(); 701 sample->state = sampler->isolate()->current_vm_state();
701 702
702 context.ContextFlags = CONTEXT_FULL; 703 context.ContextFlags = CONTEXT_FULL;
703 if (GetThreadContext(profiled_thread, &context) != 0) { 704 if (GetThreadContext(profiled_thread, &context) != 0) {
704 #if V8_HOST_ARCH_X64 705 #if V8_HOST_ARCH_X64
705 sample->pc = reinterpret_cast<Address>(context.Rip); 706 sample->pc = reinterpret_cast<Address>(context.Rip);
706 sample->sp = reinterpret_cast<Address>(context.Rsp); 707 sample->sp = reinterpret_cast<Address>(context.Rsp);
707 sample->fp = reinterpret_cast<Address>(context.Rbp); 708 sample->fp = reinterpret_cast<Address>(context.Rbp);
708 #else 709 #else
709 sample->pc = reinterpret_cast<Address>(context.Eip); 710 sample->pc = reinterpret_cast<Address>(context.Eip);
710 sample->sp = reinterpret_cast<Address>(context.Esp); 711 sample->sp = reinterpret_cast<Address>(context.Esp);
711 sample->fp = reinterpret_cast<Address>(context.Ebp); 712 sample->fp = reinterpret_cast<Address>(context.Ebp);
712 #endif 713 #endif
713 sampler->SampleStack(sample); 714 sampler->SampleStack(sample);
714 sampler->Tick(sample); 715 sampler->Tick(sample);
715 } 716 }
716 CpuProfiler::FinishTickSampleEvent(sampler->isolate());
717 ResumeThread(profiled_thread); 717 ResumeThread(profiled_thread);
718 } 718 }
719 719
720 const int interval_; 720 const int interval_;
721 RuntimeProfilerRateLimiter rate_limiter_; 721 RuntimeProfilerRateLimiter rate_limiter_;
722 722
723 // Protects the process wide state below. 723 // Protects the process wide state below.
724 static Mutex* mutex_; 724 static Mutex* mutex_;
725 static SamplerThread* instance_; 725 static SamplerThread* instance_;
726 726
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 data_ = new PlatformData; 761 data_ = new PlatformData;
762 } 762 }
763 763
764 764
765 Sampler::~Sampler() { 765 Sampler::~Sampler() {
766 ASSERT(!IsActive()); 766 ASSERT(!IsActive());
767 delete data_; 767 delete data_;
768 } 768 }
769 769
770 770
771 void Sampler::DoSample() {
772 // TODO(rogulenko): implement
773 }
774
775
776 void Sampler::Start() { 771 void Sampler::Start() {
777 ASSERT(!IsActive()); 772 ASSERT(!IsActive());
778 SetActive(true); 773 SetActive(true);
779 SamplerThread::AddActiveSampler(this); 774 SamplerThread::AddActiveSampler(this);
780 } 775 }
781 776
782 777
783 void Sampler::Stop() { 778 void Sampler::Stop() {
784 ASSERT(IsActive()); 779 ASSERT(IsActive());
785 SamplerThread::RemoveActiveSampler(this); 780 SamplerThread::RemoveActiveSampler(this);
786 SetActive(false); 781 SetActive(false);
787 } 782 }
788 783
789 784
790 } } // namespace v8::internal 785 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698