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}
This commit is contained in:
mvstanton 2015-05-08 02:13:09 -07:00 committed by Commit bot
parent 570fca61fc
commit f9c46ed1bb
3 changed files with 5 additions and 4 deletions

View File

@ -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());

View File

@ -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);

View File

@ -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();