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

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

Issue 11543020: Removed RuntimeProfilerRateLimiter class and RuntimeProfiler::IsSomeIsolateInJS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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-linux.cc ('k') | src/platform-openbsd.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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 // Implement Thread::Run(). 785 // Implement Thread::Run().
786 virtual void Run() { 786 virtual void Run() {
787 SamplerRegistry::State state; 787 SamplerRegistry::State state;
788 while ((state = SamplerRegistry::GetState()) != 788 while ((state = SamplerRegistry::GetState()) !=
789 SamplerRegistry::HAS_NO_SAMPLERS) { 789 SamplerRegistry::HAS_NO_SAMPLERS) {
790 // When CPU profiling is enabled both JavaScript and C++ code is 790 // When CPU profiling is enabled both JavaScript and C++ code is
791 // profiled. We must not suspend. 791 // profiled. We must not suspend.
792 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 792 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
793 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 793 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
794 } else { 794 } else {
795 if (rate_limiter_.SuspendIfNecessary()) continue; 795 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
796 } 796 }
797 OS::Sleep(interval_); 797 OS::Sleep(interval_);
798 } 798 }
799 } 799 }
800 800
801 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) { 801 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) {
802 if (!sampler->isolate()->IsInitialized()) return; 802 if (!sampler->isolate()->IsInitialized()) return;
803 if (!sampler->IsProfiling()) return; 803 if (!sampler->IsProfiling()) return;
804 SamplerThread* sampler_thread = 804 SamplerThread* sampler_thread =
805 reinterpret_cast<SamplerThread*>(raw_sampler_thread); 805 reinterpret_cast<SamplerThread*>(raw_sampler_thread);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 sample->pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip)); 844 sample->pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip));
845 sample->sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp)); 845 sample->sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp));
846 sample->fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp)); 846 sample->fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp));
847 sampler->SampleStack(sample); 847 sampler->SampleStack(sample);
848 sampler->Tick(sample); 848 sampler->Tick(sample);
849 } 849 }
850 thread_resume(profiled_thread); 850 thread_resume(profiled_thread);
851 } 851 }
852 852
853 const int interval_; 853 const int interval_;
854 RuntimeProfilerRateLimiter rate_limiter_;
855 854
856 // Protects the process wide state below. 855 // Protects the process wide state below.
857 static Mutex* mutex_; 856 static Mutex* mutex_;
858 static SamplerThread* instance_; 857 static SamplerThread* instance_;
859 858
860 private: 859 private:
861 DISALLOW_COPY_AND_ASSIGN(SamplerThread); 860 DISALLOW_COPY_AND_ASSIGN(SamplerThread);
862 }; 861 };
863 862
864 #undef REGISTER_FIELD 863 #undef REGISTER_FIELD
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 906
908 907
909 void Sampler::Stop() { 908 void Sampler::Stop() {
910 ASSERT(IsActive()); 909 ASSERT(IsActive());
911 SamplerThread::RemoveActiveSampler(this); 910 SamplerThread::RemoveActiveSampler(this);
912 SetActive(false); 911 SetActive(false);
913 } 912 }
914 913
915 914
916 } } // namespace v8::internal 915 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698