Commit b1e10f4b authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

Revert "[compiler-dispatcher] Make compiler jobs abstract"

This reverts commit e4bbf92b.

Reason for revert: Crashes: https://build.chromium.org/p/client.v8/builders/V8%20Linux64/builds/19156

Original change's description:
> [compiler-dispatcher] Make compiler jobs abstract
> 
> Makes compiler dispatcher jobs an abstract interface, with unoptimized
> compile jobs as an implementation of this interface.
> 
> Bug: v8:6537
> Change-Id: I6569060a89c92d35e4bc7962623f77082a354934
> Reviewed-on: https://chromium-review.googlesource.com/558290
> Reviewed-by: Georg Neis <neis@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#46931}

TBR=rmcilroy@chromium.org,neis@chromium.org,leszeks@chromium.org

Change-Id: I023c0455929180fdcde3caf581f483f794ca2368
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6537
Reviewed-on: https://chromium-review.googlesource.com/589153Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46932}
parent e4bbf92b
......@@ -1246,8 +1246,6 @@ v8_source_set("v8_base") {
"src/compiler-dispatcher/compiler-dispatcher.h",
"src/compiler-dispatcher/optimizing-compile-dispatcher.cc",
"src/compiler-dispatcher/optimizing-compile-dispatcher.h",
"src/compiler-dispatcher/unoptimized-compile-job.cc",
"src/compiler-dispatcher/unoptimized-compile-job.h",
"src/compiler.cc",
"src/compiler.h",
"src/compiler/access-builder.cc",
......
......@@ -5,54 +5,168 @@
#ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
#define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_JOB_H_
#include "src/contexts.h"
#include <memory>
#include "include/v8.h"
#include "src/base/macros.h"
#include "src/globals.h"
#include "src/handles.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
namespace v8 {
namespace internal {
class AstValueFactory;
class AstStringConstants;
class CompilerDispatcherTracer;
class CompilationInfo;
class CompilationJob;
class DeferredHandles;
class FunctionLiteral;
class Isolate;
class ParseInfo;
class Parser;
class SharedFunctionInfo;
class String;
class UnicodeCache;
class Utf16CharacterStream;
enum class CompileJobStatus {
kInitial,
kReadyToParse,
kParsed,
kReadyToAnalyze,
kAnalyzed,
kReadyToCompile,
kCompiled,
kFailed,
kDone,
};
class UnoptimizedCompileJob;
class V8_EXPORT_PRIVATE CompileJobFinishCallback {
public:
virtual ~CompileJobFinishCallback() {}
virtual void ParseFinished(std::unique_ptr<ParseInfo> parse_info) = 0;
};
class V8_EXPORT_PRIVATE CompilerDispatcherJob {
public:
enum Type { kUnoptimizedCompile };
virtual ~CompilerDispatcherJob() {}
virtual Type type() const = 0;
// Returns true if this CompilerDispatcherJob has finished (either with a
// success or a failure).
virtual bool IsFinished() = 0;
// Returns true if this CompilerDispatcherJob has failed.
virtual bool IsFailed() = 0;
// Creates a CompilerDispatcherJob in the initial state.
CompilerDispatcherJob(Isolate* isolate, CompilerDispatcherTracer* tracer,
Handle<SharedFunctionInfo> shared,
size_t max_stack_size);
// TODO(wiktorg) document it better once I know how it relates to whole stuff
// Creates a CompilerDispatcherJob in ready to parse top-level function state.
CompilerDispatcherJob(CompilerDispatcherTracer* tracer, size_t max_stack_size,
Handle<String> source, int start_position,
int end_position, LanguageMode language_mode,
int function_literal_id, bool native, bool module,
bool is_named_expression, uint32_t hash_seed,
AccountingAllocator* zone_allocator, int compiler_hints,
const AstStringConstants* ast_string_constants,
CompileJobFinishCallback* finish_callback);
// Creates a CompilerDispatcherJob in the analyzed state.
CompilerDispatcherJob(Isolate* isolate, CompilerDispatcherTracer* tracer,
Handle<Script> script,
Handle<SharedFunctionInfo> shared,
FunctionLiteral* literal, ParseInfo* outer_parse_info,
std::shared_ptr<DeferredHandles> compile_handles,
size_t max_stack_size);
~CompilerDispatcherJob();
bool has_context() const { return !context_.is_null(); }
Context* context() { return *context_; }
Handle<SharedFunctionInfo> shared() const { return shared_; }
// Returns true if this CompilerDispatcherJob was created for the given
// function.
bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const;
bool IsFinished() {
return status() == CompileJobStatus::kDone ||
status() == CompileJobStatus::kFailed;
}
bool IsFailed() { return status() == CompileJobStatus::kFailed; }
// Return true if the next step can be run on any thread, that is when both
// StepNextOnMainThread and StepNextOnBackgroundThread could be used for the
// next step.
virtual bool CanStepNextOnAnyThread() = 0;
bool CanStepNextOnAnyThread() {
return status() == CompileJobStatus::kReadyToParse ||
status() == CompileJobStatus::kReadyToCompile;
}
// Step the job forward by one state on the main thread.
virtual void StepNextOnMainThread() = 0;
void StepNextOnMainThread();
// Step the job forward by one state on a background thread.
virtual void StepNextOnBackgroundThread() = 0;
void StepNextOnBackgroundThread();
// Transition from any state to kInitial and free all resources.
virtual void ResetOnMainThread() = 0;
void ResetOnMainThread();
// Estimate how long the next step will take using the tracer.
virtual double EstimateRuntimeOfNextStepInMs() const = 0;
double EstimateRuntimeOfNextStepInMs() const;
// Even though the name does not imply this, ShortPrint() must only be invoked
// on the main thread.
virtual void ShortPrint() = 0;
void ShortPrint();
private:
friend class CompilerDispatcherTest;
friend class CompilerDispatcherJobTest;
CompileJobStatus status() const { return status_; }
CompileJobStatus status_;
Isolate* isolate_;
CompilerDispatcherTracer* tracer_;
Handle<Context> context_; // Global handle.
Handle<SharedFunctionInfo> shared_; // Global handle.
Handle<String> source_; // Global handle.
Handle<String> wrapper_; // Global handle.
std::unique_ptr<v8::String::ExternalStringResourceBase> source_wrapper_;
size_t max_stack_size_;
CompileJobFinishCallback* finish_callback_ = nullptr;
// Members required for parsing.
std::unique_ptr<UnicodeCache> unicode_cache_;
std::unique_ptr<Utf16CharacterStream> character_stream_;
std::unique_ptr<ParseInfo> parse_info_;
std::unique_ptr<Parser> parser_;
// Members required for compiling.
std::unique_ptr<Zone> compile_zone_;
std::unique_ptr<CompilationInfo> compile_info_;
std::unique_ptr<CompilationJob> compile_job_;
bool trace_compiler_dispatcher_jobs_;
// Transition from kInitial to kReadyToParse.
void PrepareToParseOnMainThread();
// Transition from kReadyToParse to kParsed (or kDone if there is
// finish_callback).
void Parse();
// Transition from kParsed to kReadyToAnalyze (or kFailed).
void FinalizeParsingOnMainThread();
// Transition from kReadyToAnalyze to kAnalyzed (or kFailed).
void AnalyzeOnMainThread();
// Transition from kAnalyzed to kReadyToCompile (or kFailed).
void PrepareToCompileOnMainThread();
// Transition from kReadyToCompile to kCompiled.
void Compile();
// Transition from kCompiled to kDone (or kFailed).
void FinalizeCompilingOnMainThread();
// Casts to implementations.
const UnoptimizedCompileJob* AsUnoptimizedCompileJob() const;
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherJob);
};
} // namespace internal
......
......@@ -11,7 +11,6 @@
#include "src/compilation-info.h"
#include "src/compiler-dispatcher/compiler-dispatcher-job.h"
#include "src/compiler-dispatcher/compiler-dispatcher-tracer.h"
#include "src/compiler-dispatcher/unoptimized-compile-job.h"
#include "src/flags.h"
#include "src/objects-inl.h"
......@@ -27,6 +26,15 @@ bool DoNextStepOnMainThread(Isolate* isolate, CompilerDispatcherJob* job,
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompilerDispatcherForgroundStep");
// Ensure we are in the correct context for the job.
SaveContext save(isolate);
if (job->has_context()) {
isolate->set_context(job->context());
} else {
DCHECK(job->CanStepNextOnAnyThread());
}
job->StepNextOnMainThread();
DCHECK_EQ(job->IsFailed(), isolate->has_pending_exception());
......@@ -162,7 +170,7 @@ CompilerDispatcher::CompilerDispatcher(Isolate* isolate, Platform* platform,
tracer_(new CompilerDispatcherTracer(isolate_)),
task_manager_(new CancelableTaskManager()),
next_job_id_(0),
shared_to_unoptimized_job_id_(isolate->heap()),
shared_to_job_id_(isolate->heap()),
memory_pressure_level_(MemoryPressureLevel::kNone),
abort_(false),
idle_task_scheduled_(false),
......@@ -214,7 +222,14 @@ bool CompilerDispatcher::CanEnqueue(Handle<SharedFunctionInfo> function) {
CompilerDispatcher::JobId CompilerDispatcher::Enqueue(
std::unique_ptr<CompilerDispatcherJob> job) {
DCHECK(!job->IsFinished());
JobMap::const_iterator it = InsertJob(std::move(job));
bool added;
JobMap::const_iterator it;
std::tie(it, added) =
jobs_.insert(std::make_pair(next_job_id_++, std::move(job)));
DCHECK(added);
if (!it->second->shared().is_null()) {
shared_to_job_id_.Set(it->second->shared(), it->first);
}
ConsiderJobForBackgroundProcessing(it->second.get());
ScheduleIdleTaskIfNeeded();
return it->first;
......@@ -223,7 +238,15 @@ CompilerDispatcher::JobId CompilerDispatcher::Enqueue(
CompilerDispatcher::JobId CompilerDispatcher::EnqueueAndStep(
std::unique_ptr<CompilerDispatcherJob> job) {
DCHECK(!job->IsFinished());
JobMap::const_iterator it = InsertJob(std::move(job));
bool added;
JobMap::const_iterator it;
std::tie(it, added) =
jobs_.insert(std::make_pair(next_job_id_++, std::move(job)));
DCHECK(added);
if (!it->second->shared().is_null()) {
shared_to_job_id_.Set(it->second->shared(), it->first);
}
JobId id = it->first;
if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: stepping ");
it->second->ShortPrint();
......@@ -234,7 +257,7 @@ CompilerDispatcher::JobId CompilerDispatcher::EnqueueAndStep(
ConsiderJobForBackgroundProcessing(it->second.get());
RemoveIfFinished(it);
ScheduleIdleTaskIfNeeded();
return it->first;
return id;
}
bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
......@@ -249,17 +272,19 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
PrintF(" for parse and compile\n");
}
std::unique_ptr<CompilerDispatcherJob> job(new UnoptimizedCompileJob(
std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
isolate_, tracer_.get(), function, max_stack_size_));
Enqueue(std::move(job));
return true;
}
bool CompilerDispatcher::Enqueue(
Handle<String> source, int start_position, int end_position,
LanguageMode language_mode, int function_literal_id, bool native,
bool module, bool is_named_expression, int compiler_hints,
UnoptimizedCompileJobFinishCallback* finish_callback, JobId* job_id) {
bool CompilerDispatcher::Enqueue(Handle<String> source, int start_position,
int end_position, LanguageMode language_mode,
int function_literal_id, bool native,
bool module, bool is_named_expression,
int compiler_hints,
CompileJobFinishCallback* finish_callback,
JobId* job_id) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompilerDispatcherEnqueue");
if (!CanEnqueue()) return false;
......@@ -269,7 +294,7 @@ bool CompilerDispatcher::Enqueue(
start_position);
}
std::unique_ptr<CompilerDispatcherJob> job(new UnoptimizedCompileJob(
std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
tracer_.get(), max_stack_size_, source, start_position, end_position,
language_mode, function_literal_id, native, module, is_named_expression,
isolate_->heap()->HashSeed(), isolate_->allocator(), compiler_hints,
......@@ -293,7 +318,7 @@ bool CompilerDispatcher::EnqueueAndStep(Handle<SharedFunctionInfo> function) {
PrintF(" for parse and compile\n");
}
std::unique_ptr<CompilerDispatcherJob> job(new UnoptimizedCompileJob(
std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
isolate_, tracer_.get(), function, max_stack_size_));
EnqueueAndStep(std::move(job));
return true;
......@@ -314,7 +339,7 @@ bool CompilerDispatcher::Enqueue(
PrintF(" for compile\n");
}
std::unique_ptr<CompilerDispatcherJob> job(new UnoptimizedCompileJob(
std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
isolate_, tracer_.get(), script, function, literal, outer_parse_info,
compile_handles, max_stack_size_));
Enqueue(std::move(job));
......@@ -336,7 +361,7 @@ bool CompilerDispatcher::EnqueueAndStep(
PrintF(" for compile\n");
}
std::unique_ptr<CompilerDispatcherJob> job(new UnoptimizedCompileJob(
std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
isolate_, tracer_.get(), script, function, literal, outer_parse_info,
compile_handles, max_stack_size_));
EnqueueAndStep(std::move(job));
......@@ -435,7 +460,7 @@ void CompilerDispatcher::AbortAll(BlockingBehavior blocking) {
it.second->ResetOnMainThread();
}
jobs_.clear();
shared_to_unoptimized_job_id_.Clear();
shared_to_job_id_.Clear();
{
base::LockGuard<base::Mutex> lock(&mutex_);
DCHECK(pending_background_jobs_.empty());
......@@ -521,12 +546,11 @@ void CompilerDispatcher::MemoryPressureNotification(
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor(
Handle<SharedFunctionInfo> shared) const {
JobId* job_id_ptr = shared_to_unoptimized_job_id_.Find(shared);
JobId* job_id_ptr = shared_to_job_id_.Find(shared);
JobMap::const_iterator job = jobs_.end();
if (job_id_ptr) {
job = jobs_.find(*job_id_ptr);
DCHECK(job == jobs_.end() ||
job->second->AsUnoptimizedCompileJob()->IsAssociatedWith(shared));
DCHECK(job == jobs_.end() || job->second->IsAssociatedWith(shared));
}
return job;
}
......@@ -727,51 +751,18 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveIfFinished(
return RemoveJob(job);
}
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::InsertJob(
std::unique_ptr<CompilerDispatcherJob> job) {
bool added;
JobMap::const_iterator it;
std::tie(it, added) =
jobs_.insert(std::make_pair(next_job_id_++, std::move(job)));
DCHECK(added);
JobId id = it->first;
CompilerDispatcherJob* inserted_job = it->second.get();
// Maps unoptimized jobs' SFIs to their job id.
if (inserted_job->type() == CompilerDispatcherJob::kUnoptimizedCompile) {
Handle<SharedFunctionInfo> shared =
inserted_job->AsUnoptimizedCompileJob()->shared();
if (!shared.is_null()) {
shared_to_unoptimized_job_id_.Set(shared, id);
}
}
return it;
}
CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveJob(
CompilerDispatcher::JobMap::const_iterator it) {
CompilerDispatcherJob* job = it->second.get();
job->ResetOnMainThread();
// Unmaps unoptimized jobs' SFIs to their job id.
if (job->type() == CompilerDispatcherJob::kUnoptimizedCompile) {
Handle<SharedFunctionInfo> shared =
job->AsUnoptimizedCompileJob()->shared();
if (!shared.is_null()) {
JobId deleted_id = shared_to_unoptimized_job_id_.Delete(shared);
USE(deleted_id);
DCHECK_EQ(it->first, deleted_id);
}
CompilerDispatcher::JobMap::const_iterator job) {
job->second->ResetOnMainThread();
if (!job->second->shared().is_null()) {
shared_to_job_id_.Delete(job->second->shared());
}
it = jobs_.erase(it);
job = jobs_.erase(job);
if (jobs_.empty()) {
base::LockGuard<base::Mutex> lock(&mutex_);
if (num_background_tasks_ == 0) abort_ = false;
}
return it;
return job;
}
} // namespace internal
......
......@@ -29,9 +29,8 @@ namespace internal {
class AstValueFactory;
class CancelableTaskManager;
class CompileJobFinishCallback;
class CompilerDispatcherJob;
class UnoptimizedCompileJob;
class UnoptimizedCompileJobFinishCallback;
class CompilerDispatcherTracer;
class DeferredHandles;
class FunctionLiteral;
......@@ -89,8 +88,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
bool Enqueue(Handle<String> source, int start_pos, int end_position,
LanguageMode language_mode, int function_literal_id, bool native,
bool module, bool is_named_expression, int compiler_hints,
UnoptimizedCompileJobFinishCallback* finish_callback,
JobId* job_id);
CompileJobFinishCallback* finish_callback, JobId* job_id);
// Like Enqueue, but also advances the job so that it can potentially
// continue running on a background thread (if at all possible). Returns
......@@ -169,8 +167,6 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
JobId EnqueueAndStep(std::unique_ptr<CompilerDispatcherJob> job);
// Returns job if not removed otherwise iterator following the removed job.
JobMap::const_iterator RemoveIfFinished(JobMap::const_iterator job);
// Returns iterator to the inserted job.
JobMap::const_iterator InsertJob(std::unique_ptr<CompilerDispatcherJob> job);
// Returns iterator following the removed job.
JobMap::const_iterator RemoveJob(JobMap::const_iterator job);
bool FinishNow(CompilerDispatcherJob* job);
......@@ -192,9 +188,8 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
// Mapping from job_id to job.
JobMap jobs_;
// Mapping from SharedFunctionInfo to the corresponding unoptimized
// compilation's JobId;
SharedToJobIdMap shared_to_unoptimized_job_id_;
// Mapping from SharedFunctionInfo to corresponding JobId;
SharedToJobIdMap shared_to_job_id_;
base::AtomicValue<v8::MemoryPressureLevel> memory_pressure_level_;
......
This diff is collapsed.
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_DISPATCHER_UNOPTIMIZED_COMPILE_JOB_H_
#define V8_COMPILER_DISPATCHER_UNOPTIMIZED_COMPILE_JOB_H_
#include <memory>
#include "include/v8.h"
#include "src/base/macros.h"
#include "src/compiler-dispatcher/compiler-dispatcher-job.h"
#include "src/globals.h"
namespace v8 {
namespace internal {
class AstValueFactory;
class AstStringConstants;
class CompilerDispatcherTracer;
class CompilationInfo;
class CompilationJob;
class DeferredHandles;
class FunctionLiteral;
class Isolate;
class ParseInfo;
class Parser;
class SharedFunctionInfo;
class String;
class UnicodeCache;
class Utf16CharacterStream;
class V8_EXPORT_PRIVATE UnoptimizedCompileJobFinishCallback {
public:
virtual ~UnoptimizedCompileJobFinishCallback() {}
virtual void ParseFinished(std::unique_ptr<ParseInfo> parse_info) = 0;
};
class V8_EXPORT_PRIVATE UnoptimizedCompileJob : public CompilerDispatcherJob {
public:
enum class Status {
kInitial,
kReadyToParse,
kParsed,
kReadyToAnalyze,
kAnalyzed,
kReadyToCompile,
kCompiled,
kDone,
kFailed,
};
// Creates a UnoptimizedCompileJob in the initial state.
UnoptimizedCompileJob(Isolate* isolate, CompilerDispatcherTracer* tracer,
Handle<SharedFunctionInfo> shared,
size_t max_stack_size);
// TODO(wiktorg) document it better once I know how it relates to whole stuff
// Creates a UnoptimizedCompileJob in ready to parse top-level function state.
UnoptimizedCompileJob(CompilerDispatcherTracer* tracer, size_t max_stack_size,
Handle<String> source, int start_position,
int end_position, LanguageMode language_mode,
int function_literal_id, bool native, bool module,
bool is_named_expression, uint32_t hash_seed,
AccountingAllocator* zone_allocator, int compiler_hints,
const AstStringConstants* ast_string_constants,
UnoptimizedCompileJobFinishCallback* finish_callback);
// Creates a UnoptimizedCompileJob in the analyzed state.
UnoptimizedCompileJob(Isolate* isolate, CompilerDispatcherTracer* tracer,
Handle<Script> script,
Handle<SharedFunctionInfo> shared,
FunctionLiteral* literal, ParseInfo* outer_parse_info,
std::shared_ptr<DeferredHandles> compile_handles,
size_t max_stack_size);
~UnoptimizedCompileJob() override;
Type type() const override { return kUnoptimizedCompile; }
Handle<SharedFunctionInfo> shared() const { return shared_; }
// Returns true if this UnoptimizedCompileJob was created for the given
// function.
bool IsAssociatedWith(Handle<SharedFunctionInfo> shared) const;
bool IsFinished() override {
return status() == Status::kDone || status() == Status::kFailed;
}
bool IsFailed() override { return status() == Status::kFailed; }
// Return true if the next step can be run on any thread, that is when both
// StepNextOnMainThread and StepNextOnBackgroundThread could be used for the
// next step.
bool CanStepNextOnAnyThread() override {
return status() == Status::kReadyToParse ||
status() == Status::kReadyToCompile;
}
// Step the job forward by one state on the main thread.
void StepNextOnMainThread() override;
// Step the job forward by one state on a background thread.
void StepNextOnBackgroundThread() override;
// Transition from any state to kInitial and free all resources.
void ResetOnMainThread() override;
// Estimate how long the next step will take using the tracer.
double EstimateRuntimeOfNextStepInMs() const override;
// Even though the name does not imply this, ShortPrint() must only be invoked
// on the main thread.
void ShortPrint() override;
private:
friend class CompilerDispatcherTest;
friend class UnoptimizedCompileJobTest;
bool has_context() const { return !context_.is_null(); }
Context* context() { return *context_; }
Status status() const { return status_; }
Status status_;
Isolate* isolate_;
CompilerDispatcherTracer* tracer_;
Handle<Context> context_; // Global handle.
Handle<SharedFunctionInfo> shared_; // Global handle.
Handle<String> source_; // Global handle.
Handle<String> wrapper_; // Global handle.
std::unique_ptr<v8::String::ExternalStringResourceBase> source_wrapper_;
size_t max_stack_size_;
UnoptimizedCompileJobFinishCallback* finish_callback_ = nullptr;
// Members required for parsing.
std::unique_ptr<UnicodeCache> unicode_cache_;
std::unique_ptr<Utf16CharacterStream> character_stream_;
std::unique_ptr<ParseInfo> parse_info_;
std::unique_ptr<Parser> parser_;
// Members required for compiling.
std::shared_ptr<Zone> compile_zone_;
std::unique_ptr<CompilationInfo> compile_info_;
std::unique_ptr<CompilationJob> compile_job_;
bool trace_compiler_dispatcher_jobs_;
// Transition from kInitial to kReadyToParse.
void PrepareToParseOnMainThread();
// Transition from kReadyToParse to kParsed (or kDone if there is
// finish_callback).
void Parse();
// Transition from kParsed to kReadyToAnalyze (or kFailed).
void FinalizeParsingOnMainThread();
// Transition from kReadyToAnalyze to kAnalyzed (or kFailed).
void AnalyzeOnMainThread();
// Transition from kAnalyzed to kReadyToCompile (or kFailed).
void PrepareToCompileOnMainThread();
// Transition from kReadyToCompile to kCompiled.
void Compile();
// Transition from kCompiled to kDone (or kFailed).
void FinalizeCompilingOnMainThread();
DISALLOW_COPY_AND_ASSIGN(UnoptimizedCompileJob);
};
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_DISPATCHER_UNOPTIMIZED_COMPILE_JOB_H_
......@@ -10,7 +10,7 @@
#include <vector>
#include "include/v8.h"
#include "src/compiler-dispatcher/unoptimized-compile-job.h"
#include "src/compiler-dispatcher/compiler-dispatcher-job.h"
#include "src/globals.h"
#include "src/handles.h"
#include "src/parsing/preparsed-scope-data.h"
......@@ -35,7 +35,7 @@ class Utf16CharacterStream;
class Zone;
// A container for the inputs, configuration options, and outputs of parsing.
class V8_EXPORT_PRIVATE ParseInfo : public UnoptimizedCompileJobFinishCallback {
class V8_EXPORT_PRIVATE ParseInfo : public CompileJobFinishCallback {
public:
explicit ParseInfo(AccountingAllocator* zone_allocator);
ParseInfo(Handle<Script> script);
......
......@@ -894,8 +894,6 @@
'compiler-dispatcher/compiler-dispatcher-tracer.h',
'compiler-dispatcher/optimizing-compile-dispatcher.cc',
'compiler-dispatcher/optimizing-compile-dispatcher.h',
'compiler-dispatcher/unoptimized-compile-job.cc',
'compiler-dispatcher/unoptimized-compile-job.h',
'compiler.cc',
'compiler.h',
'contexts-inl.h',
......
......@@ -39,10 +39,10 @@ v8_executable("unittests") {
"base/utils/random-number-generator-unittest.cc",
"cancelable-tasks-unittest.cc",
"char-predicates-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-job-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-tracer-unittest.cc",
"compiler-dispatcher/compiler-dispatcher-unittest.cc",
"compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc",
"compiler-dispatcher/unoptimized-compile-job-unittest.cc",
"compiler/branch-elimination-unittest.cc",
"compiler/bytecode-analysis-unittest.cc",
"compiler/checkpoint-elimination-unittest.cc",
......
......@@ -40,7 +40,7 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource {
DISALLOW_COPY_AND_ASSIGN(ScriptResource);
};
class FinishCallback : public UnoptimizedCompileJobFinishCallback {
class FinishCallback : public CompileJobFinishCallback {
public:
void ParseFinished(std::unique_ptr<ParseInfo> result) override {
result_ = std::move(result);
......
......@@ -90,10 +90,10 @@
'compiler/typer-unittest.cc',
'compiler/value-numbering-reducer-unittest.cc',
'compiler/zone-stats-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-job-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-tracer-unittest.cc',
'compiler-dispatcher/compiler-dispatcher-unittest.cc',
'compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc',
'compiler-dispatcher/unoptimized-compile-job-unittest.cc',
'counters-unittest.cc',
'eh-frame-iterator-unittest.cc',
'eh-frame-writer-unittest.cc',
......
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