OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return data; | 93 return data; |
94 } | 94 } |
95 #endif | 95 #endif |
96 void* data = AllocateUninitialized(length); | 96 void* data = AllocateUninitialized(length); |
97 return data == NULL ? data : memset(data, 0, length); | 97 return data == NULL ? data : memset(data, 0, length); |
98 } | 98 } |
99 virtual void* AllocateUninitialized(size_t length) { | 99 virtual void* AllocateUninitialized(size_t length) { |
100 #if USE_VM | 100 #if USE_VM |
101 if (RoundToPageSize(&length)) return VirtualMemoryAllocate(length); | 101 if (RoundToPageSize(&length)) return VirtualMemoryAllocate(length); |
102 #endif | 102 #endif |
| 103 // Work around for GCC bug on AIX |
| 104 // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79839 |
| 105 #if V8_OS_AIX && _LINUX_SOURCE_COMPAT |
| 106 return __linux_malloc(length); |
| 107 #else |
103 return malloc(length); | 108 return malloc(length); |
| 109 #endif |
104 } | 110 } |
105 virtual void Free(void* data, size_t length) { | 111 virtual void Free(void* data, size_t length) { |
106 #if USE_VM | 112 #if USE_VM |
107 if (RoundToPageSize(&length)) { | 113 if (RoundToPageSize(&length)) { |
108 base::VirtualMemory::ReleaseRegion(data, length); | 114 base::VirtualMemory::ReleaseRegion(data, length); |
109 return; | 115 return; |
110 } | 116 } |
111 #endif | 117 #endif |
112 free(data); | 118 free(data); |
113 } | 119 } |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 } | 3031 } |
3026 | 3032 |
3027 } // namespace v8 | 3033 } // namespace v8 |
3028 | 3034 |
3029 | 3035 |
3030 #ifndef GOOGLE3 | 3036 #ifndef GOOGLE3 |
3031 int main(int argc, char* argv[]) { | 3037 int main(int argc, char* argv[]) { |
3032 return v8::Shell::Main(argc, argv); | 3038 return v8::Shell::Main(argc, argv); |
3033 } | 3039 } |
3034 #endif | 3040 #endif |
OLD | NEW |