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

Side by Side Diff: src/allocation.cc

Issue 2535383005: Deprecate the BASE_EMBEDDED macro (Closed)
Patch Set: Created 4 years 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') | no next file » | 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"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 return result; 26 return result;
27 } 27 }
28 28
29 29
30 void Malloced::Delete(void* p) { 30 void Malloced::Delete(void* p) {
31 free(p); 31 free(p);
32 } 32 }
33 33
34 34
35 #ifdef DEBUG
36
37 static void* invalid = static_cast<void*>(NULL);
38
39 void* Embedded::operator new(size_t size) {
40 UNREACHABLE();
41 return invalid;
42 }
43
44
45 void Embedded::operator delete(void* p) {
46 UNREACHABLE();
47 }
48
49 #endif
50
51
52 char* StrDup(const char* str) { 35 char* StrDup(const char* str) {
53 int length = StrLength(str); 36 int length = StrLength(str);
54 char* result = NewArray<char>(length + 1); 37 char* result = NewArray<char>(length + 1);
55 MemCopy(result, str, length); 38 MemCopy(result, str, length);
56 result[length] = '\0'; 39 result[length] = '\0';
57 return result; 40 return result;
58 } 41 }
59 42
60 43
61 char* StrNDup(const char* str, int n) { 44 char* StrNDup(const char* str, int n) {
(...skipping 30 matching lines...) Expand all
92 #elif V8_LIBC_BIONIC 75 #elif V8_LIBC_BIONIC
93 // Using free is not correct in general, but for V8_LIBC_BIONIC it is. 76 // Using free is not correct in general, but for V8_LIBC_BIONIC it is.
94 free(ptr); 77 free(ptr);
95 #else 78 #else
96 free(ptr); 79 free(ptr);
97 #endif 80 #endif
98 } 81 }
99 82
100 } // namespace internal 83 } // namespace internal
101 } // namespace v8 84 } // namespace v8
OLDNEW
« no previous file with comments | « src/allocation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698