[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/1470103 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#59588}
This commit is contained in:
parent
7ffdf82173
commit
828b518a88
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user