| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 do { | 254 do { |
| 255 Handle<Map> map = CreateMap(); | 255 Handle<Map> map = CreateMap(); |
| 256 map->set_prototype(*root); | 256 map->set_prototype(*root); |
| 257 root = Factory::NewJSObjectFromMap(map); | 257 root = Factory::NewJSObjectFromMap(map); |
| 258 } while (Heap::map_space()->MapPointersEncodable()); | 258 } while (Heap::map_space()->MapPointersEncodable()); |
| 259 } | 259 } |
| 260 // Now, as we don't have any handles to just allocated maps, we should | 260 // Now, as we don't have any handles to just allocated maps, we should |
| 261 // be able to trigger map compaction. | 261 // be able to trigger map compaction. |
| 262 // To give an additional chance to fail, try to force compaction which | 262 // To give an additional chance to fail, try to force compaction which |
| 263 // should be impossible right now. | 263 // should be impossible right now. |
| 264 Heap::CollectAllGarbage(true); | 264 Heap::CollectAllGarbage(Heap::kForceCompactionMask); |
| 265 // And now map pointers should be encodable again. | 265 // And now map pointers should be encodable again. |
| 266 CHECK(Heap::map_space()->MapPointersEncodable()); | 266 CHECK(Heap::map_space()->MapPointersEncodable()); |
| 267 } | 267 } |
| 268 #endif | 268 #endif |
| 269 | 269 |
| 270 static int gc_starts = 0; | 270 static int gc_starts = 0; |
| 271 static int gc_ends = 0; | 271 static int gc_ends = 0; |
| 272 | 272 |
| 273 static void GCPrologueCallbackFunc() { | 273 static void GCPrologueCallbackFunc() { |
| 274 CHECK(gc_starts == gc_ends); | 274 CHECK(gc_starts == gc_ends); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; | 363 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; |
| 364 GlobalHandles::AddGroup(g1_objects, 2, NULL); | 364 GlobalHandles::AddGroup(g1_objects, 2, NULL); |
| 365 GlobalHandles::AddGroup(g2_objects, 2, NULL); | 365 GlobalHandles::AddGroup(g2_objects, 2, NULL); |
| 366 } | 366 } |
| 367 | 367 |
| 368 Heap::CollectGarbage(OLD_POINTER_SPACE); | 368 Heap::CollectGarbage(OLD_POINTER_SPACE); |
| 369 | 369 |
| 370 // All objects should be gone. 5 global handles in total. | 370 // All objects should be gone. 5 global handles in total. |
| 371 CHECK_EQ(5, NumberOfWeakCalls); | 371 CHECK_EQ(5, NumberOfWeakCalls); |
| 372 } | 372 } |
| OLD | NEW |