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

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

Issue 7379004: Add guard pages in front of platform allocations (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Platform specific code for POSIX goes here. This is not a platform on its 28 // Platform specific code for POSIX goes here. This is not a platform on its
29 // own but contains the parts which are the same across POSIX platforms Linux, 29 // own but contains the parts which are the same across POSIX platforms Linux,
30 // Mac OS, FreeBSD and OpenBSD. 30 // Mac OS, FreeBSD and OpenBSD.
31 31
32 #include <unistd.h> 32 #include <unistd.h>
33 #include <errno.h> 33 #include <errno.h>
34 #include <time.h> 34 #include <time.h>
35 35
36 #include <sys/mman.h>
36 #include <sys/socket.h> 37 #include <sys/socket.h>
37 #include <sys/resource.h> 38 #include <sys/resource.h>
38 #include <sys/time.h> 39 #include <sys/time.h>
39 #include <sys/types.h> 40 #include <sys/types.h>
40 #include <sys/stat.h> 41 #include <sys/stat.h>
41 42
42 #include <arpa/inet.h> 43 #include <arpa/inet.h>
43 #include <netinet/in.h> 44 #include <netinet/in.h>
44 #include <netdb.h> 45 #include <netdb.h>
45 46
47 #undef MAP_TYPE
48
46 #if defined(ANDROID) 49 #if defined(ANDROID)
47 #define LOG_TAG "v8" 50 #define LOG_TAG "v8"
48 #include <utils/Log.h> // LOG_PRI_VA 51 #include <utils/Log.h> // LOG_PRI_VA
49 #endif 52 #endif
50 53
51 #include "v8.h" 54 #include "v8.h"
52 55
53 #include "platform.h" 56 #include "platform.h"
54 57
55 namespace v8 { 58 namespace v8 {
56 namespace internal { 59 namespace internal {
57 60
58 61
59 // Maximum size of the virtual memory. 0 means there is no artificial 62 // Maximum size of the virtual memory. 0 means there is no artificial
60 // limit. 63 // limit.
61 64
62 intptr_t OS::MaxVirtualMemory() { 65 intptr_t OS::MaxVirtualMemory() {
63 struct rlimit limit; 66 struct rlimit limit;
64 int result = getrlimit(RLIMIT_DATA, &limit); 67 int result = getrlimit(RLIMIT_DATA, &limit);
65 if (result != 0) return 0; 68 if (result != 0) return 0;
66 return limit.rlim_cur; 69 return limit.rlim_cur;
67 } 70 }
68 71
69 72
73 // Create guard pages.
74 void OS::Guard(void* address, const size_t size) {
75 mprotect(address, size, PROT_NONE);
76 }
77
78
70 // ---------------------------------------------------------------------------- 79 // ----------------------------------------------------------------------------
71 // Math functions 80 // Math functions
72 81
73 double modulo(double x, double y) { 82 double modulo(double x, double y) {
74 return fmod(x, y); 83 return fmod(x, y);
75 } 84 }
76 85
77 86
78 double OS::nan_value() { 87 double OS::nan_value() {
79 // NAN from math.h is defined in C99 and not in POSIX. 88 // NAN from math.h is defined in C99 and not in POSIX.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 return ntohl(value); 449 return ntohl(value);
441 } 450 }
442 451
443 452
444 Socket* OS::CreateSocket() { 453 Socket* OS::CreateSocket() {
445 return new POSIXSocket(); 454 return new POSIXSocket();
446 } 455 }
447 456
448 457
449 } } // namespace v8::internal 458 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-nullos.cc ('k') | src/platform-win32.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698