| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return new PosixMemoryMappedFile(file, memory, size); | 166 return new PosixMemoryMappedFile(file, memory, size); |
| 167 } | 167 } |
| 168 | 168 |
| 169 | 169 |
| 170 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 170 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
| 171 if (memory_) OS::Free(memory_, size_); | 171 if (memory_) OS::Free(memory_, size_); |
| 172 fclose(file_); | 172 fclose(file_); |
| 173 } | 173 } |
| 174 | 174 |
| 175 | 175 |
| 176 void OS::LogSharedLibraryAddresses() { | 176 void OS::LogSharedLibraryAddresses(Isolate* isolate) { |
| 177 unsigned int images_count = _dyld_image_count(); | 177 unsigned int images_count = _dyld_image_count(); |
| 178 for (unsigned int i = 0; i < images_count; ++i) { | 178 for (unsigned int i = 0; i < images_count; ++i) { |
| 179 const mach_header* header = _dyld_get_image_header(i); | 179 const mach_header* header = _dyld_get_image_header(i); |
| 180 if (header == NULL) continue; | 180 if (header == NULL) continue; |
| 181 #if V8_HOST_ARCH_X64 | 181 #if V8_HOST_ARCH_X64 |
| 182 uint64_t size; | 182 uint64_t size; |
| 183 char* code_ptr = getsectdatafromheader_64( | 183 char* code_ptr = getsectdatafromheader_64( |
| 184 reinterpret_cast<const mach_header_64*>(header), | 184 reinterpret_cast<const mach_header_64*>(header), |
| 185 SEG_TEXT, | 185 SEG_TEXT, |
| 186 SECT_TEXT, | 186 SECT_TEXT, |
| 187 &size); | 187 &size); |
| 188 #else | 188 #else |
| 189 unsigned int size; | 189 unsigned int size; |
| 190 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | 190 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); |
| 191 #endif | 191 #endif |
| 192 if (code_ptr == NULL) continue; | 192 if (code_ptr == NULL) continue; |
| 193 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | 193 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); |
| 194 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | 194 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; |
| 195 LOG(Isolate::Current(), | 195 LOG(isolate, |
| 196 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | 196 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 void OS::SignalCodeMovingGC() { | 201 void OS::SignalCodeMovingGC() { |
| 202 } | 202 } |
| 203 | 203 |
| 204 | 204 |
| 205 const char* OS::LocalTimezone(double time) { | 205 const char* OS::LocalTimezone(double time) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { | 354 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { |
| 355 return munmap(address, size) == 0; | 355 return munmap(address, size) == 0; |
| 356 } | 356 } |
| 357 | 357 |
| 358 | 358 |
| 359 bool VirtualMemory::HasLazyCommits() { | 359 bool VirtualMemory::HasLazyCommits() { |
| 360 return false; | 360 return false; |
| 361 } | 361 } |
| 362 | 362 |
| 363 | |
| 364 void OS::SetUp() { | |
| 365 // Seed the random number generator. We preserve microsecond resolution. | |
| 366 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16); | |
| 367 srandom(static_cast<unsigned int>(seed)); | |
| 368 } | |
| 369 | |
| 370 | |
| 371 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| OLD | NEW |