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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 Block(Address base_arg, int size_arg) | 196 Block(Address base_arg, int size_arg) |
197 : base(base_arg), size(size_arg) {} | 197 : base(base_arg), size(size_arg) {} |
198 | 198 |
199 Address base; | 199 Address base; |
200 int size; | 200 int size; |
201 }; | 201 }; |
202 | 202 |
203 | 203 |
204 TEST(CodeRange) { | 204 TEST(CodeRange) { |
205 const int code_range_size = 32*MB; | 205 const int code_range_size = 32*MB; |
206 OS::Setup(); | 206 OS::SetUp(); |
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 Page::kMaxHeapObjectSize. |
218 // TODO(gc): instead of using 3 use some contant based on code_range_size | 218 // TODO(gc): instead of using 3 use some contant based on code_range_size |
219 // kMaxHeapObjectSize. | 219 // kMaxHeapObjectSize. |
(...skipping 14 matching lines...) Expand all Loading... |
234 blocks[index] = blocks.RemoveLast(); | 234 blocks[index] = blocks.RemoveLast(); |
235 } else { | 235 } else { |
236 blocks.RemoveLast(); | 236 blocks.RemoveLast(); |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 code_range->TearDown(); | 241 code_range->TearDown(); |
242 delete code_range; | 242 delete code_range; |
243 } | 243 } |
OLD | NEW |