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

Side by Side Diff: src/allocation.cc

Issue 634493002: Make V8 compile with Win64 dbg (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/compiler/instruction-selector.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"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (n < length) length = n; 78 if (n < length) length = n;
79 char* result = NewArray<char>(length + 1); 79 char* result = NewArray<char>(length + 1);
80 MemCopy(result, str, length); 80 MemCopy(result, str, length);
81 result[length] = '\0'; 81 result[length] = '\0';
82 return result; 82 return result;
83 } 83 }
84 84
85 85
86 void* AlignedAlloc(size_t size, size_t alignment) { 86 void* AlignedAlloc(size_t size, size_t alignment) {
87 DCHECK_LE(V8_ALIGNOF(void*), alignment); 87 DCHECK_LE(V8_ALIGNOF(void*), alignment);
88 DCHECK(base::bits::IsPowerOfTwo32(alignment)); 88 DCHECK(base::bits::IsPowerOfTwo64(alignment));
89 void* ptr; 89 void* ptr;
90 #if V8_OS_WIN 90 #if V8_OS_WIN
91 ptr = _aligned_malloc(size, alignment); 91 ptr = _aligned_malloc(size, alignment);
92 #elif V8_LIBC_BIONIC 92 #elif V8_LIBC_BIONIC
93 // posix_memalign is not exposed in some Android versions, so we fall back to 93 // 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. 94 // memalign. See http://code.google.com/p/android/issues/detail?id=35391.
95 ptr = memalign(alignment, size); 95 ptr = memalign(alignment, size);
96 #else 96 #else
97 if (posix_memalign(&ptr, alignment, size)) ptr = NULL; 97 if (posix_memalign(&ptr, alignment, size)) ptr = NULL;
98 #endif 98 #endif
99 if (ptr == NULL) FatalProcessOutOfMemory("AlignedAlloc"); 99 if (ptr == NULL) FatalProcessOutOfMemory("AlignedAlloc");
100 return ptr; 100 return ptr;
101 } 101 }
102 102
103 103
104 void AlignedFree(void *ptr) { 104 void AlignedFree(void *ptr) {
105 #if V8_OS_WIN 105 #if V8_OS_WIN
106 _aligned_free(ptr); 106 _aligned_free(ptr);
107 #elif V8_LIBC_BIONIC 107 #elif V8_LIBC_BIONIC
108 // Using free is not correct in general, but for V8_LIBC_BIONIC it is. 108 // Using free is not correct in general, but for V8_LIBC_BIONIC it is.
109 free(ptr); 109 free(ptr);
110 #else 110 #else
111 free(ptr); 111 free(ptr);
112 #endif 112 #endif
113 } 113 }
114 114
115 } } // namespace v8::internal 115 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698