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

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

Issue 6092007: Write buffer based write barrier for IA32 and Crankshaft. Currently... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 11 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/write-buffer.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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const int code_range_size = 32*MB; 185 const int code_range_size = 32*MB;
186 CodeRange::Setup(code_range_size); 186 CodeRange::Setup(code_range_size);
187 int current_allocated = 0; 187 int current_allocated = 0;
188 int total_allocated = 0; 188 int total_allocated = 0;
189 List<Block> blocks(1000); 189 List<Block> blocks(1000);
190 190
191 while (total_allocated < 5 * code_range_size) { 191 while (total_allocated < 5 * code_range_size) {
192 if (current_allocated < code_range_size / 10) { 192 if (current_allocated < code_range_size / 10) {
193 // Allocate a block. 193 // Allocate a block.
194 // Geometrically distributed sizes, greater than Page::kMaxHeapObjectSize. 194 // Geometrically distributed sizes, greater than Page::kMaxHeapObjectSize.
195 // TODO (gc) instead of using 3 use some contant based on code_range_size 195 // TODO(gc): instead of using 3 use some contant based on code_range_size
196 // kMaxHeapObjectSize. 196 // kMaxHeapObjectSize.
197 size_t requested = (Page::kMaxHeapObjectSize << (Pseudorandom() % 3)) + 197 size_t requested = (Page::kMaxHeapObjectSize << (Pseudorandom() % 3)) +
198 Pseudorandom() % 5000 + 1; 198 Pseudorandom() % 5000 + 1;
199 size_t allocated = 0; 199 size_t allocated = 0;
200 Address base = CodeRange::AllocateRawMemory(requested, &allocated); 200 Address base = CodeRange::AllocateRawMemory(requested, &allocated);
201 blocks.Add(Block(base, static_cast<int>(allocated))); 201 blocks.Add(Block(base, static_cast<int>(allocated)));
202 current_allocated += static_cast<int>(allocated); 202 current_allocated += static_cast<int>(allocated);
203 total_allocated += static_cast<int>(allocated); 203 total_allocated += static_cast<int>(allocated);
204 } else { 204 } else {
205 // Free a block. 205 // Free a block.
206 int index = Pseudorandom() % blocks.length(); 206 int index = Pseudorandom() % blocks.length();
207 CodeRange::FreeRawMemory(blocks[index].base, blocks[index].size); 207 CodeRange::FreeRawMemory(blocks[index].base, blocks[index].size);
208 current_allocated -= blocks[index].size; 208 current_allocated -= blocks[index].size;
209 if (index < blocks.length() - 1) { 209 if (index < blocks.length() - 1) {
210 blocks[index] = blocks.RemoveLast(); 210 blocks[index] = blocks.RemoveLast();
211 } else { 211 } else {
212 blocks.RemoveLast(); 212 blocks.RemoveLast();
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 CodeRange::TearDown(); 217 CodeRange::TearDown();
218 } 218 }
OLDNEW
« no previous file with comments | « src/write-buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698