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

Side by Side Diff: test/cctest/test-alloc.cc

Issue 6776011: Fix the Cygwin build (Closed)
Patch Set: foobar Created 9 years, 8 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
« no previous file with comments | « src/platform-cygwin.cc ('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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 while (total_allocated < 5 * code_range_size) { 194 while (total_allocated < 5 * code_range_size) {
195 if (current_allocated < code_range_size / 10) { 195 if (current_allocated < code_range_size / 10) {
196 // Allocate a block. 196 // Allocate a block.
197 // Geometrically distributed sizes, greater than Page::kPageSize. 197 // Geometrically distributed sizes, greater than Page::kPageSize.
198 size_t requested = (Page::kPageSize << (Pseudorandom() % 6)) + 198 size_t requested = (Page::kPageSize << (Pseudorandom() % 6)) +
199 Pseudorandom() % 5000 + 1; 199 Pseudorandom() % 5000 + 1;
200 size_t allocated = 0; 200 size_t allocated = 0;
201 void* base = Isolate::Current()->code_range()-> 201 void* base = Isolate::Current()->code_range()->
202 AllocateRawMemory(requested, &allocated); 202 AllocateRawMemory(requested, &allocated);
203 CHECK(base != NULL);
203 blocks.Add(Block(base, static_cast<int>(allocated))); 204 blocks.Add(Block(base, static_cast<int>(allocated)));
204 current_allocated += static_cast<int>(allocated); 205 current_allocated += static_cast<int>(allocated);
205 total_allocated += static_cast<int>(allocated); 206 total_allocated += static_cast<int>(allocated);
206 } else { 207 } else {
207 // Free a block. 208 // Free a block.
208 int index = Pseudorandom() % blocks.length(); 209 int index = Pseudorandom() % blocks.length();
209 Isolate::Current()->code_range()->FreeRawMemory( 210 Isolate::Current()->code_range()->FreeRawMemory(
210 blocks[index].base, blocks[index].size); 211 blocks[index].base, blocks[index].size);
211 current_allocated -= blocks[index].size; 212 current_allocated -= blocks[index].size;
212 if (index < blocks.length() - 1) { 213 if (index < blocks.length() - 1) {
213 blocks[index] = blocks.RemoveLast(); 214 blocks[index] = blocks.RemoveLast();
214 } else { 215 } else {
215 blocks.RemoveLast(); 216 blocks.RemoveLast();
216 } 217 }
217 } 218 }
218 } 219 }
219 220
220 Isolate::Current()->code_range()->TearDown(); 221 Isolate::Current()->code_range()->TearDown();
221 } 222 }
OLDNEW
« no previous file with comments | « src/platform-cygwin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698