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

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

Issue 353113003: Remove dependency from platform files on v8.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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-posix.cc ('k') | src/platform-solaris.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for QNX goes here. For the POSIX-compatible 5 // Platform-specific code for QNX goes here. For the POSIX-compatible
6 // parts the implementation is in platform-posix.cc. 6 // parts the implementation is in platform-posix.cc.
7 7
8 #include <backtrace.h> 8 #include <backtrace.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <semaphore.h> 10 #include <semaphore.h>
11 #include <signal.h> 11 #include <signal.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <sys/resource.h> 13 #include <sys/resource.h>
14 #include <sys/time.h> 14 #include <sys/time.h>
15 #include <sys/types.h> 15 #include <sys/types.h>
16 #include <ucontext.h> 16 #include <ucontext.h>
17 17
18 // QNX requires memory pages to be marked as executable. 18 // QNX requires memory pages to be marked as executable.
19 // Otherwise, the OS raises an exception when executing code in that page. 19 // Otherwise, the OS raises an exception when executing code in that page.
20 #include <errno.h> 20 #include <errno.h>
21 #include <fcntl.h> // open 21 #include <fcntl.h> // open
22 #include <stdarg.h> 22 #include <stdarg.h>
23 #include <strings.h> // index 23 #include <strings.h> // index
24 #include <sys/mman.h> // mmap & munmap 24 #include <sys/mman.h> // mmap & munmap
25 #include <sys/procfs.h> 25 #include <sys/procfs.h>
26 #include <sys/stat.h> // open 26 #include <sys/stat.h> // open
27 #include <sys/types.h> // mmap & munmap 27 #include <sys/types.h> // mmap & munmap
28 #include <unistd.h> // sysconf 28 #include <unistd.h> // sysconf
29 29
30 #include <cmath>
31
30 #undef MAP_TYPE 32 #undef MAP_TYPE
31 33
32 #include "src/v8.h"
33
34 #include "src/platform.h" 34 #include "src/platform.h"
35 #include "src/utils.h"
35 36
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 // 0 is never a valid thread id on Qnx since tids and pids share a 41 // 0 is never a valid thread id on Qnx since tids and pids share a
41 // name space and pid 0 is reserved (see man 2 kill). 42 // name space and pid 0 is reserved (see man 2 kill).
42 static const pthread_t kNoThread = (pthread_t) 0; 43 static const pthread_t kNoThread = (pthread_t) 0;
43 44
44 45
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 size_t request_size = RoundUp(size + alignment, 253 size_t request_size = RoundUp(size + alignment,
253 static_cast<intptr_t>(OS::AllocateAlignment())); 254 static_cast<intptr_t>(OS::AllocateAlignment()));
254 void* reservation = mmap(OS::GetRandomMmapAddr(), 255 void* reservation = mmap(OS::GetRandomMmapAddr(),
255 request_size, 256 request_size,
256 PROT_NONE, 257 PROT_NONE,
257 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LAZY, 258 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LAZY,
258 kMmapFd, 259 kMmapFd,
259 kMmapFdOffset); 260 kMmapFdOffset);
260 if (reservation == MAP_FAILED) return; 261 if (reservation == MAP_FAILED) return;
261 262
262 Address base = static_cast<Address>(reservation); 263 uint8_t* base = static_cast<uint8_t*>(reservation);
263 Address aligned_base = RoundUp(base, alignment); 264 uint8_t* aligned_base = RoundUp(base, alignment);
264 ASSERT_LE(base, aligned_base); 265 ASSERT_LE(base, aligned_base);
265 266
266 // Unmap extra memory reserved before and after the desired block. 267 // Unmap extra memory reserved before and after the desired block.
267 if (aligned_base != base) { 268 if (aligned_base != base) {
268 size_t prefix_size = static_cast<size_t>(aligned_base - base); 269 size_t prefix_size = static_cast<size_t>(aligned_base - base);
269 OS::Free(base, prefix_size); 270 OS::Free(base, prefix_size);
270 request_size -= prefix_size; 271 request_size -= prefix_size;
271 } 272 }
272 273
273 size_t aligned_size = RoundUp(size, OS::AllocateAlignment()); 274 size_t aligned_size = RoundUp(size, OS::AllocateAlignment());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 365 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
365 return munmap(base, size) == 0; 366 return munmap(base, size) == 0;
366 } 367 }
367 368
368 369
369 bool VirtualMemory::HasLazyCommits() { 370 bool VirtualMemory::HasLazyCommits() {
370 return false; 371 return false;
371 } 372 }
372 373
373 } } // namespace v8::internal 374 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-posix.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698