| 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1146     SamplerRegistry::State state; | 1146     SamplerRegistry::State state; | 
| 1147     while ((state = SamplerRegistry::GetState()) != | 1147     while ((state = SamplerRegistry::GetState()) != | 
| 1148            SamplerRegistry::HAS_NO_SAMPLERS) { | 1148            SamplerRegistry::HAS_NO_SAMPLERS) { | 
| 1149       // When CPU profiling is enabled both JavaScript and C++ code is | 1149       // When CPU profiling is enabled both JavaScript and C++ code is | 
| 1150       // profiled. We must not suspend. | 1150       // profiled. We must not suspend. | 
| 1151       if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { | 1151       if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { | 
| 1152         if (!signal_handler_installed_) InstallSignalHandler(); | 1152         if (!signal_handler_installed_) InstallSignalHandler(); | 
| 1153         SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); | 1153         SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); | 
| 1154       } else { | 1154       } else { | 
| 1155         if (signal_handler_installed_) RestoreSignalHandler(); | 1155         if (signal_handler_installed_) RestoreSignalHandler(); | 
| 1156         if (rate_limiter_.SuspendIfNecessary()) continue; | 1156         if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue; | 
| 1157       } | 1157       } | 
| 1158       Sleep();  // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. | 1158       Sleep();  // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. | 
| 1159     } | 1159     } | 
| 1160   } | 1160   } | 
| 1161 | 1161 | 
| 1162   static void DoCpuProfile(Sampler* sampler, void* raw_sender) { | 1162   static void DoCpuProfile(Sampler* sampler, void* raw_sender) { | 
| 1163     if (!sampler->IsProfiling()) return; | 1163     if (!sampler->IsProfiling()) return; | 
| 1164     SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); | 1164     SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); | 
| 1165     sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); | 1165     sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); | 
| 1166   } | 1166   } | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 1191               errno); | 1191               errno); | 
| 1192       ASSERT(result == 0 || errno == EINTR); | 1192       ASSERT(result == 0 || errno == EINTR); | 
| 1193     } | 1193     } | 
| 1194 #endif  // DEBUG | 1194 #endif  // DEBUG | 
| 1195     USE(result); | 1195     USE(result); | 
| 1196 #endif  // ANDROID | 1196 #endif  // ANDROID | 
| 1197   } | 1197   } | 
| 1198 | 1198 | 
| 1199   const int vm_tgid_; | 1199   const int vm_tgid_; | 
| 1200   const int interval_; | 1200   const int interval_; | 
| 1201   RuntimeProfilerRateLimiter rate_limiter_; |  | 
| 1202 | 1201 | 
| 1203   // Protects the process wide state below. | 1202   // Protects the process wide state below. | 
| 1204   static Mutex* mutex_; | 1203   static Mutex* mutex_; | 
| 1205   static SignalSender* instance_; | 1204   static SignalSender* instance_; | 
| 1206   static bool signal_handler_installed_; | 1205   static bool signal_handler_installed_; | 
| 1207   static struct sigaction old_signal_handler_; | 1206   static struct sigaction old_signal_handler_; | 
| 1208 | 1207 | 
| 1209  private: | 1208  private: | 
| 1210   DISALLOW_COPY_AND_ASSIGN(SignalSender); | 1209   DISALLOW_COPY_AND_ASSIGN(SignalSender); | 
| 1211 }; | 1210 }; | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1275 | 1274 | 
| 1276 | 1275 | 
| 1277 void Sampler::Stop() { | 1276 void Sampler::Stop() { | 
| 1278   ASSERT(IsActive()); | 1277   ASSERT(IsActive()); | 
| 1279   SignalSender::RemoveActiveSampler(this); | 1278   SignalSender::RemoveActiveSampler(this); | 
| 1280   SetActive(false); | 1279   SetActive(false); | 
| 1281 } | 1280 } | 
| 1282 | 1281 | 
| 1283 | 1282 | 
| 1284 } }  // namespace v8::internal | 1283 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|