Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: test/cctest/test-weakmaps.cc

Issue 1082973003: Force full GC whenever CollectAllGarbage is meant to trigger a full GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-unboxed-doubles.cc ('k') | test/cctest/test-weaksets.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(weakmap, key, object); 196 Runtime::WeakCollectionSet(weakmap, 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 map keys on an evacuation candidate which are reachable by 206 // Test that weak map 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(Regress2060b) { 208 TEST(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
234 } 234 }
235 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); 235 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(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(weakmap, keys[i], smi); 238 Runtime::WeakCollectionSet(weakmap, 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 }
248 248
249 249
250 TEST(Regress399527) { 250 TEST(Regress399527) {
251 CcTest::InitializeVM(); 251 CcTest::InitializeVM();
252 v8::HandleScope scope(CcTest::isolate()); 252 v8::HandleScope scope(CcTest::isolate());
253 Isolate* isolate = CcTest::i_isolate(); 253 Isolate* isolate = CcTest::i_isolate();
254 Heap* heap = isolate->heap(); 254 Heap* heap = isolate->heap();
255 { 255 {
256 HandleScope scope(isolate); 256 HandleScope scope(isolate);
257 AllocateJSWeakMap(isolate); 257 AllocateJSWeakMap(isolate);
258 SimulateIncrementalMarking(heap); 258 SimulateIncrementalMarking(heap);
259 } 259 }
260 // The weak map is marked black here but leaving the handle scope will make 260 // The weak map is marked black here but leaving the handle scope will make
261 // the object unreachable. Aborting incremental marking will clear all the 261 // the object unreachable. Aborting incremental marking will clear all the
262 // marking bits which makes the weak map garbage. 262 // marking bits which makes the weak map garbage.
263 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 263 heap->CollectAllGarbage();
264 } 264 }
OLDNEW
« no previous file with comments | « test/cctest/test-unboxed-doubles.cc ('k') | test/cctest/test-weaksets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698