OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 public: | 189 public: |
190 Block(Address base_arg, int size_arg) | 190 Block(Address base_arg, int size_arg) |
191 : base(base_arg), size(size_arg) {} | 191 : base(base_arg), size(size_arg) {} |
192 | 192 |
193 Address base; | 193 Address base; |
194 int size; | 194 int size; |
195 }; | 195 }; |
196 | 196 |
197 | 197 |
198 TEST(CodeRange) { | 198 TEST(CodeRange) { |
199 const int code_range_size = 32*MB; | 199 const size_t code_range_size = 32*MB; |
200 CcTest::InitializeVM(); | 200 CcTest::InitializeVM(); |
201 CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); | 201 CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); |
202 code_range.SetUp(code_range_size); | 202 code_range.SetUp(code_range_size); |
203 int current_allocated = 0; | 203 size_t current_allocated = 0; |
204 int 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 // kMaxHeapObjectSize. |
214 size_t requested = | 214 size_t requested = |
(...skipping 15 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |