Reland of Immediately cache compiled scripts. (patchset #1 id:1 of https://codereview.chromium.org/1882833006/ )
Reason for revert: Fixed webkit_unit_tests Original issue's description: > Revert of Immediately cache compiled scripts. (patchset #2 id:20001 of https://codereview.chromium.org/1890083002/ ) > > Reason for revert: > [Sheriff] Breaks: > https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20-%20debug/builds/8769 > > Auto-bisect points to this CL. > > Original issue's description: > > Immediately cache compiled scripts. > > > > Usually, script compilation is expensive enough to warrant the extra > > overhead of caching scripts immediatly. > > > > BUG=chromium:588900 > > R=yangguo@chromium.org > > LOG=n > > > > Committed: https://crrev.com/3533c084d470912384988768c4b3b109304da357 > > Cr-Commit-Position: refs/heads/master@{#35527} > > TBR=yangguo@chromium.org,jochen@chromium.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=chromium:588900 > > Committed: https://crrev.com/f8a5a4da70d0a8e6dbb1b5c633c2b6b47fe5c3f6 > Cr-Commit-Position: refs/heads/master@{#35536} TBR=yangguo@chromium.org,machenbach@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=chromium:588900 LOG=n Review URL: https://codereview.chromium.org/1901573002 Cr-Commit-Position: refs/heads/master@{#35566}
This commit is contained in:
parent
b9e287c6d9
commit
a142dedaff
@ -17646,23 +17646,11 @@ Handle<CompilationCacheTable> CompilationCacheTable::Put(
|
||||
Isolate* isolate = cache->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
||||
StringSharedKey key(src, shared, language_mode, RelocInfo::kNoPosition);
|
||||
{
|
||||
Handle<Object> k = key.AsHandle(isolate);
|
||||
DisallowHeapAllocation no_allocation_scope;
|
||||
int entry = cache->FindEntry(&key);
|
||||
if (entry != kNotFound) {
|
||||
cache->set(EntryToIndex(entry), *k);
|
||||
cache->set(EntryToIndex(entry) + 1, *value);
|
||||
return cache;
|
||||
}
|
||||
}
|
||||
|
||||
cache = EnsureCapacity(cache, 1, &key);
|
||||
int entry = cache->FindInsertionEntry(key.Hash());
|
||||
Handle<Object> k =
|
||||
isolate->factory()->NewNumber(static_cast<double>(key.Hash()));
|
||||
cache->set(EntryToIndex(entry), *k);
|
||||
cache->set(EntryToIndex(entry) + 1, Smi::FromInt(kHashGenerations));
|
||||
cache->set(EntryToIndex(entry) + 1, *value);
|
||||
cache->ElementAdded();
|
||||
return cache;
|
||||
}
|
||||
|
@ -1587,25 +1587,11 @@ TEST(CompilationCacheCachingBehavior) {
|
||||
CompileRun(raw_source);
|
||||
}
|
||||
|
||||
// On first compilation, only a hash is inserted in the code cache. We can't
|
||||
// find that value.
|
||||
// The script should be in the cache now.
|
||||
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);
|
||||
CHECK(!info.is_null());
|
||||
|
||||
// Check that the code cache entry survives at least on GC.
|
||||
@ -1637,36 +1623,6 @@ TEST(CompilationCacheCachingBehavior) {
|
||||
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,
|
||||
language_mode);
|
||||
CHECK(info.is_null());
|
||||
}
|
||||
|
||||
|
||||
|
@ -24074,8 +24074,7 @@ void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) {
|
||||
script->Run(context).ToLocalChecked()->Int32Value(context).FromJust());
|
||||
}
|
||||
|
||||
|
||||
TEST(InvalidCacheData) {
|
||||
TEST(InvalidParserCacheData) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
LocalContext context;
|
||||
@ -24083,6 +24082,12 @@ TEST(InvalidCacheData) {
|
||||
// Cached parser data is not consumed while parsing eagerly.
|
||||
TestInvalidCacheData(v8::ScriptCompiler::kConsumeParserCache);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(InvalidCodeCacheData) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
LocalContext context;
|
||||
TestInvalidCacheData(v8::ScriptCompiler::kConsumeCodeCache);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
// Limit the number of stress runs to reduce polymorphism it defeats some of the
|
||||
// assumptions made about how elements transitions work because transition stubs
|
||||
// end up going generic.
|
||||
// Flags: --stress-runs=2
|
||||
// Flags: --stress-runs=1
|
||||
|
||||
var elements_kind = {
|
||||
fast_smi_only : 'fast smi only elements',
|
||||
|
Loading…
Reference in New Issue
Block a user