| Index: test/cctest/heap/test-heap.cc
|
| diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
|
| index 49aa954cb994f9278376f7d665e6f654b1c4b687..726887a23a6ee785167817c42343f789eb4b5973 100644
|
| --- a/test/cctest/heap/test-heap.cc
|
| +++ b/test/cctest/heap/test-heap.cc
|
| @@ -1567,18 +1567,26 @@ TEST(CompilationCacheCachingBehavior) {
|
| language_mode);
|
| CHECK(!info.is_null());
|
|
|
| - heap->CollectAllGarbage();
|
| -
|
| - // On second compilation, the hash is replaced by a real cache entry mapping
|
| - // the source to the shared function info containing the code.
|
| - info = compilation_cache->LookupScript(
|
| - source, Handle<Object>(), 0, 0,
|
| - v8::ScriptOriginOptions(false, true, false), native_context,
|
| - language_mode);
|
| - CHECK(!info.is_null());
|
| + // Check that the code cache entry survives at least on GC.
|
| + // (Unless --optimize-for-size, in which case it might get collected
|
| + // immediately.)
|
| + if (!FLAG_optimize_for_size) {
|
| + heap->CollectAllGarbage();
|
| + info = compilation_cache->LookupScript(
|
| + source, Handle<Object>(), 0, 0,
|
| + v8::ScriptOriginOptions(false, true, false), native_context,
|
| + language_mode);
|
| + CHECK(!info.is_null());
|
| + }
|
|
|
| + // Progress code age until it's old and ready for GC.
|
| while (!info.ToHandleChecked()->code()->IsOld()) {
|
| - info.ToHandleChecked()->code()->MakeOlder(NO_MARKING_PARITY);
|
| + // To guarantee progress, we have to MakeOlder with different parities.
|
| + // We can't just use NO_MARKING_PARITY, since e.g. kExecutedOnceCodeAge is
|
| + // always NO_MARKING_PARITY and the code age only progresses if the parity
|
| + // is different.
|
| + info.ToHandleChecked()->code()->MakeOlder(ODD_MARKING_PARITY);
|
| + info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY);
|
| }
|
|
|
| heap->CollectAllGarbage();
|
|
|