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

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

Issue 9017009: Reduce signal sender thread stack size to 32k. Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 time_t tv = time(NULL); 319 time_t tv = time(NULL);
320 struct tm* t = localtime(&tv); 320 struct tm* t = localtime(&tv);
321 // tm_gmtoff includes any daylight savings offset, so subtract it. 321 // tm_gmtoff includes any daylight savings offset, so subtract it.
322 return static_cast<double>(t->tm_gmtoff * msPerSecond - 322 return static_cast<double>(t->tm_gmtoff * msPerSecond -
323 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); 323 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
324 } 324 }
325 325
326 326
327 // We keep the lowest and highest addresses mapped as a quick way of 327 // We keep the lowest and highest addresses mapped as a quick way of
328 // determining that pointers are outside the heap (used mostly in assertions 328 // determining that pointers are outside the heap (used mostly in assertions
329 // and verification). The estimate is conservative, ie, not all addresses in 329 // and verification). The estimate is conservative, i.e., not all addresses in
330 // 'allocated' space are actually allocated to our heap. The range is 330 // 'allocated' space are actually allocated to our heap. The range is
331 // [lowest, highest), inclusive on the low and and exclusive on the high end. 331 // [lowest, highest), inclusive on the low and and exclusive on the high end.
332 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); 332 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
333 static void* highest_ever_allocated = reinterpret_cast<void*>(0); 333 static void* highest_ever_allocated = reinterpret_cast<void*>(0);
334 334
335 335
336 static void UpdateAllocatedSpaceLimits(void* address, int size) { 336 static void UpdateAllocatedSpaceLimits(void* address, int size) {
337 ASSERT(limit_mutex != NULL); 337 ASSERT(limit_mutex != NULL);
338 ScopedLock lock(limit_mutex); 338 ScopedLock lock(limit_mutex);
339 339
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 713
714 class Thread::PlatformData : public Malloced { 714 class Thread::PlatformData : public Malloced {
715 public: 715 public:
716 PlatformData() : thread_(kNoThread) {} 716 PlatformData() : thread_(kNoThread) {}
717 717
718 pthread_t thread_; // Thread handle for pthread. 718 pthread_t thread_; // Thread handle for pthread.
719 }; 719 };
720 720
721 Thread::Thread(const Options& options) 721 Thread::Thread(const Options& options)
722 : data_(new PlatformData()), 722 : data_(new PlatformData()),
723 stack_size_(options.stack_size) { 723 stack_size_(options.stack_size()) {
724 set_name(options.name); 724 set_name(options.name());
725 }
726
727
728 Thread::Thread(const char* name)
729 : data_(new PlatformData()),
730 stack_size_(0) {
731 set_name(name);
732 } 725 }
733 726
734 727
735 Thread::~Thread() { 728 Thread::~Thread() {
736 delete data_; 729 delete data_;
737 } 730 }
738 731
739 732
740 static void* ThreadEntry(void* arg) { 733 static void* ThreadEntry(void* arg) {
741 Thread* thread = reinterpret_cast<Thread*>(arg); 734 Thread* thread = reinterpret_cast<Thread*>(arg);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 }; 1021 };
1029 1022
1030 1023
1031 class SignalSender : public Thread { 1024 class SignalSender : public Thread {
1032 public: 1025 public:
1033 enum SleepInterval { 1026 enum SleepInterval {
1034 HALF_INTERVAL, 1027 HALF_INTERVAL,
1035 FULL_INTERVAL 1028 FULL_INTERVAL
1036 }; 1029 };
1037 1030
1031 static const int kSignalSenderStackSize = 32 * KB;
1032
1038 explicit SignalSender(int interval) 1033 explicit SignalSender(int interval)
1039 : Thread("SignalSender"), 1034 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
1040 vm_tgid_(getpid()), 1035 vm_tgid_(getpid()),
1041 interval_(interval) {} 1036 interval_(interval) {}
1042 1037
1043 static void InstallSignalHandler() { 1038 static void InstallSignalHandler() {
1044 struct sigaction sa; 1039 struct sigaction sa;
1045 sa.sa_sigaction = ProfilerSignalHandler; 1040 sa.sa_sigaction = ProfilerSignalHandler;
1046 sigemptyset(&sa.sa_mask); 1041 sigemptyset(&sa.sa_mask);
1047 sa.sa_flags = SA_RESTART | SA_SIGINFO; 1042 sa.sa_flags = SA_RESTART | SA_SIGINFO;
1048 signal_handler_installed_ = 1043 signal_handler_installed_ =
1049 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0); 1044 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1203
1209 1204
1210 void Sampler::Stop() { 1205 void Sampler::Stop() {
1211 ASSERT(IsActive()); 1206 ASSERT(IsActive());
1212 SignalSender::RemoveActiveSampler(this); 1207 SignalSender::RemoveActiveSampler(this);
1213 SetActive(false); 1208 SetActive(false);
1214 } 1209 }
1215 1210
1216 1211
1217 } } // namespace v8::internal 1212 } } // 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