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

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

Issue 6794050: Revert "[Arguments] Merge (7442,7496] from bleeding_edge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/zone-inl.h ('k') | test/cctest/test-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 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);
204 blocks.Add(Block(base, static_cast<int>(allocated))); 203 blocks.Add(Block(base, static_cast<int>(allocated)));
205 current_allocated += static_cast<int>(allocated); 204 current_allocated += static_cast<int>(allocated);
206 total_allocated += static_cast<int>(allocated); 205 total_allocated += static_cast<int>(allocated);
207 } else { 206 } else {
208 // Free a block. 207 // Free a block.
209 int index = Pseudorandom() % blocks.length(); 208 int index = Pseudorandom() % blocks.length();
210 Isolate::Current()->code_range()->FreeRawMemory( 209 Isolate::Current()->code_range()->FreeRawMemory(
211 blocks[index].base, blocks[index].size); 210 blocks[index].base, blocks[index].size);
212 current_allocated -= blocks[index].size; 211 current_allocated -= blocks[index].size;
213 if (index < blocks.length() - 1) { 212 if (index < blocks.length() - 1) {
214 blocks[index] = blocks.RemoveLast(); 213 blocks[index] = blocks.RemoveLast();
215 } else { 214 } else {
216 blocks.RemoveLast(); 215 blocks.RemoveLast();
217 } 216 }
218 } 217 }
219 } 218 }
220 219
221 Isolate::Current()->code_range()->TearDown(); 220 Isolate::Current()->code_range()->TearDown();
222 } 221 }
OLDNEW
« no previous file with comments | « src/zone-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698