Revision: 10490
Author: [email protected]
Date: Tue Jan 24 07:48:16 2012
Log: Reduce the space used by the stack for the profiling thread.
Review URL: https://chromiumcodereview.appspot.com/9117032
http://code.google.com/p/v8/source/detail?r=10490
Modified:
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/src/d8.cc
/branches/bleeding_edge/src/heap-inl.h
/branches/bleeding_edge/src/platform-freebsd.cc
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform-macos.cc
/branches/bleeding_edge/src/platform-openbsd.cc
/branches/bleeding_edge/src/platform-solaris.cc
/branches/bleeding_edge/src/platform-win32.cc
/branches/bleeding_edge/src/platform.h
/branches/bleeding_edge/test/cctest/test-mark-compact.cc
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Tue Jan 17 05:13:55 2012
+++ /branches/bleeding_edge/src/cpu-profiler.cc Tue Jan 24 07:48:16 2012
@@ -39,13 +39,14 @@
namespace v8 {
namespace internal {
-static const int kEventsBufferSize = 256*KB;
-static const int kTickSamplesBufferChunkSize = 64*KB;
+static const int kEventsBufferSize = 256 * KB;
+static const int kTickSamplesBufferChunkSize = 64 * KB;
static const int kTickSamplesBufferChunksCount = 16;
+static const int kProfilerStackSize = 32 * KB;
ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator*
generator)
- : Thread("v8:ProfEvntProc"),
+ : Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
generator_(generator),
running_(true),
ticks_buffer_(sizeof(TickSampleEventRecord),
=======================================
--- /branches/bleeding_edge/src/d8.cc Tue Jan 24 04:10:28 2012
+++ /branches/bleeding_edge/src/d8.cc Tue Jan 24 07:48:16 2012
@@ -120,6 +120,9 @@
const char* Shell::kPrompt = "d8> ";
+const int MB = 1024 * 1024;
+
+
#ifndef V8_SHARED
bool CounterMap::Match(void* key1, void* key2) {
const char* name1 = reinterpret_cast<const char*>(key1);
@@ -1210,14 +1213,11 @@
#ifndef V8_SHARED
i::Thread::Options SourceGroup::GetThreadOptions() {
- i::Thread::Options options;
- options.name = "IsolateThread";
// On some systems (OSX 10.6) the stack size default is 0.5Mb or less
// which is not enough to parse the big literal expressions used in
tests.
// The stack size should be at least StackGuard::kLimitSize + some
- // OS-specific padding for thread startup code.
- options.stack_size = 2 << 20; // 2 Mb seems to be enough
- return options;
+ // OS-specific padding for thread startup code. 2Mbytes seems to be
enough.
+ return i::Thread::Options("IsolateThread", 2 * MB);
}
=======================================
--- /branches/bleeding_edge/src/heap-inl.h Tue Jan 17 05:13:55 2012
+++ /branches/bleeding_edge/src/heap-inl.h Tue Jan 24 07:48:16 2012
@@ -505,7 +505,6 @@
#define GC_GREEDY_CHECK() { }
#endif
-
// Calls the FUNCTION_CALL function and retries it up to three times
// to guarantee that any allocations performed during the call will
// succeed if there's enough memory.
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-freebsd.cc Tue Jan 24 07:48:16 2012
@@ -464,15 +464,8 @@
Thread::Thread(const Options& options)
: data_(new PlatformData),
- stack_size_(options.stack_size) {
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : data_(new PlatformData),
- stack_size_(0) {
- set_name(name);
+ stack_size_(options.stack_size()) {
+ set_name(options.name());
}
@@ -717,8 +710,10 @@
FULL_INTERVAL
};
+ static const int kSignalSenderStackSize = 32 * KB;
+
explicit SignalSender(int interval)
- : Thread("SignalSender"),
+ : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-linux.cc Tue Jan 24 07:48:16 2012
@@ -720,15 +720,8 @@
Thread::Thread(const Options& options)
: data_(new PlatformData()),
- stack_size_(options.stack_size) {
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : data_(new PlatformData()),
- stack_size_(0) {
- set_name(name);
+ stack_size_(options.stack_size()) {
+ set_name(options.name());
}
@@ -1035,8 +1028,10 @@
FULL_INTERVAL
};
+ static const int kSignalSenderStackSize = 32 * KB;
+
explicit SignalSender(int interval)
- : Thread("SignalSender"),
+ : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
vm_tgid_(getpid()),
interval_(interval) {}
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-macos.cc Tue Jan 24 07:48:16 2012
@@ -473,17 +473,11 @@
pthread_t thread_; // Thread handle for pthread.
};
+
Thread::Thread(const Options& options)
: data_(new PlatformData),
- stack_size_(options.stack_size) {
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : data_(new PlatformData),
- stack_size_(0) {
- set_name(name);
+ stack_size_(options.stack_size()) {
+ set_name(options.name());
}
@@ -736,10 +730,13 @@
thread_act_t profiled_thread_;
};
+
class SamplerThread : public Thread {
public:
+ static const int kSamplerThreadStackSize = 32 * KB;
+
explicit SamplerThread(int interval)
- : Thread("SamplerThread"),
+ : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-openbsd.cc Tue Jan 24 07:48:16 2012
@@ -512,15 +512,8 @@
Thread::Thread(const Options& options)
: data_(new PlatformData()),
- stack_size_(options.stack_size) {
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : data_(new PlatformData()),
- stack_size_(0) {
- set_name(name);
+ stack_size_(options.stack_size()) {
+ set_name(options.name());
}
@@ -789,8 +782,10 @@
FULL_INTERVAL
};
+ static const int kSignalSenderStackSize = 32 * KB;
+
explicit SignalSender(int interval)
- : Thread("SignalSender"),
+ : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
vm_tgid_(getpid()),
interval_(interval) {}
=======================================
--- /branches/bleeding_edge/src/platform-solaris.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-solaris.cc Tue Jan 24 07:48:16 2012
@@ -453,17 +453,11 @@
pthread_t thread_; // Thread handle for pthread.
};
+
Thread::Thread(const Options& options)
: data_(new PlatformData()),
- stack_size_(options.stack_size) {
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : data_(new PlatformData()),
- stack_size_(0) {
- set_name(name);
+ stack_size_(options.stack_size()) {
+ set_name(options.name());
}
@@ -710,8 +704,10 @@
FULL_INTERVAL
};
+ static const int kSignalSenderStackSize = 32 * KB;
+
explicit SignalSender(int interval)
- : Thread("SignalSender"),
+ : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
interval_(interval) {}
static void InstallSignalHandler() {
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Fri Jan 20 08:17:08 2012
+++ /branches/bleeding_edge/src/platform-win32.cc Tue Jan 24 07:48:16 2012
@@ -1526,16 +1526,9 @@
// handle until it is started.
Thread::Thread(const Options& options)
- : stack_size_(options.stack_size) {
+ : stack_size_(options.stack_size()) {
data_ = new PlatformData(kNoThread);
- set_name(options.name);
-}
-
-
-Thread::Thread(const char* name)
- : stack_size_(0) {
- data_ = new PlatformData(kNoThread);
- set_name(name);
+ set_name(options.name());
}
@@ -1901,8 +1894,10 @@
class SamplerThread : public Thread {
public:
+ static const int kSamplerThreadStackSize = 32 * KB;
+
explicit SamplerThread(int interval)
- : Thread("SamplerThread"),
+ : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
interval_(interval) {}
static void AddActiveSampler(Sampler* sampler) {
=======================================
--- /branches/bleeding_edge/src/platform.h Tue Jan 17 05:13:55 2012
+++ /branches/bleeding_edge/src/platform.h Tue Jan 24 07:48:16 2012
@@ -412,16 +412,22 @@
LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
};
- struct Options {
- Options() : name("v8:<unknown>"), stack_size(0) {}
-
- const char* name;
- int stack_size;
+ class Options {
+ public:
+ Options() : name_("v8:<unknown>"), stack_size_(0) {}
+ Options(const char* name, int stack_size = 0)
+ : name_(name), stack_size_(stack_size) {}
+
+ const char* name() const { return name_; }
+ int stack_size() const { return stack_size_; }
+
+ private:
+ const char* name_;
+ int stack_size_;
};
// Create new thread.
explicit Thread(const Options& options);
- explicit Thread(const char* name);
virtual ~Thread();
// Start new thread by calling the Run() method in the new thread.
=======================================
--- /branches/bleeding_edge/test/cctest/test-mark-compact.cc Tue Jan 17
05:13:55 2012
+++ /branches/bleeding_edge/test/cctest/test-mark-compact.cc Tue Jan 24
07:48:16 2012
@@ -526,12 +526,25 @@
TEST(BootUpMemoryUse) {
intptr_t initial_memory = MemoryInUse();
+ FLAG_crankshaft = false; // Avoid flakiness.
// Only Linux has the proc filesystem and only if it is mapped. If it's
not
// there we just skip the test.
if (initial_memory >= 0) {
InitializeVM();
intptr_t booted_memory = MemoryInUse();
- CHECK_LE(booted_memory - initial_memory, 16 * 1024 * 1024);
+ if (sizeof(initial_memory) == 8) {
+ if (v8::internal::Snapshot::IsEnabled()) {
+ CHECK_LE(booted_memory - initial_memory, 7654 * 1024); // 7468.
+ } else {
+ CHECK_LE(booted_memory - initial_memory, 7777 * 1024); // 7620.
+ }
+ } else {
+ if (v8::internal::Snapshot::IsEnabled()) {
+ CHECK_LE(booted_memory - initial_memory, 7500 * 1024); // 7380.
+ } else {
+ CHECK_LE(booted_memory - initial_memory, 7654 * 1024); // 7448
+ }
+ }
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev