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

Side by Side Diff: src/allocation.h

Issue 2342563002: [d8] Fix the shared-library build (Closed)
Patch Set: Mark as extern in .cc Created 4 years, 3 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 | « include/v8.h ('k') | src/basic-block-profiler.h » ('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 V8_EXPORT_PRIVATE 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 V8_EXPORT_PRIVATE 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* New(size_t size); 24 static void* New(size_t size);
25 static void Delete(void* p); 25 static void Delete(void* p);
26 }; 26 };
27 27
28 28
29 // 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.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 template <typename T> 66 template <typename T>
67 void DeleteArray(T* array) { 67 void DeleteArray(T* array) {
68 delete[] array; 68 delete[] array;
69 } 69 }
70 70
71 71
72 // The normal strdup functions use malloc. These versions of StrDup 72 // The normal strdup functions use malloc. These versions of StrDup
73 // and StrNDup uses new and calls the FatalProcessOutOfMemory handler 73 // and StrNDup uses new and calls the FatalProcessOutOfMemory handler
74 // if allocation fails. 74 // if allocation fails.
75 char* StrDup(const char* str); 75 V8_EXPORT_PRIVATE char* StrDup(const char* str);
76 char* StrNDup(const char* str, int n); 76 char* StrNDup(const char* str, int n);
77 77
78 78
79 // Allocation policy for allocating in the C free store using malloc 79 // Allocation policy for allocating in the C free store using malloc
80 // and free. Used as the default policy for lists. 80 // and free. Used as the default policy for lists.
81 class FreeStoreAllocationPolicy { 81 class FreeStoreAllocationPolicy {
82 public: 82 public:
83 INLINE(void* New(size_t size)) { return Malloced::New(size); } 83 INLINE(void* New(size_t size)) { return Malloced::New(size); }
84 INLINE(static void Delete(void* p)) { Malloced::Delete(p); } 84 INLINE(static void Delete(void* p)) { Malloced::Delete(p); }
85 }; 85 };
86 86
87 87
88 void* AlignedAlloc(size_t size, size_t alignment); 88 void* AlignedAlloc(size_t size, size_t alignment);
89 void AlignedFree(void *ptr); 89 void AlignedFree(void *ptr);
90 90
91 } // namespace internal 91 } // namespace internal
92 } // namespace v8 92 } // namespace v8
93 93
94 #endif // V8_ALLOCATION_H_ 94 #endif // V8_ALLOCATION_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/basic-block-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698