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

Side by Side Diff: src/platform-freebsd.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-cygwin.cc ('k') | src/platform-linux.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 83
84 void* OS::Allocate(const size_t requested, 84 void* OS::Allocate(const size_t requested,
85 size_t* allocated, 85 size_t* allocated,
86 bool executable) { 86 bool executable) {
87 const size_t msize = RoundUp(requested, getpagesize()); 87 const size_t msize = RoundUp(requested, getpagesize());
88 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); 88 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
89 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); 89 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
90 90
91 if (mbase == MAP_FAILED) { 91 if (mbase == MAP_FAILED) {
92 LOG(ISOLATE, StringEvent("OS::Allocate", "mmap failed")); 92 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed"));
93 return NULL; 93 return NULL;
94 } 94 }
95 *allocated = msize; 95 *allocated = msize;
96 return mbase; 96 return mbase;
97 } 97 }
98 98
99 99
100 void OS::DumpBacktrace() { 100 void OS::DumpBacktrace() {
101 POSIXBacktraceHelper<backtrace, backtrace_symbols>::DumpBacktrace(); 101 POSIXBacktraceHelper<backtrace, backtrace_symbols>::DumpBacktrace();
102 } 102 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (memory_) munmap(memory_, size_); 148 if (memory_) munmap(memory_, size_);
149 fclose(file_); 149 fclose(file_);
150 } 150 }
151 151
152 152
153 static unsigned StringToLong(char* buffer) { 153 static unsigned StringToLong(char* buffer) {
154 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT 154 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT
155 } 155 }
156 156
157 157
158 void OS::LogSharedLibraryAddresses() { 158 void OS::LogSharedLibraryAddresses(Isolate* isolate) {
159 static const int MAP_LENGTH = 1024; 159 static const int MAP_LENGTH = 1024;
160 int fd = open("/proc/self/maps", O_RDONLY); 160 int fd = open("/proc/self/maps", O_RDONLY);
161 if (fd < 0) return; 161 if (fd < 0) return;
162 while (true) { 162 while (true) {
163 char addr_buffer[11]; 163 char addr_buffer[11];
164 addr_buffer[0] = '0'; 164 addr_buffer[0] = '0';
165 addr_buffer[1] = 'x'; 165 addr_buffer[1] = 'x';
166 addr_buffer[10] = 0; 166 addr_buffer[10] = 0;
167 int result = read(fd, addr_buffer + 2, 8); 167 int result = read(fd, addr_buffer + 2, 8);
168 if (result < 8) break; 168 if (result < 8) break;
(...skipping 13 matching lines...) Expand all
182 result = read(fd, buffer + bytes_read, 1); 182 result = read(fd, buffer + bytes_read, 1);
183 if (result < 1) break; 183 if (result < 1) break;
184 } while (buffer[bytes_read] != '\n'); 184 } while (buffer[bytes_read] != '\n');
185 buffer[bytes_read] = 0; 185 buffer[bytes_read] = 0;
186 // Ignore mappings that are not executable. 186 // Ignore mappings that are not executable.
187 if (buffer[3] != 'x') continue; 187 if (buffer[3] != 'x') continue;
188 char* start_of_path = index(buffer, '/'); 188 char* start_of_path = index(buffer, '/');
189 // There may be no filename in this line. Skip to next. 189 // There may be no filename in this line. Skip to next.
190 if (start_of_path == NULL) continue; 190 if (start_of_path == NULL) continue;
191 buffer[bytes_read] = 0; 191 buffer[bytes_read] = 0;
192 LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end)); 192 LOG(isolate SharedLibraryEvent(start_of_path, start, end));
193 } 193 }
194 close(fd); 194 close(fd);
195 } 195 }
196 196
197 197
198 void OS::SignalCodeMovingGC() { 198 void OS::SignalCodeMovingGC() {
199 } 199 }
200 200
201 201
202 int OS::StackWalk(Vector<OS::StackFrame> frames) { 202 int OS::StackWalk(Vector<OS::StackFrame> frames) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 333 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
334 return munmap(base, size) == 0; 334 return munmap(base, size) == 0;
335 } 335 }
336 336
337 337
338 bool VirtualMemory::HasLazyCommits() { 338 bool VirtualMemory::HasLazyCommits() {
339 // TODO(alph): implement for the platform. 339 // TODO(alph): implement for the platform.
340 return false; 340 return false;
341 } 341 }
342 342
343
344 void OS::SetUp() {
345 // Seed the random number generator.
346 // Convert the current time to a 64-bit integer first, before converting it
347 // to an unsigned. Going directly can cause an overflow and the seed to be
348 // set to all ones. The seed will be identical for different instances that
349 // call this setup code within the same millisecond.
350 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis());
351 srandom(static_cast<unsigned int>(seed));
352 }
353
354
355 } } // namespace v8::internal 343 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-cygwin.cc ('k') | src/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698