Commit 3ad973a1 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Fix broken JSFunction::is_compiled predicate.

The aforementioned predicate reported a JSFunction that was marked for
optimization as already compiled. This in turn also prevented us from
being aggressive about FLAG_always_opt treatment.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1019293003

Cr-Commit-Position: refs/heads/master@{#27481}
parent a757b9cf
......@@ -1346,10 +1346,8 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
}
static bool ShouldOptimizeNewClosure(Isolate* isolate,
Handle<SharedFunctionInfo> info) {
return !info->is_toplevel() && info->is_compiled() &&
info->allows_lazy_compilation();
static bool ShouldOptimizeNewClosure(Handle<SharedFunctionInfo> info) {
return !info->is_toplevel() && info->allows_lazy_compilation();
}
......@@ -1384,7 +1382,7 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
return result;
}
if (FLAG_always_opt && ShouldOptimizeNewClosure(isolate(), info)) {
if (FLAG_always_opt && ShouldOptimizeNewClosure(info)) {
result->MarkForOptimization();
}
return result;
......
......@@ -5843,7 +5843,10 @@ void SharedFunctionInfo::set_scope_info(ScopeInfo* value,
bool SharedFunctionInfo::is_compiled() {
return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
Builtins* builtins = GetIsolate()->builtins();
DCHECK(code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent));
DCHECK(code() != builtins->builtin(Builtins::kCompileOptimized));
return code() != builtins->builtin(Builtins::kCompileLazy);
}
......@@ -6126,7 +6129,10 @@ bool JSFunction::should_have_prototype() {
bool JSFunction::is_compiled() {
return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
Builtins* builtins = GetIsolate()->builtins();
return code() != builtins->builtin(Builtins::kCompileLazy) &&
code() != builtins->builtin(Builtins::kCompileOptimized) &&
code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent);
}
......
......@@ -9690,7 +9690,6 @@ void JSFunction::AttemptConcurrentOptimization() {
return;
}
DCHECK(!IsInOptimizationQueue());
DCHECK(is_compiled() || isolate->debug()->has_break_points());
DCHECK(!IsOptimized());
DCHECK(shared()->allows_lazy_compilation() || code()->optimizable());
DCHECK(isolate->concurrent_recompilation_enabled());
......
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