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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 Address base; | 192 Address base; |
193 int size; | 193 int size; |
194 }; | 194 }; |
195 | 195 |
196 | 196 |
197 TEST(CodeRange) { | 197 TEST(CodeRange) { |
198 const size_t code_range_size = 32*MB; | 198 const size_t code_range_size = 32*MB; |
199 CcTest::InitializeVM(); | 199 CcTest::InitializeVM(); |
200 CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); | 200 CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate())); |
201 code_range.SetUp(code_range_size); | 201 code_range.SetUp(code_range_size + |
| 202 kReservedCodeRangePages * v8::base::OS::CommitPageSize()); |
202 size_t current_allocated = 0; | 203 size_t current_allocated = 0; |
203 size_t total_allocated = 0; | 204 size_t total_allocated = 0; |
204 List< ::Block> blocks(1000); | 205 List< ::Block> blocks(1000); |
205 | 206 |
206 while (total_allocated < 5 * code_range_size) { | 207 while (total_allocated < 5 * code_range_size) { |
207 if (current_allocated < code_range_size / 10) { | 208 if (current_allocated < code_range_size / 10) { |
208 // Allocate a block. | 209 // Allocate a block. |
209 // Geometrically distributed sizes, greater than | 210 // Geometrically distributed sizes, greater than |
210 // Page::kMaxRegularHeapObjectSize (which is greater than code page area). | 211 // Page::kMaxRegularHeapObjectSize (which is greater than code page area). |
211 // 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 |
(...skipping 17 matching lines...) Expand all Loading... |
229 if (index < blocks.length() - 1) { | 230 if (index < blocks.length() - 1) { |
230 blocks[index] = blocks.RemoveLast(); | 231 blocks[index] = blocks.RemoveLast(); |
231 } else { | 232 } else { |
232 blocks.RemoveLast(); | 233 blocks.RemoveLast(); |
233 } | 234 } |
234 } | 235 } |
235 } | 236 } |
236 | 237 |
237 code_range.TearDown(); | 238 code_range.TearDown(); |
238 } | 239 } |
OLD | NEW |