Commit 828b518a authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[parsing] Fix AllowsLazyCompilation

Class member initializer functions do not support lazy compilation, so
change FunctionLiteral::AllowsLazyCompilation to return false for them.

Change-Id: I38434f3a7e8c88af3f407cf19308fc3862ec4403
Reviewed-on: https://chromium-review.googlesource.com/c/1470103Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59588}
parent 7ffdf821
......@@ -1217,7 +1217,10 @@ bool Scope::AllowsLazyParsingWithoutUnresolvedVariables(
}
bool DeclarationScope::AllowsLazyCompilation() const {
return !force_eager_compilation_;
// Functions which force eager compilation and class member initializer
// functions are not lazily compilable.
return !force_eager_compilation_ &&
!IsClassMembersInitializerFunction(function_kind());
}
int Scope::ContextChainLength(Scope* scope) const {
......
......@@ -1336,10 +1336,10 @@ bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position,
bool was_compiled = false;
for (const auto& candidate : candidates) {
// Code that cannot be compiled lazily are internal and not debuggable.
DCHECK(candidate->allows_lazy_compilation());
IsCompiledScope is_compiled_scope(candidate->is_compiled_scope());
if (!is_compiled_scope.is_compiled()) {
// Code that cannot be compiled lazily are internal and not debuggable.
DCHECK(candidate->allows_lazy_compilation());
if (!Compiler::Compile(candidate, Compiler::CLEAR_EXCEPTION,
&is_compiled_scope)) {
return false;
......
......@@ -498,10 +498,8 @@ void SharedFunctionInfo::set_bytecode_array(BytecodeArray bytecode) {
bool SharedFunctionInfo::ShouldFlushBytecode() {
if (!FLAG_flush_bytecode) return false;
// TODO(rmcilroy): Enable bytecode flushing for resumable functions amd class
// member initializers.
if (IsResumableFunction(kind()) ||
IsClassMembersInitializerFunction(kind()) || !allows_lazy_compilation()) {
// TODO(rmcilroy): Enable bytecode flushing for resumable functions.
if (IsResumableFunction(kind()) || !allows_lazy_compilation()) {
return false;
}
......
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