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

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

Issue 1580323003: Restrict GeneratePreagedPrologue to proper functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix CompilationCacheCachingBehavior for all combinations of --age-code and --optimize-for-size. Created 4 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 | « src/compiler.h ('k') | test/cctest/test-api-accessors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/compiler.h ('k') | test/cctest/test-api-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698