OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 for (int i = 0; i < 32; i++) { | 192 for (int i = 0; i < 32; i++) { |
193 Handle<JSObject> object = factory->NewJSObject(function, TENURED); | 193 Handle<JSObject> object = factory->NewJSObject(function, TENURED); |
194 CHECK(!heap->InNewSpace(object->address())); | 194 CHECK(!heap->InNewSpace(object->address())); |
195 CHECK(!first_page->Contains(object->address())); | 195 CHECK(!first_page->Contains(object->address())); |
196 Runtime::WeakCollectionSet(weakset, key, object); | 196 Runtime::WeakCollectionSet(weakset, key, object); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 // Force compacting garbage collection. | 200 // Force compacting garbage collection. |
201 CHECK(FLAG_always_compact); | 201 CHECK(FLAG_always_compact); |
202 heap->CollectAllGarbage(Heap::kNoGCFlags); | 202 heap->CollectAllGarbage(); |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 // Test that weak set keys on an evacuation candidate which are reachable by | 206 // Test that weak set keys on an evacuation candidate which are reachable by |
207 // other strong paths are correctly recorded in the slots buffer. | 207 // other strong paths are correctly recorded in the slots buffer. |
208 TEST(WeakSet_Regress2060b) { | 208 TEST(WeakSet_Regress2060b) { |
209 if (i::FLAG_never_compact) return; | 209 if (i::FLAG_never_compact) return; |
210 FLAG_always_compact = true; | 210 FLAG_always_compact = true; |
211 #ifdef VERIFY_HEAP | 211 #ifdef VERIFY_HEAP |
212 FLAG_verify_heap = true; | 212 FLAG_verify_heap = true; |
(...skipping 21 matching lines...) Expand all Loading... |
234 } | 234 } |
235 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); | 235 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); |
236 for (int i = 0; i < 32; i++) { | 236 for (int i = 0; i < 32; i++) { |
237 Handle<Smi> smi(Smi::FromInt(i), isolate); | 237 Handle<Smi> smi(Smi::FromInt(i), isolate); |
238 Runtime::WeakCollectionSet(weakset, keys[i], smi); | 238 Runtime::WeakCollectionSet(weakset, keys[i], smi); |
239 } | 239 } |
240 | 240 |
241 // Force compacting garbage collection. The subsequent collections are used | 241 // Force compacting garbage collection. The subsequent collections are used |
242 // to verify that key references were actually updated. | 242 // to verify that key references were actually updated. |
243 CHECK(FLAG_always_compact); | 243 CHECK(FLAG_always_compact); |
244 heap->CollectAllGarbage(Heap::kNoGCFlags); | 244 heap->CollectAllGarbage(); |
245 heap->CollectAllGarbage(Heap::kNoGCFlags); | 245 heap->CollectAllGarbage(); |
246 heap->CollectAllGarbage(Heap::kNoGCFlags); | 246 heap->CollectAllGarbage(); |
247 } | 247 } |
OLD | NEW |