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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 5745005: Provide baseline GC version. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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
OLDNEW
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 CHECK(Top::context()->global()-> 221 CHECK(Top::context()->global()->
222 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); 222 GetProperty(obj_name)->ToObjectChecked()->IsJSObject());
223 obj = JSObject::cast( 223 obj = JSObject::cast(
224 Top::context()->global()->GetProperty(obj_name)->ToObjectChecked()); 224 Top::context()->global()->GetProperty(obj_name)->ToObjectChecked());
225 prop_name = 225 prop_name =
226 String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked()); 226 String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked());
227 CHECK(obj->GetProperty(prop_name)->ToObjectChecked() == Smi::FromInt(23)); 227 CHECK(obj->GetProperty(prop_name)->ToObjectChecked() == Smi::FromInt(23));
228 } 228 }
229 229
230 230
231 #ifndef BASELINE_GC
231 static Handle<Map> CreateMap() { 232 static Handle<Map> CreateMap() {
232 return Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 233 return Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
233 } 234 }
234 235
235 236
236 TEST(MapCompact) { 237 TEST(MapCompact) {
237 FLAG_max_map_space_pages = 16; 238 FLAG_max_map_space_pages = 16;
238 InitializeVM(); 239 InitializeVM();
239 240
240 { 241 {
241 v8::HandleScope sc; 242 v8::HandleScope sc;
242 // keep allocating maps while pointers are still encodable and thus 243 // keep allocating maps while pointers are still encodable and thus
243 // mark compact is permitted. 244 // mark compact is permitted.
244 Handle<JSObject> root = Factory::NewJSObjectFromMap(CreateMap()); 245 Handle<JSObject> root = Factory::NewJSObjectFromMap(CreateMap());
245 do { 246 do {
246 Handle<Map> map = CreateMap(); 247 Handle<Map> map = CreateMap();
247 map->set_prototype(*root); 248 map->set_prototype(*root);
248 root = Factory::NewJSObjectFromMap(map); 249 root = Factory::NewJSObjectFromMap(map);
249 } while (Heap::map_space()->MapPointersEncodable()); 250 } while (Heap::map_space()->MapPointersEncodable());
250 } 251 }
251 // Now, as we don't have any handles to just allocated maps, we should 252 // Now, as we don't have any handles to just allocated maps, we should
252 // be able to trigger map compaction. 253 // be able to trigger map compaction.
253 // To give an additional chance to fail, try to force compaction which 254 // To give an additional chance to fail, try to force compaction which
254 // should be impossible right now. 255 // should be impossible right now.
255 Heap::CollectAllGarbage(true); 256 Heap::CollectAllGarbage(true);
256 // And now map pointers should be encodable again. 257 // And now map pointers should be encodable again.
257 CHECK(Heap::map_space()->MapPointersEncodable()); 258 CHECK(Heap::map_space()->MapPointersEncodable());
258 } 259 }
259 260 #endif
260 261
261 static int gc_starts = 0; 262 static int gc_starts = 0;
262 static int gc_ends = 0; 263 static int gc_ends = 0;
263 264
264 static void GCPrologueCallbackFunc() { 265 static void GCPrologueCallbackFunc() {
265 CHECK(gc_starts == gc_ends); 266 CHECK(gc_starts == gc_ends);
266 gc_starts++; 267 gc_starts++;
267 } 268 }
268 269
269 270
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; 355 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
355 GlobalHandles::AddGroup(g1_objects, 2); 356 GlobalHandles::AddGroup(g1_objects, 2);
356 GlobalHandles::AddGroup(g2_objects, 2); 357 GlobalHandles::AddGroup(g2_objects, 2);
357 } 358 }
358 359
359 Heap::CollectGarbage(OLD_POINTER_SPACE); 360 Heap::CollectGarbage(OLD_POINTER_SPACE);
360 361
361 // All objects should be gone. 5 global handles in total. 362 // All objects should be gone. 5 global handles in total.
362 CHECK_EQ(5, NumberOfWeakCalls); 363 CHECK_EQ(5, NumberOfWeakCalls);
363 } 364 }
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/spaces-inl.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698