| 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 HANDLE file_; | 931 HANDLE file_; |
| 932 HANDLE file_mapping_; | 932 HANDLE file_mapping_; |
| 933 void* memory_; | 933 void* memory_; |
| 934 int size_; | 934 int size_; |
| 935 }; | 935 }; |
| 936 | 936 |
| 937 | 937 |
| 938 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { | 938 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { |
| 939 // Open a physical file | 939 // Open a physical file |
| 940 HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE, | 940 HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE, |
| 941 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); | 941 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); |
| 942 if (file == NULL) return NULL; | 942 if (file == NULL) return NULL; |
| 943 | 943 |
| 944 int size = static_cast<int>(GetFileSize(file, NULL)); | 944 int size = static_cast<int>(GetFileSize(file, NULL)); |
| 945 | 945 |
| 946 // Create a file mapping for the physical file | 946 // Create a file mapping for the physical file |
| 947 HANDLE file_mapping = CreateFileMapping(file, NULL, | 947 HANDLE file_mapping = CreateFileMapping(file, NULL, |
| 948 PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL); | 948 PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL); |
| 949 if (file_mapping == NULL) return NULL; | 949 if (file_mapping == NULL) return NULL; |
| 950 | 950 |
| 951 // Map a view of the file into memory | 951 // Map a view of the file into memory |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 | 1965 |
| 1966 // Release the thread handles | 1966 // Release the thread handles |
| 1967 CloseHandle(data_->sampler_thread_); | 1967 CloseHandle(data_->sampler_thread_); |
| 1968 CloseHandle(data_->profiled_thread_); | 1968 CloseHandle(data_->profiled_thread_); |
| 1969 } | 1969 } |
| 1970 | 1970 |
| 1971 | 1971 |
| 1972 #endif // ENABLE_LOGGING_AND_PROFILING | 1972 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1973 | 1973 |
| 1974 } } // namespace v8::internal | 1974 } } // namespace v8::internal |
| OLD | NEW |