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

Side by Side Diff: src/allocation.cc

Issue 297303004: Revert 21502 - "Move OS::MemCopy and OS::MemMove out of platform to utils" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.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 "allocation.h" 5 #include "allocation.h"
6 6
7 #include <stdlib.h> // For free, malloc. 7 #include <stdlib.h> // For free, malloc.
8 #include "checks.h" 8 #include "checks.h"
9 #include "platform.h" 9 #include "platform.h"
10 #include "utils.h" 10 #include "utils.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void AllStatic::operator delete(void* p) { 59 void AllStatic::operator delete(void* p) {
60 UNREACHABLE(); 60 UNREACHABLE();
61 } 61 }
62 62
63 #endif 63 #endif
64 64
65 65
66 char* StrDup(const char* str) { 66 char* StrDup(const char* str) {
67 int length = StrLength(str); 67 int length = StrLength(str);
68 char* result = NewArray<char>(length + 1); 68 char* result = NewArray<char>(length + 1);
69 MemCopy(result, str, length); 69 OS::MemCopy(result, str, length);
70 result[length] = '\0'; 70 result[length] = '\0';
71 return result; 71 return result;
72 } 72 }
73 73
74 74
75 char* StrNDup(const char* str, int n) { 75 char* StrNDup(const char* str, int n) {
76 int length = StrLength(str); 76 int length = StrLength(str);
77 if (n < length) length = n; 77 if (n < length) length = n;
78 char* result = NewArray<char>(length + 1); 78 char* result = NewArray<char>(length + 1);
79 MemCopy(result, str, length); 79 OS::MemCopy(result, str, length);
80 result[length] = '\0'; 80 result[length] = '\0';
81 return result; 81 return result;
82 } 82 }
83 83
84 84
85 void* AlignedAlloc(size_t size, size_t alignment) { 85 void* AlignedAlloc(size_t size, size_t alignment) {
86 ASSERT(IsPowerOf2(alignment) && alignment >= V8_ALIGNOF(void*)); // NOLINT 86 ASSERT(IsPowerOf2(alignment) && alignment >= V8_ALIGNOF(void*)); // NOLINT
87 void* ptr; 87 void* ptr;
88 #if V8_OS_WIN 88 #if V8_OS_WIN
89 ptr = _aligned_malloc(size, alignment); 89 ptr = _aligned_malloc(size, alignment);
(...skipping 14 matching lines...) Expand all
104 _aligned_free(ptr); 104 _aligned_free(ptr);
105 #elif V8_LIBC_BIONIC 105 #elif V8_LIBC_BIONIC
106 // Using free is not correct in general, but for V8_LIBC_BIONIC it is. 106 // Using free is not correct in general, but for V8_LIBC_BIONIC it is.
107 free(ptr); 107 free(ptr);
108 #else 108 #else
109 free(ptr); 109 free(ptr);
110 #endif 110 #endif
111 } 111 }
112 112
113 } } // namespace v8::internal 113 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698