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

Unified Diff: test/cctest/test-heap.cc

Issue 1026113004: Reload length of retained_maps array after GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unused var Created 5 years, 9 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
« src/objects.cc ('K') | « src/objects.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-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index f5d71c37fccb0788df53f86d134f7b60ec94d64e..afd1b666bd7fb814ba53d0efbb8a0920970d2f74 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5096,12 +5096,7 @@ TEST(Regress3877) {
}
-void CheckMapRetainingFor(int n) {
- FLAG_retain_maps_for_n_gc = n;
- Isolate* isolate = CcTest::i_isolate();
- Heap* heap = isolate->heap();
- Handle<WeakCell> weak_cell;
- {
+Handle<WeakCell> AddRetainedMap(Isolate* isolate, Heap* heap) {
HandleScope inner_scope(isolate);
Handle<Map> map = Map::Create(isolate, 1);
v8::Local<v8::Value> result =
@@ -5110,8 +5105,15 @@ void CheckMapRetainingFor(int n) {
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
map->set_prototype(*proto);
heap->AddRetainedMap(map);
- weak_cell = inner_scope.CloseAndEscape(Map::WeakCellForMap(map));
- }
+ return inner_scope.CloseAndEscape(Map::WeakCellForMap(map));
+}
+
+
+void CheckMapRetainingFor(int n) {
+ FLAG_retain_maps_for_n_gc = n;
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ Handle<WeakCell> weak_cell = AddRetainedMap(isolate, heap);
CHECK(!weak_cell->cleared());
for (int i = 0; i < n; i++) {
heap->CollectGarbage(OLD_POINTER_SPACE);
@@ -5132,6 +5134,27 @@ TEST(MapRetaining) {
}
+TEST(RegressArrayListGC) {
+ FLAG_retain_maps_for_n_gc = 1;
+ FLAG_incremental_marking = 0;
+ FLAG_gc_global = true;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ AddRetainedMap(isolate, heap);
+ Handle<Map> map = Map::Create(isolate, 1);
+ heap->CollectGarbage(OLD_POINTER_SPACE);
+ // Force GC in old space on next addition of retained map.
+ Map::WeakCellForMap(map);
+ SimulateFullSpace(CcTest::heap()->new_space());
+ for (int i = 0; i < 10; i++) {
+ heap->AddRetainedMap(map);
+ }
+ heap->CollectGarbage(OLD_POINTER_SPACE);
+}
+
+
#ifdef DEBUG
TEST(PathTracer) {
CcTest::InitializeVM();
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698