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

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

Issue 9178014: Revert 10413-10416 initial memory use reduction due to (Closed) 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-solaris.cc ('k') | src/serialize.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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 explicit PlatformData(HANDLE thread) : thread_(thread) {} 1519 explicit PlatformData(HANDLE thread) : thread_(thread) {}
1520 HANDLE thread_; 1520 HANDLE thread_;
1521 unsigned thread_id_; 1521 unsigned thread_id_;
1522 }; 1522 };
1523 1523
1524 1524
1525 // Initialize a Win32 thread object. The thread has an invalid thread 1525 // Initialize a Win32 thread object. The thread has an invalid thread
1526 // handle until it is started. 1526 // handle until it is started.
1527 1527
1528 Thread::Thread(const Options& options) 1528 Thread::Thread(const Options& options)
1529 : stack_size_(options.stack_size()) { 1529 : stack_size_(options.stack_size) {
1530 data_ = new PlatformData(kNoThread); 1530 data_ = new PlatformData(kNoThread);
1531 set_name(options.name()); 1531 set_name(options.name);
1532 }
1533
1534
1535 Thread::Thread(const char* name)
1536 : stack_size_(0) {
1537 data_ = new PlatformData(kNoThread);
1538 set_name(name);
1532 } 1539 }
1533 1540
1534 1541
1535 void Thread::set_name(const char* name) { 1542 void Thread::set_name(const char* name) {
1536 OS::StrNCpy(Vector<char>(name_, sizeof(name_)), name, strlen(name)); 1543 OS::StrNCpy(Vector<char>(name_, sizeof(name_)), name, strlen(name));
1537 name_[sizeof(name_) - 1] = '\0'; 1544 name_[sizeof(name_) - 1] = '\0';
1538 } 1545 }
1539 1546
1540 1547
1541 // Close our own handle for the thread. 1548 // Close our own handle for the thread.
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 1894
1888 HANDLE profiled_thread() { return profiled_thread_; } 1895 HANDLE profiled_thread() { return profiled_thread_; }
1889 1896
1890 private: 1897 private:
1891 HANDLE profiled_thread_; 1898 HANDLE profiled_thread_;
1892 }; 1899 };
1893 1900
1894 1901
1895 class SamplerThread : public Thread { 1902 class SamplerThread : public Thread {
1896 public: 1903 public:
1897 static const int kSamplerThreadStackSize = 32 * KB;
1898
1899 explicit SamplerThread(int interval) 1904 explicit SamplerThread(int interval)
1900 : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)), 1905 : Thread("SamplerThread"),
1901 interval_(interval) {} 1906 interval_(interval) {}
1902 1907
1903 static void AddActiveSampler(Sampler* sampler) { 1908 static void AddActiveSampler(Sampler* sampler) {
1904 ScopedLock lock(mutex_); 1909 ScopedLock lock(mutex_);
1905 SamplerRegistry::AddActiveSampler(sampler); 1910 SamplerRegistry::AddActiveSampler(sampler);
1906 if (instance_ == NULL) { 1911 if (instance_ == NULL) {
1907 instance_ = new SamplerThread(sampler->interval()); 1912 instance_ = new SamplerThread(sampler->interval());
1908 instance_->Start(); 1913 instance_->Start();
1909 } else { 1914 } else {
1910 ASSERT(instance_->interval_ == sampler->interval()); 1915 ASSERT(instance_->interval_ == sampler->interval());
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2038
2034 2039
2035 void Sampler::Stop() { 2040 void Sampler::Stop() {
2036 ASSERT(IsActive()); 2041 ASSERT(IsActive());
2037 SamplerThread::RemoveActiveSampler(this); 2042 SamplerThread::RemoveActiveSampler(this);
2038 SetActive(false); 2043 SetActive(false);
2039 } 2044 }
2040 2045
2041 2046
2042 } } // namespace v8::internal 2047 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698