Commit f9c46ed1 authored by mvstanton's avatar mvstanton Committed by Commit bot

TurboFan: commit dependencies only on update of the opt. code list.

TurboFan compilation was committing dependencies long before the
optimized function made it's way into the optimized code list for
the native context. The problem is that once the code pointer is out
there in dependency arrays, it is eligible for deopt. But the deopt
logic needs the code to be in the optimized code list to fully do it's
job.

BUG=
R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28312}
parent 570fca61
......@@ -384,7 +384,6 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
compiler::Pipeline pipeline(info());
pipeline.GenerateCode();
if (!info()->code().is_null()) {
info()->dependencies()->Commit(info()->code());
return SetLastStatus(SUCCEEDED);
}
}
......@@ -488,6 +487,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() {
DCHECK(last_status() == SUCCEEDED);
// TODO(turbofan): Currently everything is done in the first phase.
if (!info()->code().is_null()) {
info()->dependencies()->Commit(info()->code());
if (FLAG_turbo_deoptimization) {
info()->parse_info()->context()->native_context()->AddOptimizedCode(
*info()->code());
......
......@@ -379,8 +379,8 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
Object* next = code->next_code_link();
if (code->marked_for_deoptimization() &&
(!code->is_turbofanned() || FLAG_turbo_deoptimization)) {
if (code->marked_for_deoptimization()) {
DCHECK(!code->is_turbofanned() || FLAG_turbo_deoptimization);
// Put the code into the list for later patching.
codes.Add(code, &zone);
......
......@@ -12482,7 +12482,8 @@ bool DependentCode::MarkCodeForDeoptimization(
WeakCell* cell = WeakCell::cast(obj);
if (cell->cleared()) continue;
Code* code = Code::cast(cell->value());
if (!code->marked_for_deoptimization()) {
if (!code->marked_for_deoptimization() &&
(!code->is_turbofanned() || FLAG_turbo_deoptimization)) {
SetMarkedForDeoptimization(code, group);
if (invalidate_embedded_objects) {
code->InvalidateEmbeddedObjects();
......
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