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

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

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 5 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-linux.cc ('k') | src/platform-nullos.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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 229
230 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 230 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
231 if (memory_) munmap(memory_, size_); 231 if (memory_) munmap(memory_, size_);
232 fclose(file_); 232 fclose(file_);
233 } 233 }
234 234
235 235
236 void OS::LogSharedLibraryAddresses() { 236 void OS::LogSharedLibraryAddresses() {
237 #ifdef ENABLE_LOGGING_AND_PROFILING
238 unsigned int images_count = _dyld_image_count(); 237 unsigned int images_count = _dyld_image_count();
239 for (unsigned int i = 0; i < images_count; ++i) { 238 for (unsigned int i = 0; i < images_count; ++i) {
240 const mach_header* header = _dyld_get_image_header(i); 239 const mach_header* header = _dyld_get_image_header(i);
241 if (header == NULL) continue; 240 if (header == NULL) continue;
242 #if V8_HOST_ARCH_X64 241 #if V8_HOST_ARCH_X64
243 uint64_t size; 242 uint64_t size;
244 char* code_ptr = getsectdatafromheader_64( 243 char* code_ptr = getsectdatafromheader_64(
245 reinterpret_cast<const mach_header_64*>(header), 244 reinterpret_cast<const mach_header_64*>(header),
246 SEG_TEXT, 245 SEG_TEXT,
247 SECT_TEXT, 246 SECT_TEXT,
248 &size); 247 &size);
249 #else 248 #else
250 unsigned int size; 249 unsigned int size;
251 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); 250 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size);
252 #endif 251 #endif
253 if (code_ptr == NULL) continue; 252 if (code_ptr == NULL) continue;
254 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); 253 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i);
255 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; 254 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide;
256 LOG(Isolate::Current(), 255 LOG(Isolate::Current(),
257 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); 256 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size));
258 } 257 }
259 #endif // ENABLE_LOGGING_AND_PROFILING
260 } 258 }
261 259
262 260
263 void OS::SignalCodeMovingGC() { 261 void OS::SignalCodeMovingGC() {
264 } 262 }
265 263
266 264
267 uint64_t OS::CpuFeaturesImpliedByPlatform() { 265 uint64_t OS::CpuFeaturesImpliedByPlatform() {
268 // MacOSX requires all these to install so we can assume they are present. 266 // MacOSX requires all these to install so we can assume they are present.
269 // These constants are defined by the CPUid instructions. 267 // These constants are defined by the CPUid instructions.
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 ts.tv_nsec = (timeout % 1000000) * 1000; 621 ts.tv_nsec = (timeout % 1000000) * 1000;
624 return semaphore_timedwait(semaphore_, ts) != KERN_OPERATION_TIMED_OUT; 622 return semaphore_timedwait(semaphore_, ts) != KERN_OPERATION_TIMED_OUT;
625 } 623 }
626 624
627 625
628 Semaphore* OS::CreateSemaphore(int count) { 626 Semaphore* OS::CreateSemaphore(int count) {
629 return new MacOSSemaphore(count); 627 return new MacOSSemaphore(count);
630 } 628 }
631 629
632 630
633 #ifdef ENABLE_LOGGING_AND_PROFILING
634
635 class Sampler::PlatformData : public Malloced { 631 class Sampler::PlatformData : public Malloced {
636 public: 632 public:
637 PlatformData() : profiled_thread_(mach_thread_self()) {} 633 PlatformData() : profiled_thread_(mach_thread_self()) {}
638 634
639 ~PlatformData() { 635 ~PlatformData() {
640 // Deallocate Mach port for thread. 636 // Deallocate Mach port for thread.
641 mach_port_deallocate(mach_task_self(), profiled_thread_); 637 mach_port_deallocate(mach_task_self(), profiled_thread_);
642 } 638 }
643 639
644 thread_act_t profiled_thread() { return profiled_thread_; } 640 thread_act_t profiled_thread() { return profiled_thread_; }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 SamplerThread::AddActiveSampler(this); 796 SamplerThread::AddActiveSampler(this);
801 } 797 }
802 798
803 799
804 void Sampler::Stop() { 800 void Sampler::Stop() {
805 ASSERT(IsActive()); 801 ASSERT(IsActive());
806 SamplerThread::RemoveActiveSampler(this); 802 SamplerThread::RemoveActiveSampler(this);
807 SetActive(false); 803 SetActive(false);
808 } 804 }
809 805
810 #endif // ENABLE_LOGGING_AND_PROFILING
811 806
812 } } // namespace v8::internal 807 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-nullos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698