Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: src/platform-linux.cc

Issue 153773002: A64: Synchronize with r16679. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return new PosixMemoryMappedFile(file, memory, size); 214 return new PosixMemoryMappedFile(file, memory, size);
215 } 215 }
216 216
217 217
218 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 218 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
219 if (memory_) OS::Free(memory_, size_); 219 if (memory_) OS::Free(memory_, size_);
220 fclose(file_); 220 fclose(file_);
221 } 221 }
222 222
223 223
224 void OS::LogSharedLibraryAddresses() { 224 void OS::LogSharedLibraryAddresses(Isolate* isolate) {
225 // This function assumes that the layout of the file is as follows: 225 // This function assumes that the layout of the file is as follows:
226 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] 226 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
227 // If we encounter an unexpected situation we abort scanning further entries. 227 // If we encounter an unexpected situation we abort scanning further entries.
228 FILE* fp = fopen("/proc/self/maps", "r"); 228 FILE* fp = fopen("/proc/self/maps", "r");
229 if (fp == NULL) return; 229 if (fp == NULL) return;
230 230
231 // Allocate enough room to be able to store a full file name. 231 // Allocate enough room to be able to store a full file name.
232 const int kLibNameLen = FILENAME_MAX + 1; 232 const int kLibNameLen = FILENAME_MAX + 1;
233 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); 233 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
234 234
235 i::Isolate* isolate = ISOLATE;
236 // This loop will terminate once the scanning hits an EOF. 235 // This loop will terminate once the scanning hits an EOF.
237 while (true) { 236 while (true) {
238 uintptr_t start, end; 237 uintptr_t start, end;
239 char attr_r, attr_w, attr_x, attr_p; 238 char attr_r, attr_w, attr_x, attr_p;
240 // Parse the addresses and permission bits at the beginning of the line. 239 // Parse the addresses and permission bits at the beginning of the line.
241 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; 240 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
242 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; 241 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
243 242
244 int c; 243 int c;
245 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { 244 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 459
461 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 460 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
462 return munmap(base, size) == 0; 461 return munmap(base, size) == 0;
463 } 462 }
464 463
465 464
466 bool VirtualMemory::HasLazyCommits() { 465 bool VirtualMemory::HasLazyCommits() {
467 return true; 466 return true;
468 } 467 }
469 468
470
471 void OS::SetUp() {
472 // Seed the random number generator. We preserve microsecond resolution.
473 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16);
474 srandom(static_cast<unsigned int>(seed));
475 }
476
477
478 } } // namespace v8::internal 469 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698