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

Side by Side Diff: src/platform-freebsd.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-cygwin.cc ('k') | src/platform-linux.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 175
176 void OS::Free(void* buf, const size_t length) { 176 void OS::Free(void* buf, const size_t length) {
177 // TODO(1240712): munmap has a return value which is ignored here. 177 // TODO(1240712): munmap has a return value which is ignored here.
178 int result = munmap(buf, length); 178 int result = munmap(buf, length);
179 USE(result); 179 USE(result);
180 ASSERT(result == 0); 180 ASSERT(result == 0);
181 } 181 }
182 182
183 183
184 #ifdef ENABLE_HEAP_PROTECTION
185
186 void OS::Protect(void* address, size_t size) {
187 UNIMPLEMENTED();
188 }
189
190
191 void OS::Unprotect(void* address, size_t size, bool is_executable) {
192 UNIMPLEMENTED();
193 }
194
195 #endif
196
197
198 void OS::Sleep(int milliseconds) { 184 void OS::Sleep(int milliseconds) {
199 unsigned int ms = static_cast<unsigned int>(milliseconds); 185 unsigned int ms = static_cast<unsigned int>(milliseconds);
200 usleep(1000 * ms); 186 usleep(1000 * ms);
201 } 187 }
202 188
203 189
204 void OS::Abort() { 190 void OS::Abort() {
205 // Redirect to std abort to signal abnormal program termination. 191 // Redirect to std abort to signal abnormal program termination.
206 abort(); 192 abort();
207 } 193 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 return new PosixMemoryMappedFile(file, memory, size); 245 return new PosixMemoryMappedFile(file, memory, size);
260 } 246 }
261 247
262 248
263 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 249 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
264 if (memory_) munmap(memory_, size_); 250 if (memory_) munmap(memory_, size_);
265 fclose(file_); 251 fclose(file_);
266 } 252 }
267 253
268 254
269 #ifdef ENABLE_LOGGING_AND_PROFILING
270 static unsigned StringToLong(char* buffer) { 255 static unsigned StringToLong(char* buffer) {
271 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT 256 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT
272 } 257 }
273 #endif
274 258
275 259
276 void OS::LogSharedLibraryAddresses() { 260 void OS::LogSharedLibraryAddresses() {
277 #ifdef ENABLE_LOGGING_AND_PROFILING
278 static const int MAP_LENGTH = 1024; 261 static const int MAP_LENGTH = 1024;
279 int fd = open("/proc/self/maps", O_RDONLY); 262 int fd = open("/proc/self/maps", O_RDONLY);
280 if (fd < 0) return; 263 if (fd < 0) return;
281 while (true) { 264 while (true) {
282 char addr_buffer[11]; 265 char addr_buffer[11];
283 addr_buffer[0] = '0'; 266 addr_buffer[0] = '0';
284 addr_buffer[1] = 'x'; 267 addr_buffer[1] = 'x';
285 addr_buffer[10] = 0; 268 addr_buffer[10] = 0;
286 int result = read(fd, addr_buffer + 2, 8); 269 int result = read(fd, addr_buffer + 2, 8);
287 if (result < 8) break; 270 if (result < 8) break;
(...skipping 16 matching lines...) Expand all
304 buffer[bytes_read] = 0; 287 buffer[bytes_read] = 0;
305 // Ignore mappings that are not executable. 288 // Ignore mappings that are not executable.
306 if (buffer[3] != 'x') continue; 289 if (buffer[3] != 'x') continue;
307 char* start_of_path = index(buffer, '/'); 290 char* start_of_path = index(buffer, '/');
308 // There may be no filename in this line. Skip to next. 291 // There may be no filename in this line. Skip to next.
309 if (start_of_path == NULL) continue; 292 if (start_of_path == NULL) continue;
310 buffer[bytes_read] = 0; 293 buffer[bytes_read] = 0;
311 LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end)); 294 LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end));
312 } 295 }
313 close(fd); 296 close(fd);
314 #endif
315 } 297 }
316 298
317 299
318 void OS::SignalCodeMovingGC() { 300 void OS::SignalCodeMovingGC() {
319 } 301 }
320 302
321 303
322 int OS::StackWalk(Vector<OS::StackFrame> frames) { 304 int OS::StackWalk(Vector<OS::StackFrame> frames) {
323 int frames_size = frames.length(); 305 int frames_size = frames.length();
324 ScopedVector<void*> addresses(frames_size); 306 ScopedVector<void*> addresses(frames_size);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. 563 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup.
582 } 564 }
583 } 565 }
584 566
585 567
586 Semaphore* OS::CreateSemaphore(int count) { 568 Semaphore* OS::CreateSemaphore(int count) {
587 return new FreeBSDSemaphore(count); 569 return new FreeBSDSemaphore(count);
588 } 570 }
589 571
590 572
591 #ifdef ENABLE_LOGGING_AND_PROFILING
592
593 static pthread_t GetThreadID() { 573 static pthread_t GetThreadID() {
594 pthread_t thread_id = pthread_self(); 574 pthread_t thread_id = pthread_self();
595 return thread_id; 575 return thread_id;
596 } 576 }
597 577
598 578
599 class Sampler::PlatformData : public Malloced { 579 class Sampler::PlatformData : public Malloced {
600 public: 580 public:
601 PlatformData() : vm_tid_(GetThreadID()) {} 581 PlatformData() : vm_tid_(GetThreadID()) {}
602 582
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 SignalSender::AddActiveSampler(this); 790 SignalSender::AddActiveSampler(this);
811 } 791 }
812 792
813 793
814 void Sampler::Stop() { 794 void Sampler::Stop() {
815 ASSERT(IsActive()); 795 ASSERT(IsActive());
816 SignalSender::RemoveActiveSampler(this); 796 SignalSender::RemoveActiveSampler(this);
817 SetActive(false); 797 SetActive(false);
818 } 798 }
819 799
820 #endif // ENABLE_LOGGING_AND_PROFILING
821 800
822 } } // namespace v8::internal 801 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-cygwin.cc ('k') | src/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698