Commit 5a54000e authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Rename OptimizingCompileJob to CompilationJob.

R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/1925743002
Cr-Commit-Position: refs/heads/master@{#35832}
parent 82ffd160
...@@ -307,9 +307,9 @@ void CompilationInfo::PrintAstForTesting() { ...@@ -307,9 +307,9 @@ void CompilationInfo::PrintAstForTesting() {
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Implementation of OptimizedCompileJob // Implementation of CompilationJob
OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { CompilationJob::Status CompilationJob::CreateGraph() {
DisallowJavascriptExecution no_js(isolate()); DisallowJavascriptExecution no_js(isolate());
DCHECK(info()->IsOptimizing()); DCHECK(info()->IsOptimizing());
...@@ -327,8 +327,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { ...@@ -327,8 +327,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
return SetLastStatus(CreateGraphImpl()); return SetLastStatus(CreateGraphImpl());
} }
CompilationJob::Status CompilationJob::OptimizeGraph() {
OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
DisallowHandleAllocation no_handles; DisallowHandleAllocation no_handles;
DisallowHandleDereference no_deref; DisallowHandleDereference no_deref;
...@@ -340,7 +339,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() { ...@@ -340,7 +339,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() {
return SetLastStatus(OptimizeGraphImpl()); return SetLastStatus(OptimizeGraphImpl());
} }
OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() { CompilationJob::Status CompilationJob::GenerateCode() {
DisallowCodeDependencyChange no_dependency_change; DisallowCodeDependencyChange no_dependency_change;
DisallowJavascriptExecution no_js(isolate()); DisallowJavascriptExecution no_js(isolate());
DCHECK(!info()->dependencies()->HasAborted()); DCHECK(!info()->dependencies()->HasAborted());
...@@ -365,8 +364,7 @@ void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object, ...@@ -365,8 +364,7 @@ void AddWeakObjectToCodeDependency(Isolate* isolate, Handle<HeapObject> object,
} // namespace } // namespace
void OptimizedCompileJob::RegisterWeakObjectsInOptimizedCode( void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) {
Handle<Code> code) {
// TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies.
Isolate* const isolate = code->GetIsolate(); Isolate* const isolate = code->GetIsolate();
DCHECK(code->is_optimized_code()); DCHECK(code->is_optimized_code());
...@@ -406,8 +404,7 @@ void OptimizedCompileJob::RegisterWeakObjectsInOptimizedCode( ...@@ -406,8 +404,7 @@ void OptimizedCompileJob::RegisterWeakObjectsInOptimizedCode(
code->set_can_have_weak_objects(true); code->set_can_have_weak_objects(true);
} }
void CompilationJob::RecordOptimizationStats() {
void OptimizedCompileJob::RecordOptimizationStats() {
Handle<JSFunction> function = info()->closure(); Handle<JSFunction> function = info()->closure();
if (!function->IsOptimized()) { if (!function->IsOptimized()) {
// Concurrent recompilation and OSR may race. Increment only once. // Concurrent recompilation and OSR may race. Increment only once.
...@@ -699,7 +696,7 @@ bool UseTurboFan(CompilationInfo* info) { ...@@ -699,7 +696,7 @@ bool UseTurboFan(CompilationInfo* info) {
passes_osr_test; passes_osr_test;
} }
bool GetOptimizedCodeNow(OptimizedCompileJob* job) { bool GetOptimizedCodeNow(CompilationJob* job) {
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();
...@@ -711,9 +708,9 @@ bool GetOptimizedCodeNow(OptimizedCompileJob* job) { ...@@ -711,9 +708,9 @@ bool GetOptimizedCodeNow(OptimizedCompileJob* job) {
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
TRACE_EVENT0("v8", "V8.RecompileSynchronous"); TRACE_EVENT0("v8", "V8.RecompileSynchronous");
if (job->CreateGraph() != OptimizedCompileJob::SUCCEEDED || if (job->CreateGraph() != CompilationJob::SUCCEEDED ||
job->OptimizeGraph() != OptimizedCompileJob::SUCCEEDED || job->OptimizeGraph() != CompilationJob::SUCCEEDED ||
job->GenerateCode() != OptimizedCompileJob::SUCCEEDED) { job->GenerateCode() != CompilationJob::SUCCEEDED) {
if (FLAG_trace_opt) { if (FLAG_trace_opt) {
PrintF("[aborted optimizing "); PrintF("[aborted optimizing ");
info->closure()->ShortPrint(); info->closure()->ShortPrint();
...@@ -730,7 +727,7 @@ bool GetOptimizedCodeNow(OptimizedCompileJob* job) { ...@@ -730,7 +727,7 @@ bool GetOptimizedCodeNow(OptimizedCompileJob* job) {
return true; return true;
} }
bool GetOptimizedCodeLater(OptimizedCompileJob* job) { bool GetOptimizedCodeLater(CompilationJob* job) {
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();
...@@ -759,7 +756,7 @@ bool GetOptimizedCodeLater(OptimizedCompileJob* job) { ...@@ -759,7 +756,7 @@ bool GetOptimizedCodeLater(OptimizedCompileJob* job) {
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
TRACE_EVENT0("v8", "V8.RecompileSynchronous"); TRACE_EVENT0("v8", "V8.RecompileSynchronous");
if (job->CreateGraph() != OptimizedCompileJob::SUCCEEDED) return false; if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false;
isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); isolate->optimizing_compile_dispatcher()->QueueForOptimization(job);
if (FLAG_trace_concurrent_recompilation) { if (FLAG_trace_concurrent_recompilation) {
...@@ -836,7 +833,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, ...@@ -836,7 +833,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
TRACE_EVENT0("v8", "V8.OptimizeCode"); TRACE_EVENT0("v8", "V8.OptimizeCode");
bool use_turbofan = UseTurboFan(info.get()); bool use_turbofan = UseTurboFan(info.get());
base::SmartPointer<OptimizedCompileJob> job( base::SmartPointer<CompilationJob> job(
use_turbofan ? compiler::Pipeline::NewCompilationJob(info.get()) use_turbofan ? compiler::Pipeline::NewCompilationJob(info.get())
: new HCompilationJob(info.get())); : new HCompilationJob(info.get()));
...@@ -1720,7 +1717,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function, ...@@ -1720,7 +1717,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame); return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame);
} }
void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) { void Compiler::FinalizeCompilationJob(CompilationJob* job) {
// Take ownership of compilation info. Deleting compilation info // Take ownership of compilation info. Deleting compilation info
// also tears down the zone. // also tears down the zone.
base::SmartPointer<CompilationInfo> info(job->info()); base::SmartPointer<CompilationInfo> info(job->info());
...@@ -1740,12 +1737,12 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) { ...@@ -1740,12 +1737,12 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) {
// Except when OSR already disabled optimization for some reason. // Except when OSR already disabled optimization for some reason.
// 3) The code may have already been invalidated due to dependency change. // 3) The code may have already been invalidated due to dependency change.
// 4) Code generation may have failed. // 4) Code generation may have failed.
if (job->last_status() == OptimizedCompileJob::SUCCEEDED) { if (job->last_status() == CompilationJob::SUCCEEDED) {
if (shared->optimization_disabled()) { if (shared->optimization_disabled()) {
job->RetryOptimization(kOptimizationDisabled); job->RetryOptimization(kOptimizationDisabled);
} else if (info->dependencies()->HasAborted()) { } else if (info->dependencies()->HasAborted()) {
job->RetryOptimization(kBailedOutDueToDependencyChange); job->RetryOptimization(kBailedOutDueToDependencyChange);
} else if (job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) { } else if (job->GenerateCode() == CompilationJob::SUCCEEDED) {
job->RecordOptimizationStats(); job->RecordOptimizationStats();
RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info.get()); RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info.get());
if (shared->SearchOptimizedCodeMap(info->context()->native_context(), if (shared->SearchOptimizedCodeMap(info->context()->native_context(),
...@@ -1763,7 +1760,7 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) { ...@@ -1763,7 +1760,7 @@ void Compiler::FinalizeOptimizedCompileJob(OptimizedCompileJob* job) {
} }
} }
DCHECK(job->last_status() != OptimizedCompileJob::SUCCEEDED); DCHECK(job->last_status() != CompilationJob::SUCCEEDED);
if (FLAG_trace_opt) { if (FLAG_trace_opt) {
PrintF("[aborted optimizing "); PrintF("[aborted optimizing ");
info->closure()->ShortPrint(); info->closure()->ShortPrint();
......
...@@ -17,8 +17,8 @@ namespace internal { ...@@ -17,8 +17,8 @@ namespace internal {
// Forward declarations. // Forward declarations.
class CompilationInfo; class CompilationInfo;
class CompilationJob;
class JavaScriptFrame; class JavaScriptFrame;
class OptimizedCompileJob;
class ParseInfo; class ParseInfo;
class ScriptData; class ScriptData;
...@@ -50,8 +50,8 @@ class Compiler : public AllStatic { ...@@ -50,8 +50,8 @@ class Compiler : public AllStatic {
static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); static bool CompileDebugCode(Handle<SharedFunctionInfo> shared);
static bool CompileForLiveEdit(Handle<Script> script); static bool CompileForLiveEdit(Handle<Script> script);
// Generate and install code from previously queued optimization job. // Generate and install code from previously queued compilation job.
static void FinalizeOptimizedCompileJob(OptimizedCompileJob* job); static void FinalizeCompilationJob(CompilationJob* job);
// Give the compiler a chance to perform low-latency initialization tasks of // Give the compiler a chance to perform low-latency initialization tasks of
// the given {function} on its instantiation. Note that only the runtime will // the given {function} on its instantiation. Note that only the runtime will
...@@ -572,11 +572,11 @@ class CompilationInfo { ...@@ -572,11 +572,11 @@ class CompilationInfo {
// succeed. Apart from their return value, the status of the phase last run can // succeed. Apart from their return value, the status of the phase last run can
// be checked using {last_status()} as well. // be checked using {last_status()} as well.
// TODO(mstarzinger): Make CompilationInfo base embedded. // TODO(mstarzinger): Make CompilationInfo base embedded.
class OptimizedCompileJob { class CompilationJob {
public: public:
explicit OptimizedCompileJob(CompilationInfo* info, const char* compiler_name) explicit CompilationJob(CompilationInfo* info, const char* compiler_name)
: info_(info), compiler_name_(compiler_name), last_status_(SUCCEEDED) {} : info_(info), compiler_name_(compiler_name), last_status_(SUCCEEDED) {}
virtual ~OptimizedCompileJob() {} virtual ~CompilationJob() {}
enum Status { enum Status {
FAILED, BAILED_OUT, SUCCEEDED FAILED, BAILED_OUT, SUCCEEDED
......
...@@ -500,10 +500,10 @@ PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ...@@ -500,10 +500,10 @@ PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
return pipeline_statistics; return pipeline_statistics;
} }
class PipelineCompilationJob final : public OptimizedCompileJob { class PipelineCompilationJob final : public CompilationJob {
public: public:
explicit PipelineCompilationJob(CompilationInfo* info) explicit PipelineCompilationJob(CompilationInfo* info)
: OptimizedCompileJob(info, "TurboFan"), : CompilationJob(info, "TurboFan"),
zone_pool_(info->isolate()->allocator()), zone_pool_(info->isolate()->allocator()),
pipeline_statistics_(CreatePipelineStatistics(info, &zone_pool_)), pipeline_statistics_(CreatePipelineStatistics(info, &zone_pool_)),
data_(&zone_pool_, info, pipeline_statistics_.get()), data_(&zone_pool_, info, pipeline_statistics_.get()),
...@@ -572,12 +572,12 @@ PipelineCompilationJob::Status PipelineCompilationJob::GenerateCodeImpl() { ...@@ -572,12 +572,12 @@ PipelineCompilationJob::Status PipelineCompilationJob::GenerateCodeImpl() {
return SUCCEEDED; return SUCCEEDED;
} }
class PipelineWasmCompilationJob final : public OptimizedCompileJob { class PipelineWasmCompilationJob final : public CompilationJob {
public: public:
explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph, explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph,
CallDescriptor* descriptor, CallDescriptor* descriptor,
SourcePositionTable* source_positions) SourcePositionTable* source_positions)
: OptimizedCompileJob(info, "TurboFan"), : CompilationJob(info, "TurboFan"),
zone_pool_(info->isolate()->allocator()), zone_pool_(info->isolate()->allocator()),
data_(&zone_pool_, info, graph, source_positions), data_(&zone_pool_, info, graph, source_positions),
pipeline_(&data_), pipeline_(&data_),
...@@ -1461,12 +1461,12 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, ...@@ -1461,12 +1461,12 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
} }
// static // static
OptimizedCompileJob* Pipeline::NewCompilationJob(CompilationInfo* info) { CompilationJob* Pipeline::NewCompilationJob(CompilationInfo* info) {
return new PipelineCompilationJob(info); return new PipelineCompilationJob(info);
} }
// static // static
OptimizedCompileJob* Pipeline::NewWasmCompilationJob( CompilationJob* Pipeline::NewWasmCompilationJob(
CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
SourcePositionTable* source_positions) { SourcePositionTable* source_positions) {
return new PipelineWasmCompilationJob(info, graph, descriptor, return new PipelineWasmCompilationJob(info, graph, descriptor,
......
...@@ -13,7 +13,7 @@ namespace v8 { ...@@ -13,7 +13,7 @@ namespace v8 {
namespace internal { namespace internal {
class CompilationInfo; class CompilationInfo;
class OptimizedCompileJob; class CompilationJob;
class RegisterConfiguration; class RegisterConfiguration;
namespace compiler { namespace compiler {
...@@ -73,10 +73,10 @@ class Pipeline { ...@@ -73,10 +73,10 @@ class Pipeline {
Schedule* schedule = nullptr); Schedule* schedule = nullptr);
// Returns a new compilation job for the given compilation info. // Returns a new compilation job for the given compilation info.
static OptimizedCompileJob* NewCompilationJob(CompilationInfo* info); static CompilationJob* NewCompilationJob(CompilationInfo* info);
// Returns a new compilation job for the WebAssembly compilation info. // Returns a new compilation job for the WebAssembly compilation info.
static OptimizedCompileJob* NewWasmCompilationJob( static CompilationJob* NewWasmCompilationJob(
CompilationInfo* info, Graph* graph, CallDescriptor* descriptor, CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
SourcePositionTable* source_positions); SourcePositionTable* source_positions);
......
...@@ -2968,11 +2968,11 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, ...@@ -2968,11 +2968,11 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
} }
} }
CompilationInfo info(func_name, isolate, jsgraph->graph()->zone(), flags); CompilationInfo info(func_name, isolate, jsgraph->graph()->zone(), flags);
base::SmartPointer<OptimizedCompileJob> job(Pipeline::NewWasmCompilationJob( base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob(
&info, jsgraph->graph(), descriptor, source_positions)); &info, jsgraph->graph(), descriptor, source_positions));
Handle<Code> code = Handle<Code>::null(); Handle<Code> code = Handle<Code>::null();
if (job->OptimizeGraph() == OptimizedCompileJob::SUCCEEDED && if (job->OptimizeGraph() == CompilationJob::SUCCEEDED &&
job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) { job->GenerateCode() == CompilationJob::SUCCEEDED) {
code = info.code(); code = info.code();
} }
......
...@@ -30,12 +30,10 @@ class LAllocator; ...@@ -30,12 +30,10 @@ class LAllocator;
class LChunk; class LChunk;
class LiveRange; class LiveRange;
class HCompilationJob final : public OptimizedCompileJob { class HCompilationJob final : public CompilationJob {
public: public:
explicit HCompilationJob(CompilationInfo* info) explicit HCompilationJob(CompilationInfo* info)
: OptimizedCompileJob(info, "Crankshaft"), : CompilationJob(info, "Crankshaft"), graph_(nullptr), chunk_(nullptr) {}
graph_(nullptr),
chunk_(nullptr) {}
protected: protected:
virtual Status CreateGraphImpl(); virtual Status CreateGraphImpl();
......
...@@ -15,8 +15,7 @@ namespace internal { ...@@ -15,8 +15,7 @@ namespace internal {
namespace { namespace {
void DisposeOptimizedCompileJob(OptimizedCompileJob* job, void DisposeCompilationJob(CompilationJob* job, bool restore_function_code) {
bool restore_function_code) {
// The recompile job is allocated in the CompilationInfo's zone. // The recompile job is allocated in the CompilationInfo's zone.
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
if (restore_function_code) { if (restore_function_code) {
...@@ -86,33 +85,30 @@ OptimizingCompileDispatcher::~OptimizingCompileDispatcher() { ...@@ -86,33 +85,30 @@ OptimizingCompileDispatcher::~OptimizingCompileDispatcher() {
DeleteArray(input_queue_); DeleteArray(input_queue_);
} }
CompilationJob* OptimizingCompileDispatcher::NextInput(bool check_if_flushing) {
OptimizedCompileJob* OptimizingCompileDispatcher::NextInput(
bool check_if_flushing) {
base::LockGuard<base::Mutex> access_input_queue_(&input_queue_mutex_); base::LockGuard<base::Mutex> access_input_queue_(&input_queue_mutex_);
if (input_queue_length_ == 0) return NULL; if (input_queue_length_ == 0) return NULL;
OptimizedCompileJob* job = input_queue_[InputQueueIndex(0)]; CompilationJob* job = input_queue_[InputQueueIndex(0)];
DCHECK_NOT_NULL(job); DCHECK_NOT_NULL(job);
input_queue_shift_ = InputQueueIndex(1); input_queue_shift_ = InputQueueIndex(1);
input_queue_length_--; input_queue_length_--;
if (check_if_flushing) { if (check_if_flushing) {
if (static_cast<ModeFlag>(base::Acquire_Load(&mode_)) == FLUSH) { if (static_cast<ModeFlag>(base::Acquire_Load(&mode_)) == FLUSH) {
AllowHandleDereference allow_handle_dereference; AllowHandleDereference allow_handle_dereference;
DisposeOptimizedCompileJob(job, true); DisposeCompilationJob(job, true);
return NULL; return NULL;
} }
} }
return job; return job;
} }
void OptimizingCompileDispatcher::CompileNext(CompilationJob* job) {
void OptimizingCompileDispatcher::CompileNext(OptimizedCompileJob* job) {
if (!job) return; if (!job) return;
// The function may have already been optimized by OSR. Simply continue. // The function may have already been optimized by OSR. Simply continue.
OptimizedCompileJob::Status status = job->OptimizeGraph(); CompilationJob::Status status = job->OptimizeGraph();
USE(status); // Prevent an unused-variable error in release mode. USE(status); // Prevent an unused-variable error in release mode.
DCHECK(status != OptimizedCompileJob::FAILED); DCHECK(status != CompilationJob::FAILED);
// The function may have already been optimized by OSR. Simply continue. // The function may have already been optimized by OSR. Simply continue.
// Use a mutex to make sure that functions marked for install // Use a mutex to make sure that functions marked for install
...@@ -125,7 +121,7 @@ void OptimizingCompileDispatcher::CompileNext(OptimizedCompileJob* job) { ...@@ -125,7 +121,7 @@ void OptimizingCompileDispatcher::CompileNext(OptimizedCompileJob* job) {
void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) { void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
for (;;) { for (;;) {
OptimizedCompileJob* job = NULL; CompilationJob* job = NULL;
{ {
base::LockGuard<base::Mutex> access_output_queue_(&output_queue_mutex_); base::LockGuard<base::Mutex> access_output_queue_(&output_queue_mutex_);
if (output_queue_.empty()) return; if (output_queue_.empty()) return;
...@@ -133,7 +129,7 @@ void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) { ...@@ -133,7 +129,7 @@ void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
output_queue_.pop(); output_queue_.pop();
} }
DisposeOptimizedCompileJob(job, restore_function_code); DisposeCompilationJob(job, restore_function_code);
} }
} }
...@@ -177,7 +173,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() { ...@@ -177,7 +173,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
HandleScope handle_scope(isolate_); HandleScope handle_scope(isolate_);
for (;;) { for (;;) {
OptimizedCompileJob* job = NULL; CompilationJob* job = NULL;
{ {
base::LockGuard<base::Mutex> access_output_queue_(&output_queue_mutex_); base::LockGuard<base::Mutex> access_output_queue_(&output_queue_mutex_);
if (output_queue_.empty()) return; if (output_queue_.empty()) return;
...@@ -192,16 +188,14 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() { ...@@ -192,16 +188,14 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
function->ShortPrint(); function->ShortPrint();
PrintF(" as it has already been optimized.\n"); PrintF(" as it has already been optimized.\n");
} }
DisposeOptimizedCompileJob(job, false); DisposeCompilationJob(job, false);
} else { } else {
Compiler::FinalizeOptimizedCompileJob(job); Compiler::FinalizeCompilationJob(job);
} }
} }
} }
void OptimizingCompileDispatcher::QueueForOptimization(CompilationJob* job) {
void OptimizingCompileDispatcher::QueueForOptimization(
OptimizedCompileJob* job) {
DCHECK(IsQueueAvailable()); DCHECK(IsQueueAvailable());
{ {
// Add job to the back of the input queue. // Add job to the back of the input queue.
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class HOptimizedGraphBuilder; class CompilationJob;
class OptimizedCompileJob;
class SharedFunctionInfo; class SharedFunctionInfo;
class OptimizingCompileDispatcher { class OptimizingCompileDispatcher {
...@@ -32,7 +31,7 @@ class OptimizingCompileDispatcher { ...@@ -32,7 +31,7 @@ class OptimizingCompileDispatcher {
ref_count_(0), ref_count_(0),
recompilation_delay_(FLAG_concurrent_recompilation_delay) { recompilation_delay_(FLAG_concurrent_recompilation_delay) {
base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE)); base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE));
input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_); input_queue_ = NewArray<CompilationJob*>(input_queue_capacity_);
} }
~OptimizingCompileDispatcher(); ~OptimizingCompileDispatcher();
...@@ -40,7 +39,7 @@ class OptimizingCompileDispatcher { ...@@ -40,7 +39,7 @@ class OptimizingCompileDispatcher {
void Run(); void Run();
void Stop(); void Stop();
void Flush(); void Flush();
void QueueForOptimization(OptimizedCompileJob* optimizing_compiler); void QueueForOptimization(CompilationJob* job);
void Unblock(); void Unblock();
void InstallOptimizedFunctions(); void InstallOptimizedFunctions();
...@@ -57,8 +56,8 @@ class OptimizingCompileDispatcher { ...@@ -57,8 +56,8 @@ class OptimizingCompileDispatcher {
enum ModeFlag { COMPILE, FLUSH }; enum ModeFlag { COMPILE, FLUSH };
void FlushOutputQueue(bool restore_function_code); void FlushOutputQueue(bool restore_function_code);
void CompileNext(OptimizedCompileJob* job); void CompileNext(CompilationJob* job);
OptimizedCompileJob* NextInput(bool check_if_flushing = false); CompilationJob* NextInput(bool check_if_flushing = false);
inline int InputQueueIndex(int i) { inline int InputQueueIndex(int i) {
int result = (i + input_queue_shift_) % input_queue_capacity_; int result = (i + input_queue_shift_) % input_queue_capacity_;
...@@ -70,14 +69,14 @@ class OptimizingCompileDispatcher { ...@@ -70,14 +69,14 @@ class OptimizingCompileDispatcher {
Isolate* isolate_; Isolate* isolate_;
// Circular queue of incoming recompilation tasks (including OSR). // Circular queue of incoming recompilation tasks (including OSR).
OptimizedCompileJob** input_queue_; CompilationJob** input_queue_;
int input_queue_capacity_; int input_queue_capacity_;
int input_queue_length_; int input_queue_length_;
int input_queue_shift_; int input_queue_shift_;
base::Mutex input_queue_mutex_; base::Mutex input_queue_mutex_;
// Queue of recompilation tasks ready to be installed (excluding OSR). // Queue of recompilation tasks ready to be installed (excluding OSR).
std::queue<OptimizedCompileJob*> output_queue_; std::queue<CompilationJob*> output_queue_;
// Used for job based recompilation which has multiple producers on // Used for job based recompilation which has multiple producers on
// different threads. // different threads.
base::Mutex output_queue_mutex_; base::Mutex output_queue_mutex_;
......
...@@ -485,12 +485,11 @@ class WasmFunctionCompiler : public HandleAndZoneScope, ...@@ -485,12 +485,11 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
} }
CompilationInfo info(debug_name_, this->isolate(), this->zone(), CompilationInfo info(debug_name_, this->isolate(), this->zone(),
Code::ComputeFlags(Code::WASM_FUNCTION)); Code::ComputeFlags(Code::WASM_FUNCTION));
v8::base::SmartPointer<OptimizedCompileJob> job( v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob(
Pipeline::NewWasmCompilationJob(&info, graph(), desc, &info, graph(), desc, &source_position_table_));
&source_position_table_));
Handle<Code> code = Handle<Code>::null(); Handle<Code> code = Handle<Code>::null();
if (job->OptimizeGraph() == OptimizedCompileJob::SUCCEEDED && if (job->OptimizeGraph() == CompilationJob::SUCCEEDED &&
job->GenerateCode() == OptimizedCompileJob::SUCCEEDED) { job->GenerateCode() == CompilationJob::SUCCEEDED) {
code = info.code(); code = info.code();
} }
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
......
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