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

Unified Diff: Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 988303003: Do not cache resource metadata if the source code size is small. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8ScriptRunner.cpp
diff --git a/Source/bindings/core/v8/V8ScriptRunner.cpp b/Source/bindings/core/v8/V8ScriptRunner.cpp
index 4bffe58068596dec34b9fbcd24f276be7341af11..80da2d80a79aa14e61f4f149af15b7e3b44751ff 100644
--- a/Source/bindings/core/v8/V8ScriptRunner.cpp
+++ b/Source/bindings/core/v8/V8ScriptRunner.cpp
@@ -280,7 +280,8 @@ PassOwnPtr<CompileFn> selectCompileFunction(V8CacheOptions cacheOptions, CachedM
// Caching is not available in this case.
return bind(compileWithoutOptions, V8CompileHistogram::Noncacheable);
- if (cacheOptions == V8CacheOptionsNone)
+ // Do not cache for small scripts, even if caching is available.
falken 2015/03/10 00:54:05 This comment kind of just repeats the code. It'd b
+ if (cacheOptions == V8CacheOptionsNone || code->Length() < minimalCodeLength)
return bind(compileWithoutOptions, V8CompileHistogram::Cacheable);
// The cacheOptions will guide our strategy:
@@ -288,10 +289,6 @@ PassOwnPtr<CompileFn> selectCompileFunction(V8CacheOptions cacheOptions, CachedM
switch (cacheOptions) {
case V8CacheOptionsDefault:
case V8CacheOptionsParseMemory:
- if (code->Length() < minimalCodeLength) {
- // Do not cache for small scripts, though caching is available.
- return bind(compileWithoutOptions, V8CompileHistogram::Cacheable);
- }
// Use parser-cache; in-memory only.
return bind(compileAndConsumeOrProduce, cacheHandler, cacheTag(CacheTagParser, cacheHandler), v8::ScriptCompiler::kConsumeParserCache, v8::ScriptCompiler::kProduceParserCache, false, CachedMetadataHandler::CacheLocally);
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698