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

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

Issue 11118018: Enable --verify-heap in release mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Force compacting garbage collection. 186 // Force compacting garbage collection.
187 CHECK(FLAG_always_compact); 187 CHECK(FLAG_always_compact);
188 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 188 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
189 } 189 }
190 190
191 191
192 // Test that weak map keys on an evacuation candidate which are reachable by 192 // Test that weak map keys on an evacuation candidate which are reachable by
193 // other strong paths are correctly recorded in the slots buffer. 193 // other strong paths are correctly recorded in the slots buffer.
194 TEST(Regress2060b) { 194 TEST(Regress2060b) {
195 FLAG_always_compact = true; 195 FLAG_always_compact = true;
196 #ifdef DEBUG 196 #ifdef VERIFY_HEAP
197 FLAG_verify_heap = true; 197 FLAG_verify_heap = true;
198 #endif 198 #endif
199
199 LocalContext context; 200 LocalContext context;
200 v8::HandleScope scope; 201 v8::HandleScope scope;
201 Handle<JSFunction> function = 202 Handle<JSFunction> function =
202 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value()); 203 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value());
203 204
204 // Start second old-space page so that keys land on evacuation candidate. 205 // Start second old-space page so that keys land on evacuation candidate.
205 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page(); 206 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page();
206 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED); 207 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED);
207 208
208 // Fill up weak map with keys on an evacuation candidate. 209 // Fill up weak map with keys on an evacuation candidate.
209 Handle<JSObject> keys[32]; 210 Handle<JSObject> keys[32];
210 for (int i = 0; i < 32; i++) { 211 for (int i = 0; i < 32; i++) {
211 keys[i] = FACTORY->NewJSObject(function, TENURED); 212 keys[i] = FACTORY->NewJSObject(function, TENURED);
212 CHECK(!HEAP->InNewSpace(keys[i]->address())); 213 CHECK(!HEAP->InNewSpace(keys[i]->address()));
213 CHECK(!first_page->Contains(keys[i]->address())); 214 CHECK(!first_page->Contains(keys[i]->address()));
214 } 215 }
215 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(); 216 Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
216 for (int i = 0; i < 32; i++) { 217 for (int i = 0; i < 32; i++) {
217 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i))); 218 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i)));
218 } 219 }
219 220
220 // Force compacting garbage collection. The subsequent collections are used 221 // Force compacting garbage collection. The subsequent collections are used
221 // to verify that key references were actually updated. 222 // to verify that key references were actually updated.
222 CHECK(FLAG_always_compact); 223 CHECK(FLAG_always_compact);
223 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 224 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
224 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 225 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
225 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 226 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
226 } 227 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698