| OLD | NEW | 
|---|
| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 198   virtual void* memory() { return memory_; } | 198   virtual void* memory() { return memory_; } | 
| 199   virtual int size() { return size_; } | 199   virtual int size() { return size_; } | 
| 200  private: | 200  private: | 
| 201   FILE* file_; | 201   FILE* file_; | 
| 202   void* memory_; | 202   void* memory_; | 
| 203   int size_; | 203   int size_; | 
| 204 }; | 204 }; | 
| 205 | 205 | 
| 206 | 206 | 
| 207 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 207 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 
| 208   FILE* file = fopen(name, "w+"); | 208   FILE* file = fopen(name, "r+"); | 
| 209   if (file == NULL) return NULL; | 209   if (file == NULL) return NULL; | 
| 210 | 210 | 
| 211   fseek(file, 0, SEEK_END); | 211   fseek(file, 0, SEEK_END); | 
| 212   int size = ftell(file); | 212   int size = ftell(file); | 
| 213 | 213 | 
| 214   void* memory = | 214   void* memory = | 
| 215       mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); | 215       mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); | 
| 216   return new PosixMemoryMappedFile(file, memory, size); | 216   return new PosixMemoryMappedFile(file, memory, size); | 
| 217 } | 217 } | 
| 218 | 218 | 
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 723   Top::WakeUpRuntimeProfilerThreadBeforeShutdown(); | 723   Top::WakeUpRuntimeProfilerThreadBeforeShutdown(); | 
| 724   pthread_join(data_->sampler_thread_, NULL); | 724   pthread_join(data_->sampler_thread_, NULL); | 
| 725 | 725 | 
| 726   // Deallocate Mach port for thread. | 726   // Deallocate Mach port for thread. | 
| 727   mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 727   mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 
| 728 } | 728 } | 
| 729 | 729 | 
| 730 #endif  // ENABLE_LOGGING_AND_PROFILING | 730 #endif  // ENABLE_LOGGING_AND_PROFILING | 
| 731 | 731 | 
| 732 } }  // namespace v8::internal | 732 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|