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

Side by Side Diff: src/allocation.h

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 | « no previous file | src/allocation.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 #ifndef V8_ALLOCATION_H_ 5 #ifndef V8_ALLOCATION_H_
6 #define V8_ALLOCATION_H_ 6 #define V8_ALLOCATION_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // Called when allocation routines fail to allocate. 13 // Called when allocation routines fail to allocate.
14 // This function should not return, but should terminate the current 14 // This function should not return, but should terminate the current
15 // processing. 15 // processing.
16 void FatalProcessOutOfMemory(const char* message); 16 void FatalProcessOutOfMemory(const char* message);
17 17
18 // Superclass for classes managed with new & delete. 18 // Superclass for classes managed with new & delete.
19 class Malloced { 19 class Malloced {
20 public: 20 public:
21 void* operator new(size_t size) { return New(size); } 21 void* operator new(size_t size) { return New(size); }
22 void operator delete(void* p) { Delete(p); } 22 void operator delete(void* p) { Delete(p); }
23 23
24 static void FatalProcessOutOfMemory();
25 static void* New(size_t size); 24 static void* New(size_t size);
26 static void Delete(void* p); 25 static void Delete(void* p);
27 }; 26 };
28 27
29 28
30 // A macro is used for defining the base class used for embedded instances. 29 // A macro is used for defining the base class used for embedded instances.
31 // The reason is some compilers allocate a minimum of one word for the 30 // The reason is some compilers allocate a minimum of one word for the
32 // superclass. The macro prevents the use of new & delete in debug mode. 31 // superclass. The macro prevents the use of new & delete in debug mode.
33 // In release mode we are not willing to pay this overhead. 32 // In release mode we are not willing to pay this overhead.
34 33
(...skipping 17 matching lines...) Expand all
52 public: 51 public:
53 void* operator new(size_t size); 52 void* operator new(size_t size);
54 void operator delete(void* p); 53 void operator delete(void* p);
55 #endif 54 #endif
56 }; 55 };
57 56
58 57
59 template <typename T> 58 template <typename T>
60 T* NewArray(size_t size) { 59 T* NewArray(size_t size) {
61 T* result = new T[size]; 60 T* result = new T[size];
62 if (result == NULL) Malloced::FatalProcessOutOfMemory(); 61 if (result == NULL) FatalProcessOutOfMemory("NewArray");
63 return result; 62 return result;
64 } 63 }
65 64
66 65
67 template <typename T> 66 template <typename T>
68 void DeleteArray(T* array) { 67 void DeleteArray(T* array) {
69 delete[] array; 68 delete[] array;
70 } 69 }
71 70
72 71
(...skipping 12 matching lines...) Expand all
85 INLINE(static void Delete(void* p)) { Malloced::Delete(p); } 84 INLINE(static void Delete(void* p)) { Malloced::Delete(p); }
86 }; 85 };
87 86
88 87
89 void* AlignedAlloc(size_t size, size_t alignment); 88 void* AlignedAlloc(size_t size, size_t alignment);
90 void AlignedFree(void *ptr); 89 void AlignedFree(void *ptr);
91 90
92 } } // namespace v8::internal 91 } } // namespace v8::internal
93 92
94 #endif // V8_ALLOCATION_H_ 93 #endif // V8_ALLOCATION_H_
OLDNEW
« no previous file with comments | « no previous file | src/allocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698