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

Side by Side Diff: src/platform-openbsd.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-macos.cc ('k') | src/platform-posix.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return new PosixMemoryMappedFile(file, memory, size); 142 return new PosixMemoryMappedFile(file, memory, size);
143 } 143 }
144 144
145 145
146 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 146 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
147 if (memory_) OS::Free(memory_, size_); 147 if (memory_) OS::Free(memory_, size_);
148 fclose(file_); 148 fclose(file_);
149 } 149 }
150 150
151 151
152 void OS::LogSharedLibraryAddresses() { 152 void OS::LogSharedLibraryAddresses(Isolate* isolate) {
153 // This function assumes that the layout of the file is as follows: 153 // This function assumes that the layout of the file is as follows:
154 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] 154 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
155 // If we encounter an unexpected situation we abort scanning further entries. 155 // If we encounter an unexpected situation we abort scanning further entries.
156 FILE* fp = fopen("/proc/self/maps", "r"); 156 FILE* fp = fopen("/proc/self/maps", "r");
157 if (fp == NULL) return; 157 if (fp == NULL) return;
158 158
159 // Allocate enough room to be able to store a full file name. 159 // Allocate enough room to be able to store a full file name.
160 const int kLibNameLen = FILENAME_MAX + 1; 160 const int kLibNameLen = FILENAME_MAX + 1;
161 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); 161 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
162 162
163 i::Isolate* isolate = ISOLATE;
164 // This loop will terminate once the scanning hits an EOF. 163 // This loop will terminate once the scanning hits an EOF.
165 while (true) { 164 while (true) {
166 uintptr_t start, end; 165 uintptr_t start, end;
167 char attr_r, attr_w, attr_x, attr_p; 166 char attr_r, attr_w, attr_x, attr_p;
168 // Parse the addresses and permission bits at the beginning of the line. 167 // Parse the addresses and permission bits at the beginning of the line.
169 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; 168 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
170 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; 169 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
171 170
172 int c; 171 int c;
173 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { 172 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 389 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
391 return munmap(base, size) == 0; 390 return munmap(base, size) == 0;
392 } 391 }
393 392
394 393
395 bool VirtualMemory::HasLazyCommits() { 394 bool VirtualMemory::HasLazyCommits() {
396 // TODO(alph): implement for the platform. 395 // TODO(alph): implement for the platform.
397 return false; 396 return false;
398 } 397 }
399 398
400
401 void OS::SetUp() {
402 // Seed the random number generator. We preserve microsecond resolution.
403 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()) ^ (getpid() << 16);
404 srandom(static_cast<unsigned int>(seed));
405 }
406
407
408 } } // namespace v8::internal 399 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698