Commit e3c484dc authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Compiler] Don't use DeferredHandleScope for parser if not compiling concurrently.

Don't put internalized parser handles in a DeferredHandleScope if we aren't
going to compile concurrently since this has a performance cost.

BUG=chromium:686658

Change-Id: Id89d197b863569346895583e6df79134e79a5d4b
Reviewed-on: https://chromium-review.googlesource.com/461879Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44196}
parent db377d02
......@@ -399,8 +399,7 @@ bool UseCompilerDispatcher(Compiler::ConcurrencyMode inner_function_mode,
DeclarationScope* scope,
Handle<SharedFunctionInfo> shared_info,
bool is_debug, bool will_serialize) {
return FLAG_compiler_dispatcher_eager_inner &&
inner_function_mode == Compiler::CONCURRENT &&
return inner_function_mode == Compiler::CONCURRENT &&
dispatcher->IsEnabled() && !is_debug && !will_serialize &&
!UseAsmWasm(scope, shared_info, is_debug);
}
......@@ -1092,9 +1091,12 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
script->GetPreparsedScopeData());
}
}
Compiler::ConcurrencyMode inner_function_mode =
FLAG_compiler_dispatcher_eager_inner ? Compiler::CONCURRENT
: Compiler::NOT_CONCURRENT;
Handle<Code> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result, GetUnoptimizedCode(&info, Compiler::CONCURRENT), Code);
isolate, result, GetUnoptimizedCode(&info, inner_function_mode), Code);
if (FLAG_always_opt && !info.shared_info()->HasAsmWasmData()) {
Handle<Code> opt_code;
......@@ -1115,6 +1117,9 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
PostponeInterruptsScope postpone(isolate);
DCHECK(!isolate->native_context().is_null());
ParseInfo* parse_info = info->parse_info();
Compiler::ConcurrencyMode inner_function_mode =
FLAG_compiler_dispatcher_eager_inner ? Compiler::CONCURRENT
: Compiler::NOT_CONCURRENT;
RuntimeCallTimerScope runtimeTimer(
isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval
......@@ -1126,11 +1131,12 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
{ VMState<COMPILER> state(info->isolate());
if (parse_info->literal() == nullptr) {
if (!parsing::ParseProgram(parse_info, info->isolate(), false)) {
if (!parsing::ParseProgram(parse_info, info->isolate(),
inner_function_mode != Compiler::CONCURRENT)) {
return Handle<SharedFunctionInfo>::null();
}
{
if (inner_function_mode == Compiler::CONCURRENT) {
ParseHandleScope parse_handles(parse_info, info->isolate());
parse_info->ReopenHandlesInNewHandleScope();
parse_info->ast_value_factory()->Internalize(info->isolate());
......@@ -1158,7 +1164,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
parse_info->set_function_literal_id(result->function_literal_id());
// Compile the code.
if (!CompileUnoptimizedCode(info, Compiler::CONCURRENT)) {
if (!CompileUnoptimizedCode(info, inner_function_mode)) {
return Handle<SharedFunctionInfo>::null();
}
......
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