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