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

Unified Diff: test/cctest/test-mark-compact.cc

Issue 548136: Merge r3643 and r3659 from bleeding_edge to trunk to... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-mark-compact.cc
===================================================================
--- test/cctest/test-mark-compact.cc (revision 3684)
+++ test/cctest/test-mark-compact.cc (working copy)
@@ -207,6 +207,36 @@
}
+static Handle<Map> CreateMap() {
+ return Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
+}
+
+
+TEST(MapCompact) {
+ FLAG_max_map_space_pages = 16;
+ InitializeVM();
+
+ {
+ v8::HandleScope sc;
+ // keep allocating maps while pointers are still encodable and thus
+ // mark compact is permitted.
+ Handle<JSObject> root = Factory::NewJSObjectFromMap(CreateMap());
+ do {
+ Handle<Map> map = CreateMap();
+ map->set_prototype(*root);
+ root = Factory::NewJSObjectFromMap(map);
+ } while (Heap::map_space()->MapPointersEncodable());
+ }
+ // Now, as we don't have any handles to just allocated maps, we should
+ // be able to trigger map compaction.
+ // To give an additional chance to fail, try to force compaction which
+ // should be impossible right now.
+ Heap::CollectAllGarbage(true);
+ // And now map pointers should be encodable again.
+ CHECK(Heap::map_space()->MapPointersEncodable());
+}
+
+
static int gc_starts = 0;
static int gc_ends = 0;
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698