Commit cabe6844 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Slightly change API to finalize compile jobs.

This changes the compiler API that finalizes a previously queued
optimization job on the main thread, to not deal with code objects
directly. This is in sync with the rest of the API now.

R=yangguo@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#34577}
parent 773c44f4
......@@ -1871,8 +1871,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame);
}
MaybeHandle<Code> Compiler::GetConcurrentlyOptimizedCode(
OptimizedCompileJob* job) {
void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) {
// Take ownership of compilation info. Deleting compilation info
// also tears down the zone and the recompile job.
base::SmartPointer<CompilationInfo> info(job->info());
......@@ -1908,7 +1907,8 @@ MaybeHandle<Code> Compiler::GetConcurrentlyOptimizedCode(
info->closure()->ShortPrint();
PrintF("]\n");
}
return Handle<Code>(*info->code());
info->closure()->ReplaceCode(*info->code());
return;
}
}
......@@ -1918,7 +1918,7 @@ MaybeHandle<Code> Compiler::GetConcurrentlyOptimizedCode(
info->closure()->ShortPrint();
PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason()));
}
return MaybeHandle<Code>();
info->closure()->ReplaceCode(shared->code());
}
void Compiler::PostInstantiation(Handle<JSFunction> function,
......
......@@ -588,6 +588,9 @@ class Compiler : public AllStatic {
static bool CompileDebugCode(Handle<SharedFunctionInfo> shared);
static void CompileForLiveEdit(Handle<Script> script);
// Generate and install code from previously queued optimization job.
static void FinalizeOptimizedCompileJob(OptimizedCompileJob* job);
// Give the compiler a chance to perform low-latency initialization tasks of
// the given {function} on its instantiation. Note that only the runtime will
// offer this chance, optimized closure instantiation will not call this.
......@@ -651,11 +654,6 @@ class Compiler : public AllStatic {
MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCodeForOSR(
Handle<JSFunction> function, BailoutId osr_ast_id,
JavaScriptFrame* osr_frame);
// Generate and return code from previously queued optimization job.
// On failure, return the empty handle.
MUST_USE_RESULT static MaybeHandle<Code> GetConcurrentlyOptimizedCode(
OptimizedCompileJob* job);
};
} // namespace internal
......
......@@ -198,9 +198,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
}
DisposeOptimizedCompileJob(job, false);
} else {
MaybeHandle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job);
function->ReplaceCode(code.is_null() ? function->shared()->code()
: *code.ToHandleChecked());
Compiler::FinalizeOptimizedCompileJob(job);
}
}
}
......
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