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

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

Issue 1882833006: Revert of Immediately cache compiled scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/objects.cc ('k') | test/cctest/test-api.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 0cedb188579256e4ea259d719967aa73200b517d..10ff89c278e198baee5c9e35bc8e8298bb8066d6 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -1587,8 +1587,22 @@
CompileRun(raw_source);
}
- // The script should be in the cache now.
+ // On first compilation, only a hash is inserted in the code cache. We can't
+ // find that value.
MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript(
+ source, Handle<Object>(), 0, 0,
+ v8::ScriptOriginOptions(false, true, false), native_context,
+ language_mode);
+ CHECK(info.is_null());
+
+ {
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun(raw_source);
+ }
+
+ // 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);
@@ -1618,6 +1632,36 @@
heap->CollectAllGarbage();
// Ensure code aging cleared the entry from the cache.
+ info = compilation_cache->LookupScript(
+ source, Handle<Object>(), 0, 0,
+ v8::ScriptOriginOptions(false, true, false), native_context,
+ language_mode);
+ CHECK(info.is_null());
+
+ {
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun(raw_source);
+ }
+
+ // On first compilation, only a hash is inserted in the code cache. We can't
+ // find that value.
+ info = compilation_cache->LookupScript(
+ source, Handle<Object>(), 0, 0,
+ v8::ScriptOriginOptions(false, true, false), native_context,
+ language_mode);
+ CHECK(info.is_null());
+
+ for (int i = 0; i < CompilationCacheTable::kHashGenerations; i++) {
+ compilation_cache->MarkCompactPrologue();
+ }
+
+ {
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun(raw_source);
+ }
+
+ // If we aged the cache before caching the script, ensure that we didn't cache
+ // on next compilation.
info = compilation_cache->LookupScript(
source, Handle<Object>(), 0, 0,
v8::ScriptOriginOptions(false, true, false), native_context,
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698