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

Side by Side Diff: runtime/vm/freelist_test.cc

Issue 287933002: Fix Android build warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | « runtime/bin/vmservice_impl.cc ('k') | runtime/vm/heap_test.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/freelist.h" 6 #include "vm/freelist.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 delete[] objects; 152 delete[] objects;
153 } 153 }
154 154
155 155
156 TEST_CASE(FreeListProtectedVariableSizeObjects) { 156 TEST_CASE(FreeListProtectedVariableSizeObjects) {
157 FreeList* free_list = new FreeList(); 157 FreeList* free_list = new FreeList();
158 const intptr_t kBlobSize = 8 * KB; 158 const intptr_t kBlobSize = 8 * KB;
159 const intptr_t kMinSize = 2 * kWordSize; 159 const intptr_t kMinSize = 2 * kWordSize;
160 uword* objects = new uword[kBlobSize / kMinSize]; 160 uword* objects = new uword[kBlobSize / kMinSize];
161 for (intptr_t i = 0; i < kBlobSize / kMinSize; ++i) { 161 for (intptr_t i = 0; i < kBlobSize / kMinSize; ++i) {
162 objects[i] = NULL; 162 objects[i] = static_cast<uword>(NULL);
163 } 163 }
164 164
165 VirtualMemory* blob = VirtualMemory::ReserveAligned(kBlobSize, 4096); 165 VirtualMemory* blob = VirtualMemory::ReserveAligned(kBlobSize, 4096);
166 blob->Commit(/* is_executable = */ false); 166 blob->Commit(/* is_executable = */ false);
167 blob->Protect(VirtualMemory::kReadWrite); 167 blob->Protect(VirtualMemory::kReadWrite);
168 168
169 // Enqueue the large blob as one free block. 169 // Enqueue the large blob as one free block.
170 free_list->Free(blob->start(), blob->size()); 170 free_list->Free(blob->start(), blob->size());
171 171
172 // Write protect the whole region. 172 // Write protect the whole region.
(...skipping 14 matching lines...) Expand all
187 e0 = Allocate(free_list, 3 * KB - 2 * kWordSize, true); 187 e0 = Allocate(free_list, 3 * KB - 2 * kWordSize, true);
188 ASSERT(e0); 188 ASSERT(e0);
189 189
190 // Delete the memory associated with the test. 190 // Delete the memory associated with the test.
191 delete blob; 191 delete blob;
192 delete free_list; 192 delete free_list;
193 delete[] objects; 193 delete[] objects;
194 } 194 }
195 195
196 } // namespace dart 196 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/vm/heap_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698