From 1aed997ad6c69806d1dcee38e06593c7d3e2d4d9 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Fri, 14 Dec 2012 12:45:28 +0000 Subject: [PATCH] Make string test resilient against GC stress. R=dcarney@chromium.org TEST=cctest/test-strings/StringCharacterStreamRandom Review URL: https://codereview.chromium.org/11565031 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13220 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- test/cctest/test-strings.cc | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc index 4fb32d5b86..6f0f96df90 100644 --- a/test/cctest/test-strings.cc +++ b/test/cctest/test-strings.cc @@ -671,10 +671,10 @@ void TestStringCharacterStream(BuildString build, int test_cases) { HandleScope outer_scope(isolate); ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); ConsStringGenerationData data(true); - bool last_test_did_gc = false; for (int i = 0; i < test_cases; i++) { printf("%d\n", i); HandleScope inner_scope(isolate); + AlwaysAllocateScope always_allocate; // Build flat version of cons string. Handle flat_string = build(i, &data); ConsStringStats flat_string_stats; @@ -685,22 +685,6 @@ void TestStringCharacterStream(BuildString build, int test_cases) { Handle cons_string = build(i, &data); ConsStringStats cons_string_stats; AccumulateStats(cons_string, &cons_string_stats); - // Check if gc changed our data structure. - bool broken_by_gc = - cons_string_stats.leaves_ != data.stats_.leaves_ || - cons_string_stats.leaves_ != flat_string_stats.leaves_; - // If gc altered the data structure, do a full collection and retry test. - if (broken_by_gc) { - // Bail if test runs twice. - if (last_test_did_gc) CHECK(false); - printf("forcing gc\n"); - isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "retry test"); - // Retry test. - last_test_did_gc = true; - i--; - continue; - } - last_test_did_gc = false; AssertNoAllocation no_alloc; PrintStats(data); // Full verify of cons string.