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

Side by Side Diff: src/allocation.cc

Issue 897213003: Remove obsolete Malloced::FatalProcessOutOfMemory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/allocation.h ('k') | src/serialize.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 // 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 "src/allocation.h" 5 #include "src/allocation.h"
6 6
7 #include <stdlib.h> // For free, malloc. 7 #include <stdlib.h> // For free, malloc.
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
11 #include "src/utils.h" 11 #include "src/utils.h"
12 #include "src/v8.h"
12 13
13 #if V8_LIBC_BIONIC 14 #if V8_LIBC_BIONIC
14 #include <malloc.h> // NOLINT 15 #include <malloc.h> // NOLINT
15 #endif 16 #endif
16 17
17 namespace v8 { 18 namespace v8 {
18 namespace internal { 19 namespace internal {
19 20
20 void* Malloced::New(size_t size) { 21 void* Malloced::New(size_t size) {
21 void* result = malloc(size); 22 void* result = malloc(size);
22 if (result == NULL) { 23 if (result == NULL) {
23 v8::internal::FatalProcessOutOfMemory("Malloced operator new"); 24 V8::FatalProcessOutOfMemory("Malloced operator new");
24 } 25 }
25 return result; 26 return result;
26 } 27 }
27 28
28 29
29 void Malloced::Delete(void* p) { 30 void Malloced::Delete(void* p) {
30 free(p); 31 free(p);
31 } 32 }
32 33
33 34
34 void Malloced::FatalProcessOutOfMemory() {
35 v8::internal::FatalProcessOutOfMemory("Out of memory");
36 }
37
38
39 #ifdef DEBUG 35 #ifdef DEBUG
40 36
41 static void* invalid = static_cast<void*>(NULL); 37 static void* invalid = static_cast<void*>(NULL);
42 38
43 void* Embedded::operator new(size_t size) { 39 void* Embedded::operator new(size_t size) {
44 UNREACHABLE(); 40 UNREACHABLE();
45 return invalid; 41 return invalid;
46 } 42 }
47 43
48 44
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void* ptr; 85 void* ptr;
90 #if V8_OS_WIN 86 #if V8_OS_WIN
91 ptr = _aligned_malloc(size, alignment); 87 ptr = _aligned_malloc(size, alignment);
92 #elif V8_LIBC_BIONIC 88 #elif V8_LIBC_BIONIC
93 // posix_memalign is not exposed in some Android versions, so we fall back to 89 // posix_memalign is not exposed in some Android versions, so we fall back to
94 // memalign. See http://code.google.com/p/android/issues/detail?id=35391. 90 // memalign. See http://code.google.com/p/android/issues/detail?id=35391.
95 ptr = memalign(alignment, size); 91 ptr = memalign(alignment, size);
96 #else 92 #else
97 if (posix_memalign(&ptr, alignment, size)) ptr = NULL; 93 if (posix_memalign(&ptr, alignment, size)) ptr = NULL;
98 #endif 94 #endif
99 if (ptr == NULL) FatalProcessOutOfMemory("AlignedAlloc"); 95 if (ptr == NULL) V8::FatalProcessOutOfMemory("AlignedAlloc");
100 return ptr; 96 return ptr;
101 } 97 }
102 98
103 99
104 void AlignedFree(void *ptr) { 100 void AlignedFree(void *ptr) {
105 #if V8_OS_WIN 101 #if V8_OS_WIN
106 _aligned_free(ptr); 102 _aligned_free(ptr);
107 #elif V8_LIBC_BIONIC 103 #elif V8_LIBC_BIONIC
108 // Using free is not correct in general, but for V8_LIBC_BIONIC it is. 104 // Using free is not correct in general, but for V8_LIBC_BIONIC it is.
109 free(ptr); 105 free(ptr);
110 #else 106 #else
111 free(ptr); 107 free(ptr);
112 #endif 108 #endif
113 } 109 }
114 110
115 } } // namespace v8::internal 111 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/allocation.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698