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

Side by Side Diff: src/base/platform/platform-solaris.cc

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.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 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible 5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible
6 // parts, the implementation is in platform-posix.cc. 6 // parts, the implementation is in platform-posix.cc.
7 7
8 #ifdef __sparc 8 #ifdef __sparc
9 # error "V8 does not support the SPARC CPU architecture." 9 # error "V8 does not support the SPARC CPU architecture."
10 #endif 10 #endif
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } 148 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { }
149 149
150 150
151 VirtualMemory::VirtualMemory(size_t size) 151 VirtualMemory::VirtualMemory(size_t size)
152 : address_(ReserveRegion(size)), size_(size) { } 152 : address_(ReserveRegion(size)), size_(size) { }
153 153
154 154
155 VirtualMemory::VirtualMemory(size_t size, size_t alignment) 155 VirtualMemory::VirtualMemory(size_t size, size_t alignment)
156 : address_(NULL), size_(0) { 156 : address_(NULL), size_(0) {
157 ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); 157 DCHECK(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment())));
158 size_t request_size = RoundUp(size + alignment, 158 size_t request_size = RoundUp(size + alignment,
159 static_cast<intptr_t>(OS::AllocateAlignment())); 159 static_cast<intptr_t>(OS::AllocateAlignment()));
160 void* reservation = mmap(OS::GetRandomMmapAddr(), 160 void* reservation = mmap(OS::GetRandomMmapAddr(),
161 request_size, 161 request_size,
162 PROT_NONE, 162 PROT_NONE,
163 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, 163 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
164 kMmapFd, 164 kMmapFd,
165 kMmapFdOffset); 165 kMmapFdOffset);
166 if (reservation == MAP_FAILED) return; 166 if (reservation == MAP_FAILED) return;
167 167
168 uint8_t* base = static_cast<uint8_t*>(reservation); 168 uint8_t* base = static_cast<uint8_t*>(reservation);
169 uint8_t* aligned_base = RoundUp(base, alignment); 169 uint8_t* aligned_base = RoundUp(base, alignment);
170 ASSERT_LE(base, aligned_base); 170 DCHECK_LE(base, aligned_base);
171 171
172 // Unmap extra memory reserved before and after the desired block. 172 // Unmap extra memory reserved before and after the desired block.
173 if (aligned_base != base) { 173 if (aligned_base != base) {
174 size_t prefix_size = static_cast<size_t>(aligned_base - base); 174 size_t prefix_size = static_cast<size_t>(aligned_base - base);
175 OS::Free(base, prefix_size); 175 OS::Free(base, prefix_size);
176 request_size -= prefix_size; 176 request_size -= prefix_size;
177 } 177 }
178 178
179 size_t aligned_size = RoundUp(size, OS::AllocateAlignment()); 179 size_t aligned_size = RoundUp(size, OS::AllocateAlignment());
180 ASSERT_LE(aligned_size, request_size); 180 DCHECK_LE(aligned_size, request_size);
181 181
182 if (aligned_size != request_size) { 182 if (aligned_size != request_size) {
183 size_t suffix_size = request_size - aligned_size; 183 size_t suffix_size = request_size - aligned_size;
184 OS::Free(aligned_base + aligned_size, suffix_size); 184 OS::Free(aligned_base + aligned_size, suffix_size);
185 request_size -= suffix_size; 185 request_size -= suffix_size;
186 } 186 }
187 187
188 ASSERT(aligned_size == request_size); 188 DCHECK(aligned_size == request_size);
189 189
190 address_ = static_cast<void*>(aligned_base); 190 address_ = static_cast<void*>(aligned_base);
191 size_ = aligned_size; 191 size_ = aligned_size;
192 } 192 }
193 193
194 194
195 VirtualMemory::~VirtualMemory() { 195 VirtualMemory::~VirtualMemory() {
196 if (IsReserved()) { 196 if (IsReserved()) {
197 bool result = ReleaseRegion(address(), size()); 197 bool result = ReleaseRegion(address(), size());
198 ASSERT(result); 198 DCHECK(result);
199 USE(result); 199 USE(result);
200 } 200 }
201 } 201 }
202 202
203 203
204 bool VirtualMemory::IsReserved() { 204 bool VirtualMemory::IsReserved() {
205 return address_ != NULL; 205 return address_ != NULL;
206 } 206 }
207 207
208 208
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return munmap(base, size) == 0; 270 return munmap(base, size) == 0;
271 } 271 }
272 272
273 273
274 bool VirtualMemory::HasLazyCommits() { 274 bool VirtualMemory::HasLazyCommits() {
275 // TODO(alph): implement for the platform. 275 // TODO(alph): implement for the platform.
276 return false; 276 return false;
277 } 277 }
278 278
279 } } // namespace v8::base 279 } } // namespace v8::base
OLDNEW
« no previous file with comments | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698