Commit 04800cba authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

Revert "[Compiler] Use CompilationCache for StreamedScript compilation."

This reverts commit eac4b59f.

Reason for revert:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/21829

See:
https://github.com/v8/v8/wiki/Blink-layout-tests

Original change's description:
> [Compiler] Use CompilationCache for StreamedScript compilation.
> 
> Previously GetSharedFunctionInfoForStreamedScript didn't either check the
> compilation cache or put the result of compilation into the compilation
> cache. This would mean future compiles would need to re-parse / compile
> the same script even if the isolate had already seen it. This CL
> fixes this.
> 
> BUG=v8:5203
> 
> Change-Id: I421627b80848feb9884e2440c4ee66556e05b3c9
> Reviewed-on: https://chromium-review.googlesource.com/924285
> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
> Reviewed-by: Mythri Alle <mythria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#51469}

TBR=rmcilroy@chromium.org,mythria@chromium.org

Change-Id: Id822b55bd162b74f098160a11e6a3bda6924c1e4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:5203
Reviewed-on: https://chromium-review.googlesource.com/931821Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51477}
parent 91d87dd7
......@@ -1755,62 +1755,42 @@ Compiler::GetSharedFunctionInfoForStreamedScript(
ParseInfo* parse_info = streaming_data->info.get();
parse_info->UpdateBackgroundParseStatisticsOnMainThread(isolate);
// Check if compile cache already holds the SFI, if so no need to finalize
// the code compiled on the background thread.
CompilationCache* compilation_cache = isolate->compilation_cache();
MaybeHandle<SharedFunctionInfo> maybe_result =
compilation_cache->LookupScript(
source, script_details.name_obj, script_details.line_offset,
script_details.column_offset, origin_options,
isolate->native_context(), parse_info->language_mode());
if (!maybe_result.is_null()) {
compile_timer.set_hit_isolate_cache();
Handle<Script> script = NewScript(isolate, source, script_details,
origin_options, NOT_NATIVES_CODE);
parse_info->set_script(script);
streaming_data->parser->UpdateStatistics(isolate, script);
streaming_data->parser->HandleSourceURLComments(isolate, script);
if (parse_info->literal() == nullptr) {
// Parsing has failed - report error messages.
parse_info->pending_error_handler()->ReportErrors(
isolate, script, parse_info->ast_value_factory());
streaming_data->Release();
return MaybeHandle<SharedFunctionInfo>();
}
if (maybe_result.is_null()) {
// No cache entry found, finalize compilation of the script and add it to
// the isolate cache.
Handle<Script> script = NewScript(isolate, source, script_details,
origin_options, NOT_NATIVES_CODE);
parse_info->set_script(script);
streaming_data->parser->UpdateStatistics(isolate, script);
streaming_data->parser->HandleSourceURLComments(isolate, script);
if (parse_info->literal() == nullptr) {
// Parsing has failed - report error messages.
parse_info->pending_error_handler()->ReportErrors(
isolate, script, parse_info->ast_value_factory());
streaming_data->Release();
return MaybeHandle<SharedFunctionInfo>();
}
// Parsing has succeeded - finalize compilation.
if (i::FLAG_background_compile) {
// Finalize background compilation.
if (streaming_data->outer_function_job) {
maybe_result = FinalizeTopLevel(
parse_info, isolate, streaming_data->outer_function_job.get(),
&streaming_data->inner_function_jobs);
} else {
// Compilation failed on background thread - throw an exception.
if (!isolate->has_pending_exception()) isolate->StackOverflow();
}
// Parsing has succeeded - finalize compilation.
MaybeHandle<SharedFunctionInfo> result;
if (i::FLAG_background_compile) {
// Finalize background compilation.
if (streaming_data->outer_function_job) {
result = FinalizeTopLevel(parse_info, isolate,
streaming_data->outer_function_job.get(),
&streaming_data->inner_function_jobs);
} else {
// Compilation on main thread.
maybe_result = CompileToplevel(parse_info, isolate);
}
// Add compiled code to the isolate cache.
Handle<SharedFunctionInfo> result;
if (!maybe_result.ToHandle(&result)) {
isolate->debug()->OnAfterCompile(script);
compilation_cache->PutScript(source, isolate->native_context(),
parse_info->language_mode(), result);
// Compilation failed on background thread - throw an exception.
if (!isolate->has_pending_exception()) isolate->StackOverflow();
}
} else {
// Compilation on main thread.
result = CompileToplevel(parse_info, isolate);
}
if (!result.is_null()) {
isolate->debug()->OnAfterCompile(script);
}
streaming_data->Release();
return maybe_result;
return result;
}
Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment