OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 CHECK(!heap->AllocateFixedArray(kOldPointerSpaceFillerLength, TENURED)-> | 81 CHECK(!heap->AllocateFixedArray(kOldPointerSpaceFillerLength, TENURED)-> |
82 IsFailure()); | 82 IsFailure()); |
83 } | 83 } |
84 CHECK(!heap->AllocateFixedArray(kOldPointerSpaceFillerLength, TENURED)-> | 84 CHECK(!heap->AllocateFixedArray(kOldPointerSpaceFillerLength, TENURED)-> |
85 IsFailure()); | 85 IsFailure()); |
86 | 86 |
87 // Large object space. | 87 // Large object space. |
88 static const int kLargeObjectSpaceFillerLength = 300000; | 88 static const int kLargeObjectSpaceFillerLength = 300000; |
89 static const int kLargeObjectSpaceFillerSize = FixedArray::SizeFor( | 89 static const int kLargeObjectSpaceFillerSize = FixedArray::SizeFor( |
90 kLargeObjectSpaceFillerLength); | 90 kLargeObjectSpaceFillerLength); |
91 ASSERT(kLargeObjectSpaceFillerSize > heap->MaxObjectSizeInPagedSpace()); | 91 ASSERT(kLargeObjectSpaceFillerSize > heap->old_pointer_space()->AreaSize()); |
92 while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) { | 92 while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) { |
93 CHECK(!heap->AllocateFixedArray(kLargeObjectSpaceFillerLength, TENURED)-> | 93 CHECK(!heap->AllocateFixedArray(kLargeObjectSpaceFillerLength, TENURED)-> |
94 IsFailure()); | 94 IsFailure()); |
95 } | 95 } |
96 CHECK(!heap->AllocateFixedArray(kLargeObjectSpaceFillerLength, TENURED)-> | 96 CHECK(!heap->AllocateFixedArray(kLargeObjectSpaceFillerLength, TENURED)-> |
97 IsFailure()); | 97 IsFailure()); |
98 | 98 |
99 // Map space. | 99 // Map space. |
100 MapSpace* map_space = heap->map_space(); | 100 MapSpace* map_space = heap->map_space(); |
101 static const int kMapSpaceFillerSize = Map::kSize; | 101 static const int kMapSpaceFillerSize = Map::kSize; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 Isolate::Current()->InitializeLoggingAndCounters(); | 207 Isolate::Current()->InitializeLoggingAndCounters(); |
208 CodeRange* code_range = new CodeRange(Isolate::Current()); | 208 CodeRange* code_range = new CodeRange(Isolate::Current()); |
209 code_range->SetUp(code_range_size); | 209 code_range->SetUp(code_range_size); |
210 int current_allocated = 0; | 210 int current_allocated = 0; |
211 int total_allocated = 0; | 211 int total_allocated = 0; |
212 List<Block> blocks(1000); | 212 List<Block> blocks(1000); |
213 | 213 |
214 while (total_allocated < 5 * code_range_size) { | 214 while (total_allocated < 5 * code_range_size) { |
215 if (current_allocated < code_range_size / 10) { | 215 if (current_allocated < code_range_size / 10) { |
216 // Allocate a block. | 216 // Allocate a block. |
217 // Geometrically distributed sizes, greater than Page::kMaxHeapObjectSize. | 217 // Geometrically distributed sizes, greater than |
| 218 // Page::kMaxNonCodeHeapObjectSize (which is greater than code page area). |
218 // TODO(gc): instead of using 3 use some contant based on code_range_size | 219 // TODO(gc): instead of using 3 use some contant based on code_range_size |
219 // kMaxHeapObjectSize. | 220 // kMaxHeapObjectSize. |
220 size_t requested = (Page::kMaxHeapObjectSize << (Pseudorandom() % 3)) + | 221 size_t requested = |
221 Pseudorandom() % 5000 + 1; | 222 (Page::kMaxNonCodeHeapObjectSize << (Pseudorandom() % 3)) + |
| 223 Pseudorandom() % 5000 + 1; |
222 size_t allocated = 0; | 224 size_t allocated = 0; |
223 Address base = code_range->AllocateRawMemory(requested, &allocated); | 225 Address base = code_range->AllocateRawMemory(requested, &allocated); |
224 CHECK(base != NULL); | 226 CHECK(base != NULL); |
225 blocks.Add(Block(base, static_cast<int>(allocated))); | 227 blocks.Add(Block(base, static_cast<int>(allocated))); |
226 current_allocated += static_cast<int>(allocated); | 228 current_allocated += static_cast<int>(allocated); |
227 total_allocated += static_cast<int>(allocated); | 229 total_allocated += static_cast<int>(allocated); |
228 } else { | 230 } else { |
229 // Free a block. | 231 // Free a block. |
230 int index = Pseudorandom() % blocks.length(); | 232 int index = Pseudorandom() % blocks.length(); |
231 code_range->FreeRawMemory(blocks[index].base, blocks[index].size); | 233 code_range->FreeRawMemory(blocks[index].base, blocks[index].size); |
232 current_allocated -= blocks[index].size; | 234 current_allocated -= blocks[index].size; |
233 if (index < blocks.length() - 1) { | 235 if (index < blocks.length() - 1) { |
234 blocks[index] = blocks.RemoveLast(); | 236 blocks[index] = blocks.RemoveLast(); |
235 } else { | 237 } else { |
236 blocks.RemoveLast(); | 238 blocks.RemoveLast(); |
237 } | 239 } |
238 } | 240 } |
239 } | 241 } |
240 | 242 |
241 code_range->TearDown(); | 243 code_range->TearDown(); |
242 delete code_range; | 244 delete code_range; |
243 } | 245 } |
OLD | NEW |