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, ...@@ -399,8 +399,7 @@ bool UseCompilerDispatcher(Compiler::ConcurrencyMode inner_function_mode,
DeclarationScope* scope, DeclarationScope* scope,
Handle<SharedFunctionInfo> shared_info, Handle<SharedFunctionInfo> shared_info,
bool is_debug, bool will_serialize) { bool is_debug, bool will_serialize) {
return FLAG_compiler_dispatcher_eager_inner && return inner_function_mode == Compiler::CONCURRENT &&
inner_function_mode == Compiler::CONCURRENT &&
dispatcher->IsEnabled() && !is_debug && !will_serialize && dispatcher->IsEnabled() && !is_debug && !will_serialize &&
!UseAsmWasm(scope, shared_info, is_debug); !UseAsmWasm(scope, shared_info, is_debug);
} }
...@@ -1092,9 +1091,12 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { ...@@ -1092,9 +1091,12 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
script->GetPreparsedScopeData()); script->GetPreparsedScopeData());
} }
} }
Compiler::ConcurrencyMode inner_function_mode =
FLAG_compiler_dispatcher_eager_inner ? Compiler::CONCURRENT
: Compiler::NOT_CONCURRENT;
Handle<Code> result; Handle<Code> result;
ASSIGN_RETURN_ON_EXCEPTION( 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()) { if (FLAG_always_opt && !info.shared_info()->HasAsmWasmData()) {
Handle<Code> opt_code; Handle<Code> opt_code;
...@@ -1115,6 +1117,9 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { ...@@ -1115,6 +1117,9 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
PostponeInterruptsScope postpone(isolate); PostponeInterruptsScope postpone(isolate);
DCHECK(!isolate->native_context().is_null()); DCHECK(!isolate->native_context().is_null());
ParseInfo* parse_info = info->parse_info(); ParseInfo* parse_info = info->parse_info();
Compiler::ConcurrencyMode inner_function_mode =
FLAG_compiler_dispatcher_eager_inner ? Compiler::CONCURRENT
: Compiler::NOT_CONCURRENT;
RuntimeCallTimerScope runtimeTimer( RuntimeCallTimerScope runtimeTimer(
isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval
...@@ -1126,11 +1131,12 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { ...@@ -1126,11 +1131,12 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
{ VMState<COMPILER> state(info->isolate()); { VMState<COMPILER> state(info->isolate());
if (parse_info->literal() == nullptr) { 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(); return Handle<SharedFunctionInfo>::null();
} }
{ if (inner_function_mode == Compiler::CONCURRENT) {
ParseHandleScope parse_handles(parse_info, info->isolate()); ParseHandleScope parse_handles(parse_info, info->isolate());
parse_info->ReopenHandlesInNewHandleScope(); parse_info->ReopenHandlesInNewHandleScope();
parse_info->ast_value_factory()->Internalize(info->isolate()); parse_info->ast_value_factory()->Internalize(info->isolate());
...@@ -1158,7 +1164,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { ...@@ -1158,7 +1164,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
parse_info->set_function_literal_id(result->function_literal_id()); parse_info->set_function_literal_id(result->function_literal_id());
// Compile the code. // Compile the code.
if (!CompileUnoptimizedCode(info, Compiler::CONCURRENT)) { if (!CompileUnoptimizedCode(info, inner_function_mode)) {
return Handle<SharedFunctionInfo>::null(); 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