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 25 matching lines...) Expand all Loading... |
36 #include <sys/types.h> | 36 #include <sys/types.h> |
37 #include <sys/ucontext.h> | 37 #include <sys/ucontext.h> |
38 #include <stdlib.h> | 38 #include <stdlib.h> |
39 | 39 |
40 #include <sys/types.h> // mmap & munmap | 40 #include <sys/types.h> // mmap & munmap |
41 #include <sys/mman.h> // mmap & munmap | 41 #include <sys/mman.h> // mmap & munmap |
42 #include <sys/stat.h> // open | 42 #include <sys/stat.h> // open |
43 #include <sys/fcntl.h> // open | 43 #include <sys/fcntl.h> // open |
44 #include <unistd.h> // getpagesize | 44 #include <unistd.h> // getpagesize |
45 // If you don't have execinfo.h then you need devel/libexecinfo from ports. | 45 // If you don't have execinfo.h then you need devel/libexecinfo from ports. |
46 #include <execinfo.h> // backtrace, backtrace_symbols | |
47 #include <strings.h> // index | 46 #include <strings.h> // index |
48 #include <errno.h> | 47 #include <errno.h> |
49 #include <stdarg.h> | 48 #include <stdarg.h> |
50 #include <limits.h> | 49 #include <limits.h> |
51 | 50 |
52 #undef MAP_TYPE | 51 #undef MAP_TYPE |
53 | 52 |
54 #include "v8.h" | 53 #include "v8.h" |
55 #include "v8threads.h" | 54 #include "v8threads.h" |
56 | 55 |
57 #include "platform-posix.h" | |
58 #include "platform.h" | 56 #include "platform.h" |
59 #include "vm-state-inl.h" | 57 #include "vm-state-inl.h" |
60 | 58 |
61 | 59 |
62 namespace v8 { | 60 namespace v8 { |
63 namespace internal { | 61 namespace internal { |
64 | 62 |
65 | 63 |
66 const char* OS::LocalTimezone(double time) { | 64 const char* OS::LocalTimezone(double time) { |
67 if (std::isnan(time)) return ""; | 65 if (std::isnan(time)) return ""; |
(...skipping 22 matching lines...) Expand all Loading... |
90 | 88 |
91 if (mbase == MAP_FAILED) { | 89 if (mbase == MAP_FAILED) { |
92 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); | 90 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); |
93 return NULL; | 91 return NULL; |
94 } | 92 } |
95 *allocated = msize; | 93 *allocated = msize; |
96 return mbase; | 94 return mbase; |
97 } | 95 } |
98 | 96 |
99 | 97 |
100 void OS::DumpBacktrace() { | |
101 POSIXBacktraceHelper<backtrace, backtrace_symbols>::DumpBacktrace(); | |
102 } | |
103 | |
104 | |
105 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 98 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
106 public: | 99 public: |
107 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 100 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
108 : file_(file), memory_(memory), size_(size) { } | 101 : file_(file), memory_(memory), size_(size) { } |
109 virtual ~PosixMemoryMappedFile(); | 102 virtual ~PosixMemoryMappedFile(); |
110 virtual void* memory() { return memory_; } | 103 virtual void* memory() { return memory_; } |
111 virtual int size() { return size_; } | 104 virtual int size() { return size_; } |
112 private: | 105 private: |
113 FILE* file_; | 106 FILE* file_; |
114 void* memory_; | 107 void* memory_; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return munmap(base, size) == 0; | 323 return munmap(base, size) == 0; |
331 } | 324 } |
332 | 325 |
333 | 326 |
334 bool VirtualMemory::HasLazyCommits() { | 327 bool VirtualMemory::HasLazyCommits() { |
335 // TODO(alph): implement for the platform. | 328 // TODO(alph): implement for the platform. |
336 return false; | 329 return false; |
337 } | 330 } |
338 | 331 |
339 } } // namespace v8::internal | 332 } } // namespace v8::internal |
OLD | NEW |