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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 virtual void* memory() { return memory_; } | 217 virtual void* memory() { return memory_; } |
218 virtual int size() { return size_; } | 218 virtual int size() { return size_; } |
219 private: | 219 private: |
220 FILE* file_; | 220 FILE* file_; |
221 void* memory_; | 221 void* memory_; |
222 int size_; | 222 int size_; |
223 }; | 223 }; |
224 | 224 |
225 | 225 |
226 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 226 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { |
227 FILE* file = fopen(name, "w+"); | 227 FILE* file = fopen(name, "a+"); |
228 if (file == NULL) return NULL; | 228 if (file == NULL) return NULL; |
229 | 229 |
230 fseek(file, 0, SEEK_END); | 230 fseek(file, 0, SEEK_END); |
231 int size = ftell(file); | 231 int size = ftell(file); |
232 | 232 |
233 void* memory = | 233 void* memory = |
234 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); | 234 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); |
235 return new PosixMemoryMappedFile(file, memory, size); | 235 return new PosixMemoryMappedFile(file, memory, size); |
236 } | 236 } |
237 | 237 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 693 } |
694 | 694 |
695 // This sampler is no longer the active sampler. | 695 // This sampler is no longer the active sampler. |
696 active_sampler_ = NULL; | 696 active_sampler_ = NULL; |
697 active_ = false; | 697 active_ = false; |
698 } | 698 } |
699 | 699 |
700 #endif // ENABLE_LOGGING_AND_PROFILING | 700 #endif // ENABLE_LOGGING_AND_PROFILING |
701 | 701 |
702 } } // namespace v8::internal | 702 } } // namespace v8::internal |
OLD | NEW |