OLD | NEW |
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 virtual void* memory() { return memory_; } | 202 virtual void* memory() { return memory_; } |
203 virtual int size() { return size_; } | 203 virtual int size() { return size_; } |
204 private: | 204 private: |
205 FILE* file_; | 205 FILE* file_; |
206 void* memory_; | 206 void* memory_; |
207 int size_; | 207 int size_; |
208 }; | 208 }; |
209 | 209 |
210 | 210 |
211 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 211 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { |
212 FILE* file = fopen(name, "w+"); | 212 FILE* file = fopen(name, "a+"); |
213 if (file == NULL) return NULL; | 213 if (file == NULL) return NULL; |
214 | 214 |
215 fseek(file, 0, SEEK_END); | 215 fseek(file, 0, SEEK_END); |
216 int size = ftell(file); | 216 int size = ftell(file); |
217 | 217 |
218 void* memory = | 218 void* memory = |
219 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); | 219 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); |
220 return new PosixMemoryMappedFile(file, memory, size); | 220 return new PosixMemoryMappedFile(file, memory, size); |
221 } | 221 } |
222 | 222 |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // Release the thread handles | 736 // Release the thread handles |
737 CloseHandle(data_->sampler_thread_); | 737 CloseHandle(data_->sampler_thread_); |
738 CloseHandle(data_->profiled_thread_); | 738 CloseHandle(data_->profiled_thread_); |
739 } | 739 } |
740 | 740 |
741 | 741 |
742 #endif // ENABLE_LOGGING_AND_PROFILING | 742 #endif // ENABLE_LOGGING_AND_PROFILING |
743 | 743 |
744 } } // namespace v8::internal | 744 } } // namespace v8::internal |
745 | 745 |
OLD | NEW |