[wasm] Remove redundant tiering_completed_ flag

The flag was only there to tell whether the {AsyncCompileJob} needs to
be kept alive. We already have this information in all the other fields
of the {AsyncCompileJob}, thus remove it.

R=ahaas@chromium.org

Bug: v8:8238
Change-Id: I8d1d76ba8d622d1816c240e7a824ecf31c3b1ce5
Reviewed-on: https://chromium-review.googlesource.com/c/1297957
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56977}
This commit is contained in:
Clemens Hammacher 2018-10-25 11:26:45 +02:00 committed by Commit Bot
parent 3767ab39e1
commit 51a931949e
2 changed files with 6 additions and 17 deletions

View File

@ -117,6 +117,8 @@ class CompilationState {
return baseline_compilation_finished_;
}
bool has_outstanding_units() const { return outstanding_units_ > 0; }
WasmEngine* wasm_engine() const { return wasm_engine_; }
CompileMode compile_mode() const { return compile_mode_; }
WasmFeatures* detected_features() { return &detected_features_; }
@ -2504,9 +2506,6 @@ class AsyncCompileJob::PrepareAndStartCompile : public CompileStep {
module->functions.size() - module->num_imported_functions;
if (num_functions == 0) {
// Tiering has nothing to do if module is empty.
job_->tiering_completed_ = true;
// Degenerate case of an empty module.
job_->FinishCompile(true);
return;
@ -2538,12 +2537,10 @@ class AsyncCompileJob::PrepareAndStartCompile : public CompileStep {
}
// If a foreground task or a finisher is pending, we rely on
// FinishModule to remove the job.
if (job->pending_foreground_task_ ||
job->outstanding_finishers_.load() > 0) {
job->tiering_completed_ = true;
return;
if (!job->pending_foreground_task_ &&
job->outstanding_finishers_.load() == 0) {
job->isolate_->wasm_engine()->RemoveCompileJob(job);
}
job->isolate_->wasm_engine()->RemoveCompileJob(job);
return;
case CompilationEvent::kFailedCompilation: {
// Tier-up compilation should not fail if baseline compilation
@ -2630,12 +2627,9 @@ class AsyncCompileJob::FinishModule : public CompileStep {
job_->isolate_->wasm_engine()->RemoveCompileJob(job_);
return;
}
// If background tiering compilation finished before we resolved the
// promise, switch to patching now. Otherwise, patching will be scheduled
// by a callback.
DCHECK_EQ(CompileMode::kTiering,
job_->native_module_->compilation_state()->compile_mode());
if (job_->tiering_completed_) {
if (!job_->native_module_->compilation_state()->has_outstanding_units()) {
job_->isolate_->wasm_engine()->RemoveCompileJob(job_);
}
}
@ -2830,9 +2824,6 @@ bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
job_->wire_bytes_ = ModuleWireBytes(owned_wire_bytes.as_vector());
job_->native_module_->set_wire_bytes(std::move(owned_wire_bytes));
// Job should now behave as if it's fully compiled.
job_->tiering_completed_ = true;
SaveContext saved_context(job_->isolate_);
job_->isolate_->set_context(*job_->native_context_);
job_->FinishCompile(false);

View File

@ -173,8 +173,6 @@ class AsyncCompileJob {
// compilation. The AsyncCompileJob does not actively use the
// StreamingDecoder.
std::shared_ptr<StreamingDecoder> stream_;
bool tiering_completed_ = false;
};
} // namespace wasm
} // namespace internal