OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 virtual void* memory() { return memory_; } | 228 virtual void* memory() { return memory_; } |
229 virtual int size() { return size_; } | 229 virtual int size() { return size_; } |
230 private: | 230 private: |
231 FILE* file_; | 231 FILE* file_; |
232 void* memory_; | 232 void* memory_; |
233 int size_; | 233 int size_; |
234 }; | 234 }; |
235 | 235 |
236 | 236 |
237 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 237 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { |
238 FILE* file = fopen(name, "w+"); | 238 FILE* file = fopen(name, "a+"); |
239 if (file == NULL) return NULL; | 239 if (file == NULL) return NULL; |
240 | 240 |
241 fseek(file, 0, SEEK_END); | 241 fseek(file, 0, SEEK_END); |
242 int size = ftell(file); | 242 int size = ftell(file); |
243 | 243 |
244 void* memory = | 244 void* memory = |
245 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); | 245 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); |
246 return new PosixMemoryMappedFile(file, memory, size); | 246 return new PosixMemoryMappedFile(file, memory, size); |
247 } | 247 } |
248 | 248 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 705 } |
706 | 706 |
707 // This sampler is no longer the active sampler. | 707 // This sampler is no longer the active sampler. |
708 active_sampler_ = NULL; | 708 active_sampler_ = NULL; |
709 active_ = false; | 709 active_ = false; |
710 } | 710 } |
711 | 711 |
712 #endif // ENABLE_LOGGING_AND_PROFILING | 712 #endif // ENABLE_LOGGING_AND_PROFILING |
713 | 713 |
714 } } // namespace v8::internal | 714 } } // namespace v8::internal |
OLD | NEW |