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

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

Issue 910333004: Contribution of PowerPC port (continuation of 422063005) - PPC opt 2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated to remove non-test changes Created 5 years, 10 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 | « no previous file | test/cctest/test-constantpool.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 // 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // Old data space. 57 // Old data space.
58 SimulateFullSpace(heap->old_data_space()); 58 SimulateFullSpace(heap->old_data_space());
59 heap->AllocateByteArray(100, TENURED).ToObjectChecked(); 59 heap->AllocateByteArray(100, TENURED).ToObjectChecked();
60 60
61 // Old pointer space. 61 // Old pointer space.
62 SimulateFullSpace(heap->old_pointer_space()); 62 SimulateFullSpace(heap->old_pointer_space());
63 heap->AllocateFixedArray(10000, TENURED).ToObjectChecked(); 63 heap->AllocateFixedArray(10000, TENURED).ToObjectChecked();
64 64
65 // Large object space. 65 // Large object space.
66 static const int kLargeObjectSpaceFillerLength = 300000; 66 static const int kLargeObjectSpaceFillerLength = 3 * (Page::kPageSize / 10);
67 static const int kLargeObjectSpaceFillerSize = FixedArray::SizeFor( 67 static const int kLargeObjectSpaceFillerSize = FixedArray::SizeFor(
68 kLargeObjectSpaceFillerLength); 68 kLargeObjectSpaceFillerLength);
69 DCHECK(kLargeObjectSpaceFillerSize > heap->old_pointer_space()->AreaSize()); 69 DCHECK(kLargeObjectSpaceFillerSize > heap->old_pointer_space()->AreaSize());
70 while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) { 70 while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) {
71 heap->AllocateFixedArray( 71 heap->AllocateFixedArray(
72 kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked(); 72 kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked();
73 } 73 }
74 heap->AllocateFixedArray( 74 heap->AllocateFixedArray(
75 kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked(); 75 kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked();
76 76
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 size_t current_allocated = 0; 203 size_t current_allocated = 0;
204 size_t total_allocated = 0; 204 size_t total_allocated = 0;
205 List< ::Block> blocks(1000); 205 List< ::Block> blocks(1000);
206 206
207 while (total_allocated < 5 * code_range_size) { 207 while (total_allocated < 5 * code_range_size) {
208 if (current_allocated < code_range_size / 10) { 208 if (current_allocated < code_range_size / 10) {
209 // Allocate a block. 209 // Allocate a block.
210 // Geometrically distributed sizes, greater than 210 // Geometrically distributed sizes, greater than
211 // Page::kMaxRegularHeapObjectSize (which is greater than code page area). 211 // Page::kMaxRegularHeapObjectSize (which is greater than code page area).
212 // TODO(gc): instead of using 3 use some contant based on code_range_size 212 // TODO(gc): instead of using 3 use some contant based on code_range_size
213 // kMaxHeapObjectSize. 213 // kMaxRegularHeapObjectSize.
214 size_t requested = 214 size_t requested =
215 (Page::kMaxRegularHeapObjectSize << (Pseudorandom() % 3)) + 215 (Page::kMaxRegularHeapObjectSize << (Pseudorandom() % 3)) +
216 Pseudorandom() % 5000 + 1; 216 Pseudorandom() % 5000 + 1;
217 size_t allocated = 0; 217 size_t allocated = 0;
218 Address base = code_range.AllocateRawMemory(requested, 218 Address base = code_range.AllocateRawMemory(requested,
219 requested, 219 requested,
220 &allocated); 220 &allocated);
221 CHECK(base != NULL); 221 CHECK(base != NULL);
222 blocks.Add(::Block(base, static_cast<int>(allocated))); 222 blocks.Add(::Block(base, static_cast<int>(allocated)));
223 current_allocated += static_cast<int>(allocated); 223 current_allocated += static_cast<int>(allocated);
224 total_allocated += static_cast<int>(allocated); 224 total_allocated += static_cast<int>(allocated);
225 } else { 225 } else {
226 // Free a block. 226 // Free a block.
227 int index = Pseudorandom() % blocks.length(); 227 int index = Pseudorandom() % blocks.length();
228 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); 228 code_range.FreeRawMemory(blocks[index].base, blocks[index].size);
229 current_allocated -= blocks[index].size; 229 current_allocated -= blocks[index].size;
230 if (index < blocks.length() - 1) { 230 if (index < blocks.length() - 1) {
231 blocks[index] = blocks.RemoveLast(); 231 blocks[index] = blocks.RemoveLast();
232 } else { 232 } else {
233 blocks.RemoveLast(); 233 blocks.RemoveLast();
234 } 234 }
235 } 235 }
236 } 236 }
237 237
238 code_range.TearDown(); 238 code_range.TearDown();
239 } 239 }
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-constantpool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698