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

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

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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.h ('k') | src/platform-freebsd.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 2006-2011 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 160
161 void OS::Free(void* address, const size_t size) { 161 void OS::Free(void* address, const size_t size) {
162 // TODO(1240712): munmap has a return value which is ignored here. 162 // TODO(1240712): munmap has a return value which is ignored here.
163 int result = munmap(address, size); 163 int result = munmap(address, size);
164 USE(result); 164 USE(result);
165 ASSERT(result == 0); 165 ASSERT(result == 0);
166 } 166 }
167 167
168 168
169 #ifdef ENABLE_HEAP_PROTECTION
170
171 void OS::Protect(void* address, size_t size) {
172 // TODO(1240712): mprotect has a return value which is ignored here.
173 mprotect(address, size, PROT_READ);
174 }
175
176
177 void OS::Unprotect(void* address, size_t size, bool is_executable) {
178 // TODO(1240712): mprotect has a return value which is ignored here.
179 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
180 mprotect(address, size, prot);
181 }
182
183 #endif
184
185
186 void OS::Sleep(int milliseconds) { 169 void OS::Sleep(int milliseconds) {
187 unsigned int ms = static_cast<unsigned int>(milliseconds); 170 unsigned int ms = static_cast<unsigned int>(milliseconds);
188 usleep(1000 * ms); 171 usleep(1000 * ms);
189 } 172 }
190 173
191 174
192 void OS::Abort() { 175 void OS::Abort() {
193 // Redirect to std abort to signal abnormal program termination. 176 // Redirect to std abort to signal abnormal program termination.
194 abort(); 177 abort();
195 } 178 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 225 }
243 226
244 227
245 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 228 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
246 if (memory_) munmap(memory_, size_); 229 if (memory_) munmap(memory_, size_);
247 fclose(file_); 230 fclose(file_);
248 } 231 }
249 232
250 233
251 void OS::LogSharedLibraryAddresses() { 234 void OS::LogSharedLibraryAddresses() {
252 #ifdef ENABLE_LOGGING_AND_PROFILING
253 // This function assumes that the layout of the file is as follows: 235 // This function assumes that the layout of the file is as follows:
254 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] 236 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
255 // If we encounter an unexpected situation we abort scanning further entries. 237 // If we encounter an unexpected situation we abort scanning further entries.
256 FILE* fp = fopen("/proc/self/maps", "r"); 238 FILE* fp = fopen("/proc/self/maps", "r");
257 if (fp == NULL) return; 239 if (fp == NULL) return;
258 240
259 // Allocate enough room to be able to store a full file name. 241 // Allocate enough room to be able to store a full file name.
260 const int kLibNameLen = FILENAME_MAX + 1; 242 const int kLibNameLen = FILENAME_MAX + 1;
261 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); 243 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
262 244
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // Entry not describing executable data. Skip to end of line to setup 281 // Entry not describing executable data. Skip to end of line to setup
300 // reading the next entry. 282 // reading the next entry.
301 do { 283 do {
302 c = getc(fp); 284 c = getc(fp);
303 } while ((c != EOF) && (c != '\n')); 285 } while ((c != EOF) && (c != '\n'));
304 if (c == EOF) break; 286 if (c == EOF) break;
305 } 287 }
306 } 288 }
307 free(lib_name); 289 free(lib_name);
308 fclose(fp); 290 fclose(fp);
309 #endif
310 } 291 }
311 292
312 293
313 void OS::SignalCodeMovingGC() { 294 void OS::SignalCodeMovingGC() {
314 // Nothing to do on Cygwin. 295 // Nothing to do on Cygwin.
315 } 296 }
316 297
317 298
318 int OS::StackWalk(Vector<OS::StackFrame> frames) { 299 int OS::StackWalk(Vector<OS::StackFrame> frames) {
319 // Not supported on Cygwin. 300 // Not supported on Cygwin.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. 565 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
585 } 566 }
586 } 567 }
587 568
588 569
589 Semaphore* OS::CreateSemaphore(int count) { 570 Semaphore* OS::CreateSemaphore(int count) {
590 return new CygwinSemaphore(count); 571 return new CygwinSemaphore(count);
591 } 572 }
592 573
593 574
594 #ifdef ENABLE_LOGGING_AND_PROFILING
595
596 // ---------------------------------------------------------------------------- 575 // ----------------------------------------------------------------------------
597 // Cygwin profiler support. 576 // Cygwin profiler support.
598 // 577 //
599 // On Cygwin we use the same sampler implementation as on win32. 578 // On Cygwin we use the same sampler implementation as on win32.
600 579
601 class Sampler::PlatformData : public Malloced { 580 class Sampler::PlatformData : public Malloced {
602 public: 581 public:
603 // Get a handle to the calling thread. This is the thread that we are 582 // Get a handle to the calling thread. This is the thread that we are
604 // going to profile. We need to make a copy of the handle because we are 583 // going to profile. We need to make a copy of the handle because we are
605 // going to use it in the sampler thread. Using GetThreadHandle() will 584 // going to use it in the sampler thread. Using GetThreadHandle() will
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 SamplerThread::AddActiveSampler(this); 741 SamplerThread::AddActiveSampler(this);
763 } 742 }
764 743
765 744
766 void Sampler::Stop() { 745 void Sampler::Stop() {
767 ASSERT(IsActive()); 746 ASSERT(IsActive());
768 SamplerThread::RemoveActiveSampler(this); 747 SamplerThread::RemoveActiveSampler(this);
769 SetActive(false); 748 SetActive(false);
770 } 749 }
771 750
772 #endif // ENABLE_LOGGING_AND_PROFILING
773 751
774 } } // namespace v8::internal 752 } } // namespace v8::internal
775
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698