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

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

Issue 9836108: Rollback of r11015, r11014, r11011, r11010 in trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Finish file upload Created 8 years, 8 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-freebsd.cc ('k') | src/platform-macos.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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 } 1086 }
1087 1087
1088 static void RestoreSignalHandler() { 1088 static void RestoreSignalHandler() {
1089 if (signal_handler_installed_) { 1089 if (signal_handler_installed_) {
1090 sigaction(SIGPROF, &old_signal_handler_, 0); 1090 sigaction(SIGPROF, &old_signal_handler_, 0);
1091 signal_handler_installed_ = false; 1091 signal_handler_installed_ = false;
1092 } 1092 }
1093 } 1093 }
1094 1094
1095 static void AddActiveSampler(Sampler* sampler) { 1095 static void AddActiveSampler(Sampler* sampler) {
1096 ScopedLock lock(mutex_.Pointer()); 1096 ScopedLock lock(mutex_);
1097 SamplerRegistry::AddActiveSampler(sampler); 1097 SamplerRegistry::AddActiveSampler(sampler);
1098 if (instance_ == NULL) { 1098 if (instance_ == NULL) {
1099 // Start a thread that will send SIGPROF signal to VM threads, 1099 // Start a thread that will send SIGPROF signal to VM threads,
1100 // when CPU profiling will be enabled. 1100 // when CPU profiling will be enabled.
1101 instance_ = new SignalSender(sampler->interval()); 1101 instance_ = new SignalSender(sampler->interval());
1102 instance_->Start(); 1102 instance_->Start();
1103 } else { 1103 } else {
1104 ASSERT(instance_->interval_ == sampler->interval()); 1104 ASSERT(instance_->interval_ == sampler->interval());
1105 } 1105 }
1106 } 1106 }
1107 1107
1108 static void RemoveActiveSampler(Sampler* sampler) { 1108 static void RemoveActiveSampler(Sampler* sampler) {
1109 ScopedLock lock(mutex_.Pointer()); 1109 ScopedLock lock(mutex_);
1110 SamplerRegistry::RemoveActiveSampler(sampler); 1110 SamplerRegistry::RemoveActiveSampler(sampler);
1111 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 1111 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
1112 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 1112 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_);
1113 delete instance_; 1113 delete instance_;
1114 instance_ = NULL; 1114 instance_ = NULL;
1115 RestoreSignalHandler(); 1115 RestoreSignalHandler();
1116 } 1116 }
1117 } 1117 }
1118 1118
1119 // Implement Thread::Run(). 1119 // Implement Thread::Run().
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 #endif // DEBUG 1202 #endif // DEBUG
1203 USE(result); 1203 USE(result);
1204 #endif // ANDROID 1204 #endif // ANDROID
1205 } 1205 }
1206 1206
1207 const int vm_tgid_; 1207 const int vm_tgid_;
1208 const int interval_; 1208 const int interval_;
1209 RuntimeProfilerRateLimiter rate_limiter_; 1209 RuntimeProfilerRateLimiter rate_limiter_;
1210 1210
1211 // Protects the process wide state below. 1211 // Protects the process wide state below.
1212 static LazyMutex mutex_; 1212 static Mutex* mutex_;
1213 static SignalSender* instance_; 1213 static SignalSender* instance_;
1214 static bool signal_handler_installed_; 1214 static bool signal_handler_installed_;
1215 static struct sigaction old_signal_handler_; 1215 static struct sigaction old_signal_handler_;
1216 1216
1217 private: 1217 private:
1218 DISALLOW_COPY_AND_ASSIGN(SignalSender); 1218 DISALLOW_COPY_AND_ASSIGN(SignalSender);
1219 }; 1219 };
1220 1220
1221 1221
1222 LazyMutex SignalSender::mutex_ = LAZY_MUTEX_INITIALIZER; 1222 Mutex* SignalSender::mutex_ = OS::CreateMutex();
1223 SignalSender* SignalSender::instance_ = NULL; 1223 SignalSender* SignalSender::instance_ = NULL;
1224 struct sigaction SignalSender::old_signal_handler_; 1224 struct sigaction SignalSender::old_signal_handler_;
1225 bool SignalSender::signal_handler_installed_ = false; 1225 bool SignalSender::signal_handler_installed_ = false;
1226 1226
1227 1227
1228 Sampler::Sampler(Isolate* isolate, int interval) 1228 Sampler::Sampler(Isolate* isolate, int interval)
1229 : isolate_(isolate), 1229 : isolate_(isolate),
1230 interval_(interval), 1230 interval_(interval),
1231 profiling_(false), 1231 profiling_(false),
1232 active_(false), 1232 active_(false),
(...skipping 16 matching lines...) Expand all
1249 1249
1250 1250
1251 void Sampler::Stop() { 1251 void Sampler::Stop() {
1252 ASSERT(IsActive()); 1252 ASSERT(IsActive());
1253 SignalSender::RemoveActiveSampler(this); 1253 SignalSender::RemoveActiveSampler(this);
1254 SetActive(false); 1254 SetActive(false);
1255 } 1255 }
1256 1256
1257 1257
1258 } } // namespace v8::internal 1258 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698