Commit 27708001 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[compiler] Extract TF-specific parts of OptimizedCompilationJob

.. into new virtual subclass TurbofanCompilationJob. Update all TF code
to derive from this class. Specifically, the OptimizedCompilationInfo is
TF-specific and now lives in TurbofanCompilationJob.

The motivation behind this is that Maglev now also uses this
infrastructure.

Drive-by: Replace CompilationMode with ConcurrencyMode.

Bug: v8:7700
Change-Id: Iae6d1ffd1c810e2e45cad6c9b4e43d4c82ac54a7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3528493Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79515}
parent e66a1116
......@@ -386,7 +386,6 @@ void RecordUnoptimizedFunctionCompilation(
CompilationJob::Status OptimizedCompilationJob::PrepareJob(Isolate* isolate) {
DCHECK_EQ(ThreadId::Current(), isolate->thread_id());
DisallowJavascriptExecution no_js(isolate);
CompilerTracer::TracePrepareJob(isolate, compilation_info(), compiler_name_);
// Delegate to the underlying implementation.
DCHECK_EQ(state(), State::kReadyToPrepare);
......@@ -414,22 +413,22 @@ CompilationJob::Status OptimizedCompilationJob::FinalizeJob(Isolate* isolate) {
return UpdateState(FinalizeJobImpl(isolate), State::kSucceeded);
}
CompilationJob::Status OptimizedCompilationJob::RetryOptimization(
CompilationJob::Status TurbofanCompilationJob::RetryOptimization(
BailoutReason reason) {
DCHECK(compilation_info_->IsOptimizing());
compilation_info_->RetryOptimization(reason);
return UpdateState(FAILED, State::kFailed);
}
CompilationJob::Status OptimizedCompilationJob::AbortOptimization(
CompilationJob::Status TurbofanCompilationJob::AbortOptimization(
BailoutReason reason) {
DCHECK(compilation_info_->IsOptimizing());
compilation_info_->AbortOptimization(reason);
return UpdateState(FAILED, State::kFailed);
}
void OptimizedCompilationJob::RecordCompilationStats(CompilationMode mode,
Isolate* isolate) const {
void TurbofanCompilationJob::RecordCompilationStats(ConcurrencyMode mode,
Isolate* isolate) const {
DCHECK(compilation_info()->IsOptimizing());
Handle<JSFunction> function = compilation_info()->closure();
double ms_creategraph = time_taken_to_prepare_.InMillisecondsF();
......@@ -477,12 +476,12 @@ void OptimizedCompilationJob::RecordCompilationStats(CompilationMode mode,
base::TimeDelta time_foreground =
time_taken_to_prepare_ + time_taken_to_finalize_;
switch (mode) {
case OptimizedCompilationJob::kConcurrent:
case ConcurrencyMode::kConcurrent:
time_background += time_taken_to_execute_;
counters->turbofan_optimize_concurrent_total_time()->AddSample(
static_cast<int>(ElapsedTime().InMicroseconds()));
break;
case OptimizedCompilationJob::kSynchronous:
case ConcurrencyMode::kNotConcurrent:
counters->turbofan_optimize_non_concurrent_total_time()->AddSample(
static_cast<int>(ElapsedTime().InMicroseconds()));
time_foreground += time_taken_to_execute_;
......@@ -498,7 +497,7 @@ void OptimizedCompilationJob::RecordCompilationStats(CompilationMode mode,
}
}
void OptimizedCompilationJob::RecordFunctionCompilation(
void TurbofanCompilationJob::RecordFunctionCompilation(
CodeEventListener::LogEventsAndTags tag, Isolate* isolate) const {
Handle<AbstractCode> abstract_code =
Handle<AbstractCode>::cast(compilation_info()->code());
......@@ -912,11 +911,13 @@ bool PrepareJobWithHandleScope(OptimizedCompilationJob* job, Isolate* isolate,
OptimizedCompilationInfo* compilation_info) {
CompilationHandleScope compilation(isolate, compilation_info);
CanonicalHandleScopeForTurbofan canonical(isolate, compilation_info);
CompilerTracer::TracePrepareJob(isolate, compilation_info,
job->compiler_name());
compilation_info->ReopenHandlesInNewHandleScope(isolate);
return job->PrepareJob(isolate) == CompilationJob::SUCCEEDED;
}
bool GetOptimizedCodeNow(OptimizedCompilationJob* job, Isolate* isolate,
bool GetOptimizedCodeNow(TurbofanCompilationJob* job, Isolate* isolate,
OptimizedCompilationInfo* compilation_info) {
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RCS_SCOPE(isolate, RuntimeCallCounterId::kOptimizeNonConcurrent);
......@@ -945,14 +946,14 @@ bool GetOptimizedCodeNow(OptimizedCompilationJob* job, Isolate* isolate,
}
// Success!
job->RecordCompilationStats(OptimizedCompilationJob::kSynchronous, isolate);
job->RecordCompilationStats(ConcurrencyMode::kNotConcurrent, isolate);
DCHECK(!isolate->has_pending_exception());
InsertCodeIntoOptimizedCodeCache(compilation_info);
job->RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, isolate);
return true;
}
bool GetOptimizedCodeLater(std::unique_ptr<OptimizedCompilationJob> job,
bool GetOptimizedCodeLater(std::unique_ptr<TurbofanCompilationJob> job,
Isolate* isolate,
OptimizedCompilationInfo* compilation_info,
CodeKind code_kind, Handle<JSFunction> function) {
......@@ -1056,7 +1057,7 @@ MaybeHandle<CodeT> CompileTurbofan(
// BUG(5946): This DCHECK is necessary to make certain that we won't
// tolerate the lack of a script without bytecode.
DCHECK_IMPLIES(!has_script, shared->HasBytecodeArray());
std::unique_ptr<OptimizedCompilationJob> job(
std::unique_ptr<TurbofanCompilationJob> job(
compiler::Pipeline::NewCompilationJob(isolate, function, kCodeKind,
has_script, osr_offset, osr_frame));
OptimizedCompilationInfo* compilation_info = job->compilation_info();
......@@ -3317,8 +3318,8 @@ MaybeHandle<CodeT> Compiler::GetOptimizedCodeForOSR(
}
// static
bool Compiler::FinalizeOptimizedCompilationJob(OptimizedCompilationJob* job,
Isolate* isolate) {
bool Compiler::FinalizeTurbofanCompilationJob(TurbofanCompilationJob* job,
Isolate* isolate) {
VMState<COMPILER> state(isolate);
// Take ownership of the job. Deleting the job also tears down the zone.
std::unique_ptr<OptimizedCompilationJob> job_scope(job);
......@@ -3348,8 +3349,7 @@ bool Compiler::FinalizeOptimizedCompilationJob(OptimizedCompilationJob* job,
if (shared->optimization_disabled()) {
job->RetryOptimization(BailoutReason::kOptimizationDisabled);
} else if (job->FinalizeJob(isolate) == CompilationJob::SUCCEEDED) {
job->RecordCompilationStats(OptimizedCompilationJob::kConcurrent,
isolate);
job->RecordCompilationStats(ConcurrencyMode::kConcurrent, isolate);
job->RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG,
isolate);
if (V8_LIKELY(use_result)) {
......
......@@ -40,6 +40,7 @@ class ParseInfo;
class Parser;
class RuntimeCallStats;
class TimedHistogram;
class TurbofanCompilationJob;
class UnoptimizedCompilationInfo;
class UnoptimizedCompilationJob;
class WorkerThreadRuntimeCallStats;
......@@ -111,9 +112,9 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
Isolate* isolate,
ClearExceptionFlag flag);
// Finalize and install optimized code from previously run job.
static bool FinalizeOptimizedCompilationJob(OptimizedCompilationJob* job,
Isolate* isolate);
// Finalize and install Turbofan code from a previously run job.
static bool FinalizeTurbofanCompilationJob(TurbofanCompilationJob* job,
Isolate* isolate);
// Give the compiler a chance to perform low-latency initialization tasks of
// the given {function} on its instantiation. Note that only the runtime will
......@@ -364,24 +365,48 @@ class UnoptimizedCompilationJob : public CompilationJob {
// Each of the three phases can either fail or succeed.
class OptimizedCompilationJob : public CompilationJob {
public:
OptimizedCompilationJob(OptimizedCompilationInfo* compilation_info,
const char* compiler_name,
State initial_state = State::kReadyToPrepare)
: CompilationJob(initial_state),
compilation_info_(compilation_info),
compiler_name_(compiler_name) {}
OptimizedCompilationJob(const char* compiler_name, State initial_state)
: CompilationJob(initial_state), compiler_name_(compiler_name) {}
// Prepare the compile job. Must be called on the main thread.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Status PrepareJob(Isolate* isolate);
// Executes the compile job. Can be called on a background thread if
// can_execute_on_background_thread() returns true.
// Executes the compile job. Can be called on a background thread.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Status
ExecuteJob(RuntimeCallStats* stats, LocalIsolate* local_isolate = nullptr);
// Finalizes the compile job. Must be called on the main thread.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Status FinalizeJob(Isolate* isolate);
const char* compiler_name() const { return compiler_name_; }
protected:
// Overridden by the actual implementation.
virtual Status PrepareJobImpl(Isolate* isolate) = 0;
virtual Status ExecuteJobImpl(RuntimeCallStats* stats,
LocalIsolate* local_heap) = 0;
virtual Status FinalizeJobImpl(Isolate* isolate) = 0;
base::TimeDelta time_taken_to_prepare_;
base::TimeDelta time_taken_to_execute_;
base::TimeDelta time_taken_to_finalize_;
private:
const char* const compiler_name_;
};
// Thin wrapper to split off Turbofan-specific parts.
class TurbofanCompilationJob : public OptimizedCompilationJob {
public:
TurbofanCompilationJob(OptimizedCompilationInfo* compilation_info,
State initial_state)
: OptimizedCompilationJob("Turbofan", initial_state),
compilation_info_(compilation_info) {}
OptimizedCompilationInfo* compilation_info() const {
return compilation_info_;
}
// Report a transient failure, try again next time. Should only be called on
// optimization compilation jobs.
Status RetryOptimization(BailoutReason reason);
......@@ -390,28 +415,12 @@ class OptimizedCompilationJob : public CompilationJob {
// Should only be called on optimization compilation jobs.
Status AbortOptimization(BailoutReason reason);
enum CompilationMode { kConcurrent, kSynchronous };
void RecordCompilationStats(CompilationMode mode, Isolate* isolate) const;
void RecordCompilationStats(ConcurrencyMode mode, Isolate* isolate) const;
void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
Isolate* isolate) const;
OptimizedCompilationInfo* compilation_info() const {
return compilation_info_;
}
protected:
// Overridden by the actual implementation.
virtual Status PrepareJobImpl(Isolate* isolate) = 0;
virtual Status ExecuteJobImpl(RuntimeCallStats* stats,
LocalIsolate* local_heap) = 0;
virtual Status FinalizeJobImpl(Isolate* isolate) = 0;
private:
OptimizedCompilationInfo* compilation_info_;
base::TimeDelta time_taken_to_prepare_;
base::TimeDelta time_taken_to_execute_;
base::TimeDelta time_taken_to_finalize_;
const char* compiler_name_;
OptimizedCompilationInfo* const compilation_info_;
};
class FinalizeUnoptimizedCompilationData {
......
......@@ -24,7 +24,7 @@ namespace internal {
namespace {
void DisposeCompilationJob(OptimizedCompilationJob* job,
void DisposeCompilationJob(TurbofanCompilationJob* job,
bool restore_function_code) {
if (restore_function_code) {
Handle<JSFunction> function = job->compilation_info()->closure();
......@@ -96,18 +96,18 @@ OptimizingCompileDispatcher::~OptimizingCompileDispatcher() {
DeleteArray(input_queue_);
}
OptimizedCompilationJob* OptimizingCompileDispatcher::NextInput(
TurbofanCompilationJob* OptimizingCompileDispatcher::NextInput(
LocalIsolate* local_isolate) {
base::MutexGuard access_input_queue_(&input_queue_mutex_);
if (input_queue_length_ == 0) return nullptr;
OptimizedCompilationJob* job = input_queue_[InputQueueIndex(0)];
TurbofanCompilationJob* job = input_queue_[InputQueueIndex(0)];
DCHECK_NOT_NULL(job);
input_queue_shift_ = InputQueueIndex(1);
input_queue_length_--;
return job;
}
void OptimizingCompileDispatcher::CompileNext(OptimizedCompilationJob* job,
void OptimizingCompileDispatcher::CompileNext(TurbofanCompilationJob* job,
LocalIsolate* local_isolate) {
if (!job) return;
......@@ -129,7 +129,7 @@ void OptimizingCompileDispatcher::CompileNext(OptimizedCompilationJob* job,
void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
for (;;) {
OptimizedCompilationJob* job = nullptr;
TurbofanCompilationJob* job = nullptr;
{
base::MutexGuard access_output_queue_(&output_queue_mutex_);
if (output_queue_.empty()) return;
......@@ -144,7 +144,7 @@ void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
void OptimizingCompileDispatcher::FlushInputQueue() {
base::MutexGuard access_input_queue_(&input_queue_mutex_);
while (input_queue_length_ > 0) {
OptimizedCompilationJob* job = input_queue_[InputQueueIndex(0)];
TurbofanCompilationJob* job = input_queue_[InputQueueIndex(0)];
DCHECK_NOT_NULL(job);
input_queue_shift_ = InputQueueIndex(1);
input_queue_length_--;
......@@ -196,7 +196,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
HandleScope handle_scope(isolate_);
for (;;) {
OptimizedCompilationJob* job = nullptr;
TurbofanCompilationJob* job = nullptr;
{
base::MutexGuard access_output_queue_(&output_queue_mutex_);
if (output_queue_.empty()) return;
......@@ -213,7 +213,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
}
DisposeCompilationJob(job, false);
} else {
Compiler::FinalizeOptimizedCompilationJob(job, isolate_);
Compiler::FinalizeTurbofanCompilationJob(job, isolate_);
}
}
}
......@@ -227,7 +227,7 @@ bool OptimizingCompileDispatcher::HasJobs() {
}
void OptimizingCompileDispatcher::QueueForOptimization(
OptimizedCompilationJob* job) {
TurbofanCompilationJob* job) {
DCHECK(IsQueueAvailable());
{
// Add job to the back of the input queue.
......
......@@ -19,7 +19,7 @@ namespace v8 {
namespace internal {
class LocalHeap;
class OptimizedCompilationJob;
class TurbofanCompilationJob;
class RuntimeCallStats;
class SharedFunctionInfo;
......@@ -32,7 +32,7 @@ class V8_EXPORT_PRIVATE OptimizingCompileDispatcher {
input_queue_shift_(0),
ref_count_(0),
recompilation_delay_(FLAG_concurrent_recompilation_delay) {
input_queue_ = NewArray<OptimizedCompilationJob*>(input_queue_capacity_);
input_queue_ = NewArray<TurbofanCompilationJob*>(input_queue_capacity_);
}
~OptimizingCompileDispatcher();
......@@ -40,7 +40,7 @@ class V8_EXPORT_PRIVATE OptimizingCompileDispatcher {
void Stop();
void Flush(BlockingBehavior blocking_behavior);
// Takes ownership of |job|.
void QueueForOptimization(OptimizedCompilationJob* job);
void QueueForOptimization(TurbofanCompilationJob* job);
void AwaitCompileTasks();
void InstallOptimizedFunctions();
......@@ -72,8 +72,8 @@ class V8_EXPORT_PRIVATE OptimizingCompileDispatcher {
bool restore_function_code);
void FlushInputQueue();
void FlushOutputQueue(bool restore_function_code);
void CompileNext(OptimizedCompilationJob* job, LocalIsolate* local_isolate);
OptimizedCompilationJob* NextInput(LocalIsolate* local_isolate);
void CompileNext(TurbofanCompilationJob* job, LocalIsolate* local_isolate);
TurbofanCompilationJob* NextInput(LocalIsolate* local_isolate);
inline int InputQueueIndex(int i) {
int result = (i + input_queue_shift_) % input_queue_capacity_;
......@@ -85,14 +85,14 @@ class V8_EXPORT_PRIVATE OptimizingCompileDispatcher {
Isolate* isolate_;
// Circular queue of incoming recompilation tasks (including OSR).
OptimizedCompilationJob** input_queue_;
TurbofanCompilationJob** input_queue_;
int input_queue_capacity_;
int input_queue_length_;
int input_queue_shift_;
base::Mutex input_queue_mutex_;
// Queue of recompilation tasks ready to be installed (excluding OSR).
std::queue<OptimizedCompilationJob*> output_queue_;
std::queue<TurbofanCompilationJob*> output_queue_;
// Used for job based recompilation which has multiple producers on
// different threads.
base::Mutex output_queue_mutex_;
......
......@@ -1066,7 +1066,7 @@ PipelineStatistics* CreatePipelineStatistics(
} // namespace
class PipelineCompilationJob final : public OptimizedCompilationJob {
class PipelineCompilationJob final : public TurbofanCompilationJob {
public:
PipelineCompilationJob(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info,
......@@ -1104,7 +1104,8 @@ PipelineCompilationJob::PipelineCompilationJob(
// Note that the OptimizedCompilationInfo is not initialized at the time
// we pass it to the CompilationJob constructor, but it is not
// dereferenced there.
: OptimizedCompilationJob(&compilation_info_, "TurboFan"),
: TurbofanCompilationJob(&compilation_info_,
CompilationJob::State::kReadyToPrepare),
zone_(isolate->allocator(), kPipelineCompilationJobZoneName),
zone_stats_(isolate->allocator()),
compilation_info_(&zone_, isolate, shared_info, function, code_kind,
......@@ -2481,7 +2482,7 @@ struct VerifyGraphPhase {
#undef DECL_PIPELINE_PHASE_CONSTANTS_HELPER
#if V8_ENABLE_WEBASSEMBLY
class WasmHeapStubCompilationJob final : public OptimizedCompilationJob {
class WasmHeapStubCompilationJob final : public TurbofanCompilationJob {
public:
WasmHeapStubCompilationJob(Isolate* isolate, CallDescriptor* call_descriptor,
std::unique_ptr<Zone> zone, Graph* graph,
......@@ -2491,8 +2492,7 @@ class WasmHeapStubCompilationJob final : public OptimizedCompilationJob {
// Note that the OptimizedCompilationInfo is not initialized at the time
// we pass it to the CompilationJob constructor, but it is not
// dereferenced there.
: OptimizedCompilationJob(&info_, "TurboFan",
CompilationJob::State::kReadyToExecute),
: TurbofanCompilationJob(&info_, CompilationJob::State::kReadyToExecute),
debug_name_(std::move(debug_name)),
info_(base::CStrVector(debug_name_.get()), graph->zone(), kind),
call_descriptor_(call_descriptor),
......@@ -2526,14 +2526,11 @@ class WasmHeapStubCompilationJob final : public OptimizedCompilationJob {
};
// static
std::unique_ptr<OptimizedCompilationJob>
Pipeline::NewWasmHeapStubCompilationJob(Isolate* isolate,
CallDescriptor* call_descriptor,
std::unique_ptr<Zone> zone,
Graph* graph, CodeKind kind,
std::unique_ptr<char[]> debug_name,
const AssemblerOptions& options,
SourcePositionTable* source_positions) {
std::unique_ptr<TurbofanCompilationJob> Pipeline::NewWasmHeapStubCompilationJob(
Isolate* isolate, CallDescriptor* call_descriptor,
std::unique_ptr<Zone> zone, Graph* graph, CodeKind kind,
std::unique_ptr<char[]> debug_name, const AssemblerOptions& options,
SourcePositionTable* source_positions) {
return std::make_unique<WasmHeapStubCompilationJob>(
isolate, call_descriptor, std::move(zone), graph, kind,
std::move(debug_name), options, source_positions);
......@@ -3319,7 +3316,7 @@ MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
}
// static
std::unique_ptr<OptimizedCompilationJob> Pipeline::NewCompilationJob(
std::unique_ptr<TurbofanCompilationJob> Pipeline::NewCompilationJob(
Isolate* isolate, Handle<JSFunction> function, CodeKind code_kind,
bool has_script, BytecodeOffset osr_offset, JavaScriptFrame* osr_frame) {
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
......
......@@ -18,7 +18,7 @@ namespace internal {
struct AssemblerOptions;
class OptimizedCompilationInfo;
class OptimizedCompilationJob;
class TurbofanCompilationJob;
class ProfileDataFromFile;
class RegisterConfiguration;
......@@ -48,7 +48,7 @@ struct WasmLoopInfo;
class Pipeline : public AllStatic {
public:
// Returns a new compilation job for the given JavaScript function.
static V8_EXPORT_PRIVATE std::unique_ptr<OptimizedCompilationJob>
static V8_EXPORT_PRIVATE std::unique_ptr<TurbofanCompilationJob>
NewCompilationJob(Isolate* isolate, Handle<JSFunction> function,
CodeKind code_kind, bool has_script,
BytecodeOffset osr_offset = BytecodeOffset::None(),
......@@ -70,7 +70,7 @@ class Pipeline : public AllStatic {
SourcePositionTable* source_positions = nullptr);
// Returns a new compilation job for a wasm heap stub.
static std::unique_ptr<OptimizedCompilationJob> NewWasmHeapStubCompilationJob(
static std::unique_ptr<TurbofanCompilationJob> NewWasmHeapStubCompilationJob(
Isolate* isolate, CallDescriptor* call_descriptor,
std::unique_ptr<Zone> zone, Graph* graph, CodeKind kind,
std::unique_ptr<char[]> debug_name, const AssemblerOptions& options,
......
......@@ -7661,7 +7661,7 @@ void BuildInlinedJSToWasmWrapper(
builder.BuildJSToWasmWrapper(false, js_wasm_call_data, frame_state);
}
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
std::unique_ptr<TurbofanCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, const wasm::FunctionSig* sig,
const wasm::WasmModule* module, bool is_import,
const wasm::WasmFeatures& enabled_features) {
......@@ -8256,7 +8256,7 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
GetWasmCallDescriptor(zone.get(), sig, WasmCallKind::kWasmImportWrapper);
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
std::unique_ptr<TurbofanCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, incoming, std::move(zone), graph,
CodeKind::WASM_TO_JS_FUNCTION, std::move(name_buffer),
......@@ -8305,7 +8305,7 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
base::VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen, sig);
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
std::unique_ptr<TurbofanCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, incoming, std::move(zone), graph,
CodeKind::JS_TO_JS_FUNCTION, std::move(name_buffer),
......@@ -8362,7 +8362,7 @@ Handle<CodeT> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig,
base::VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen, sig);
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
std::unique_ptr<TurbofanCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, incoming, std::move(zone), graph, CodeKind::C_WASM_ENTRY,
std::move(name_buffer), AssemblerOptions::Default(isolate)));
......
......@@ -27,7 +27,7 @@
namespace v8 {
namespace internal {
struct AssemblerOptions;
class OptimizedCompilationJob;
class TurbofanCompilationJob;
namespace compiler {
// Forward declarations for some compiler data structures.
......@@ -138,8 +138,8 @@ wasm::WasmCode* CompileWasmJSFastCallWrapper(wasm::NativeModule*,
const wasm::FunctionSig*,
Handle<JSFunction> target);
// Returns an OptimizedCompilationJob object for a JS to Wasm wrapper.
std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
// Returns an TurbofanCompilationJob object for a JS to Wasm wrapper.
std::unique_ptr<TurbofanCompilationJob> NewJSToWasmCompilationJob(
Isolate* isolate, const wasm::FunctionSig* sig,
const wasm::WasmModule* module, bool is_import,
const wasm::WasmFeatures& enabled_features);
......
......@@ -85,10 +85,8 @@ std::unique_ptr<MaglevCompilationJob> MaglevCompilationJob::New(
MaglevCompilationJob::MaglevCompilationJob(
std::unique_ptr<MaglevCompilationInfo>&& info)
: OptimizedCompilationJob(nullptr, kMaglevCompilerName),
: OptimizedCompilationJob(kMaglevCompilerName, State::kReadyToPrepare),
info_(std::move(info)) {
// TODO(jgruber, v8:7700): Remove the OptimizedCompilationInfo (which should
// be renamed to TurbofanCompilationInfo) from OptimizedCompilationJob.
DCHECK(FLAG_maglev);
}
......
......@@ -24,7 +24,7 @@ namespace v8 {
namespace internal {
class Counters;
class OptimizedCompilationJob;
class TurbofanCompilationJob;
namespace wasm {
......@@ -138,7 +138,7 @@ class V8_EXPORT_PRIVATE JSToWasmWrapperCompilationUnit final {
bool is_import_;
const FunctionSig* sig_;
bool use_generic_wrapper_;
std::unique_ptr<OptimizedCompilationJob> job_;
std::unique_ptr<TurbofanCompilationJob> job_;
};
} // namespace wasm
......
......@@ -26,11 +26,10 @@ using OptimizingCompileDispatcherTest = TestWithNativeContext;
namespace {
class BlockingCompilationJob : public OptimizedCompilationJob {
class BlockingCompilationJob : public TurbofanCompilationJob {
public:
BlockingCompilationJob(Isolate* isolate, Handle<JSFunction> function)
: OptimizedCompilationJob(&info_, "BlockingCompilationJob",
State::kReadyToExecute),
: TurbofanCompilationJob(&info_, State::kReadyToExecute),
shared_(function->shared(), isolate),
zone_(isolate->allocator(), ZONE_NAME),
info_(&zone_, isolate, shared_, function, CodeKind::TURBOFAN),
......
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