Disable generating of code cache if the debugger is loaded

BUG=440880
R=yangguo@chromium.org,dcarney@chromium.org,vogelheim@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/796823002

Cr-Commit-Position: refs/heads/master@{#25774}
This commit is contained in:
jochen 2014-12-11 04:58:36 -08:00 committed by Commit bot
parent 49baecc42b
commit aa0664e58f
2 changed files with 8 additions and 1 deletions

View File

@ -1637,6 +1637,12 @@ Local<UnboundScript> ScriptCompiler::CompileUnbound(
options = kConsumeParserCache;
}
// Don't try to produce any kind of cache when the debugger is loaded.
if (isolate->debug()->is_loaded() &&
(options == kProduceParserCache || options == kProduceCodeCache)) {
options = kNoCompileOptions;
}
i::ScriptData* script_data = NULL;
if (options == kConsumeParserCache || options == kConsumeCodeCache) {
DCHECK(source->cached_data);

View File

@ -1257,19 +1257,20 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
int column_offset, bool is_shared_cross_origin, Handle<Context> context,
v8::Extension* extension, ScriptData** cached_data,
ScriptCompiler::CompileOptions compile_options, NativesFlag natives) {
Isolate* isolate = source->GetIsolate();
if (compile_options == ScriptCompiler::kNoCompileOptions) {
cached_data = NULL;
} else if (compile_options == ScriptCompiler::kProduceParserCache ||
compile_options == ScriptCompiler::kProduceCodeCache) {
DCHECK(cached_data && !*cached_data);
DCHECK(extension == NULL);
DCHECK(!isolate->debug()->is_loaded());
} else {
DCHECK(compile_options == ScriptCompiler::kConsumeParserCache ||
compile_options == ScriptCompiler::kConsumeCodeCache);
DCHECK(cached_data && *cached_data);
DCHECK(extension == NULL);
}
Isolate* isolate = source->GetIsolate();
int source_length = source->length();
isolate->counters()->total_load_size()->Increment(source_length);
isolate->counters()->total_compile_size()->Increment(source_length);