Commit 8f5d1c1d authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[parser] Lazy compilation no longer needs context chain.

Now that the scope chain is deserialized directly from the chain of
{ScopeInfo} objects, it is no longer needed to provide a context. This
makes the {AllowsLazyCompilationWithoutContext} predicate coincide with
the more general {AllowsLazyCompilation}. Remove the former.

R=jochen@chromium.org

Review-Url: https://codereview.chromium.org/2399853002
Cr-Commit-Position: refs/heads/master@{#40042}
parent 978fe70b
...@@ -294,11 +294,6 @@ bool FunctionLiteral::AllowsLazyCompilation() { ...@@ -294,11 +294,6 @@ bool FunctionLiteral::AllowsLazyCompilation() {
} }
bool FunctionLiteral::AllowsLazyCompilationWithoutContext() {
return scope()->AllowsLazyCompilationWithoutContext();
}
int FunctionLiteral::start_position() const { int FunctionLiteral::start_position() const {
return scope()->start_position(); return scope()->start_position();
} }
......
...@@ -2599,7 +2599,6 @@ class FunctionLiteral final : public Expression { ...@@ -2599,7 +2599,6 @@ class FunctionLiteral final : public Expression {
int parameter_count() { return parameter_count_; } int parameter_count() { return parameter_count_; }
bool AllowsLazyCompilation(); bool AllowsLazyCompilation();
bool AllowsLazyCompilationWithoutContext();
Handle<String> debug_name() const { Handle<String> debug_name() const {
if (raw_name_ != NULL && !raw_name_->IsEmpty()) { if (raw_name_ != NULL && !raw_name_->IsEmpty()) {
......
...@@ -1110,17 +1110,6 @@ bool DeclarationScope::AllowsLazyCompilation() const { ...@@ -1110,17 +1110,6 @@ bool DeclarationScope::AllowsLazyCompilation() const {
return !force_eager_compilation_; return !force_eager_compilation_;
} }
bool DeclarationScope::AllowsLazyCompilationWithoutContext() const {
if (force_eager_compilation_) return false;
// Disallow lazy compilation without context if any outer scope needs a
// context.
for (const Scope* scope = outer_scope_; scope != nullptr;
scope = scope->outer_scope_) {
if (scope->NeedsContext()) return false;
}
return true;
}
int Scope::ContextChainLength(Scope* scope) const { int Scope::ContextChainLength(Scope* scope) const {
int n = 0; int n = 0;
for (const Scope* s = this; s != scope; s = s->outer_scope_) { for (const Scope* s = this; s != scope; s = s->outer_scope_) {
......
...@@ -791,9 +791,6 @@ class DeclarationScope : public Scope { ...@@ -791,9 +791,6 @@ class DeclarationScope : public Scope {
// Determine if we can use lazy compilation for this scope. // Determine if we can use lazy compilation for this scope.
bool AllowsLazyCompilation() const; bool AllowsLazyCompilation() const;
// Determine if we can use lazy compilation for this scope without a context.
bool AllowsLazyCompilationWithoutContext() const;
// Make sure this closure and all outer closures are eagerly compiled. // Make sure this closure and all outer closures are eagerly compiled.
void ForceEagerCompilation() { void ForceEagerCompilation() {
DCHECK_EQ(this, GetClosureScope()); DCHECK_EQ(this, GetClosureScope());
......
...@@ -13752,7 +13752,7 @@ void SharedFunctionInfo::InitFromFunctionLiteral( ...@@ -13752,7 +13752,7 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
shared_info->set_inferred_name(*lit->inferred_name()); shared_info->set_inferred_name(*lit->inferred_name());
shared_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); shared_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
shared_info->set_allows_lazy_compilation_without_context( shared_info->set_allows_lazy_compilation_without_context(
lit->AllowsLazyCompilationWithoutContext()); lit->AllowsLazyCompilation());
shared_info->set_language_mode(lit->language_mode()); shared_info->set_language_mode(lit->language_mode());
shared_info->set_uses_arguments(lit->scope()->arguments() != NULL); shared_info->set_uses_arguments(lit->scope()->arguments() != NULL);
shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
......
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