| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 address -= kPointerSize; | 64 address -= kPointerSize; |
| 65 CHECK_EQ(address, value); | 65 CHECK_EQ(address, value); |
| 66 } | 66 } |
| 67 | 67 |
| 68 CHECK_EQ(NULL, address); | 68 CHECK_EQ(NULL, address); |
| 69 DeleteArray(mem); | 69 DeleteArray(mem); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 TEST(Promotion) { | 73 TEST(Promotion) { |
| 74 // Test the situation that some objects in new space are promoted to the | |
| 75 // old space | |
| 76 if (Snapshot::IsEnabled()) return; | |
| 77 | |
| 78 // Ensure that we get a compacting collection so that objects are promoted | 74 // Ensure that we get a compacting collection so that objects are promoted |
| 79 // from new space. | 75 // from new space. |
| 80 FLAG_gc_global = true; | 76 FLAG_gc_global = true; |
| 81 FLAG_always_compact = true; | 77 FLAG_always_compact = true; |
| 82 Heap::ConfigureHeap(2*256*KB, 4*MB); | 78 Heap::ConfigureHeap(2*256*KB, 4*MB); |
| 83 | 79 |
| 84 InitializeVM(); | 80 InitializeVM(); |
| 85 | 81 |
| 86 v8::HandleScope sc; | 82 v8::HandleScope sc; |
| 87 | 83 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 99 | 95 |
| 100 // Call the m-c collector, so array becomes an old object. | 96 // Call the m-c collector, so array becomes an old object. |
| 101 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); | 97 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); |
| 102 | 98 |
| 103 // Array now sits in the old space | 99 // Array now sits in the old space |
| 104 CHECK(Heap::InSpace(*array, OLD_POINTER_SPACE)); | 100 CHECK(Heap::InSpace(*array, OLD_POINTER_SPACE)); |
| 105 } | 101 } |
| 106 | 102 |
| 107 | 103 |
| 108 TEST(NoPromotion) { | 104 TEST(NoPromotion) { |
| 109 if (Snapshot::IsEnabled()) return; | |
| 110 Heap::ConfigureHeap(2*256*KB, 4*MB); | 105 Heap::ConfigureHeap(2*256*KB, 4*MB); |
| 111 | 106 |
| 112 // Test the situation that some objects in new space are promoted to | 107 // Test the situation that some objects in new space are promoted to |
| 113 // the old space | 108 // the old space |
| 114 InitializeVM(); | 109 InitializeVM(); |
| 115 | 110 |
| 116 v8::HandleScope sc; | 111 v8::HandleScope sc; |
| 117 | 112 |
| 118 // Do a mark compact GC to shrink the heap. | 113 // Do a mark compact GC to shrink the heap. |
| 119 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); | 114 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; | 302 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; |
| 308 GlobalHandles::AddGroup(g1_objects, 2); | 303 GlobalHandles::AddGroup(g1_objects, 2); |
| 309 GlobalHandles::AddGroup(g2_objects, 2); | 304 GlobalHandles::AddGroup(g2_objects, 2); |
| 310 } | 305 } |
| 311 | 306 |
| 312 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); | 307 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); |
| 313 | 308 |
| 314 // All objects should be gone. 5 global handles in total. | 309 // All objects should be gone. 5 global handles in total. |
| 315 CHECK_EQ(5, NumberOfWeakCalls); | 310 CHECK_EQ(5, NumberOfWeakCalls); |
| 316 } | 311 } |
| OLD | NEW |