| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 CHECK(obj->GetProperty(prop_name)->ToObjectChecked() == Smi::FromInt(23)); | 227 CHECK(obj->GetProperty(prop_name)->ToObjectChecked() == Smi::FromInt(23)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 | 230 |
| 231 static Handle<Map> CreateMap() { | 231 static Handle<Map> CreateMap() { |
| 232 return Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 232 return Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 TEST(MapCompact) { | 236 TEST(MapCompact) { |
| 237 if (FLAG_new_gc) return; |
| 238 |
| 237 FLAG_max_map_space_pages = 16; | 239 FLAG_max_map_space_pages = 16; |
| 238 InitializeVM(); | 240 InitializeVM(); |
| 239 | 241 |
| 240 { | 242 { |
| 241 v8::HandleScope sc; | 243 v8::HandleScope sc; |
| 242 // keep allocating maps while pointers are still encodable and thus | 244 // keep allocating maps while pointers are still encodable and thus |
| 243 // mark compact is permitted. | 245 // mark compact is permitted. |
| 244 Handle<JSObject> root = Factory::NewJSObjectFromMap(CreateMap()); | 246 Handle<JSObject> root = Factory::NewJSObjectFromMap(CreateMap()); |
| 245 do { | 247 do { |
| 246 Handle<Map> map = CreateMap(); | 248 Handle<Map> map = CreateMap(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; | 356 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; |
| 355 GlobalHandles::AddGroup(g1_objects, 2); | 357 GlobalHandles::AddGroup(g1_objects, 2); |
| 356 GlobalHandles::AddGroup(g2_objects, 2); | 358 GlobalHandles::AddGroup(g2_objects, 2); |
| 357 } | 359 } |
| 358 | 360 |
| 359 Heap::CollectGarbage(OLD_POINTER_SPACE); | 361 Heap::CollectGarbage(OLD_POINTER_SPACE); |
| 360 | 362 |
| 361 // All objects should be gone. 5 global handles in total. | 363 // All objects should be gone. 5 global handles in total. |
| 362 CHECK_EQ(5, NumberOfWeakCalls); | 364 CHECK_EQ(5, NumberOfWeakCalls); |
| 363 } | 365 } |
| OLD | NEW |