Commit 3c99ee28 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Revert "[wasm] Inline CompileFailed step"

This reverts commit 556ef4c3.

Reason for revert: Seems to cause hangs in tests.

Original change's description:
> [wasm] Inline CompileFailed step
> 
> The {CompileFailed} just calls {AsyncCompileFailed}, which also does
> not do much. Thus just inline directly call a function instead of
> spawning a foreground task. This saves one instance of DeferredHandles.
> 
> R=​ahaas@chromium.org
> 
> Bug: v8:7921, v8:8423
> Change-Id: Ia8fb72a3ce2efd1f9a069c1a3b0b670b15fd8bce
> Reviewed-on: https://chromium-review.googlesource.com/c/1402714
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58662}

TBR=ahaas@chromium.org,clemensh@chromium.org

Change-Id: I3430fb304b8df72b93330d104c09b0a144bbd069
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7921, v8:8423
Reviewed-on: https://chromium-review.googlesource.com/c/1402786Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58663}
parent 556ef4c3
......@@ -2557,7 +2557,7 @@ void AsyncCompileJob::FinishCompile() {
}
}
void AsyncCompileJob::CompileFailed(Handle<Object> error_reason) {
void AsyncCompileJob::AsyncCompileFailed(Handle<Object> error_reason) {
// {job} keeps the {this} pointer alive.
std::shared_ptr<AsyncCompileJob> job =
isolate_->wasm_engine()->RemoveCompileJob(this);
......@@ -2606,7 +2606,12 @@ class AsyncCompileJob::CompilationStateCallback {
ErrorThrower thrower(job_->isolate(), "AsyncCompilation");
thrower.CompileFailed(*error_result);
Handle<Object> error = thrower.Reify();
job_->CompileFailed(error);
DeferredHandleScope deferred(job_->isolate());
error = handle(*error, job_->isolate());
job_->deferred_handles_.push_back(deferred.Detach());
job_->DoSync<CompileFailed, kUseExistingForegroundTask>(error);
}
break;
......@@ -2795,7 +2800,7 @@ class AsyncCompileJob::DecodeFail : public CompileStep {
ErrorThrower thrower(job->isolate_, "AsyncCompile");
thrower.CompileFailed("Wasm decoding failed", result_);
// {job_} is deleted in AsyncCompileFailed, therefore the {return}.
return job->CompileFailed(thrower.Reify());
return job->AsyncCompileFailed(thrower.Reify());
}
};
......@@ -2848,6 +2853,23 @@ class AsyncCompileJob::PrepareAndStartCompile : public CompileStep {
}
};
//==========================================================================
// Step 4b (sync): Compilation failed. Reject Promise.
//==========================================================================
class AsyncCompileJob::CompileFailed : public CompileStep {
public:
explicit CompileFailed(Handle<Object> error_reason)
: error_reason_(error_reason) {}
void RunInForeground(AsyncCompileJob* job) override {
TRACE_COMPILE("(4b) Compilation Failed...\n");
return job->AsyncCompileFailed(error_reason_);
}
private:
Handle<Object> error_reason_;
};
//==========================================================================
// Step 5 (sync): Compile JS->wasm wrappers.
//==========================================================================
......
......@@ -92,6 +92,7 @@ class AsyncCompileJob {
class DecodeModule; // Step 1 (async)
class DecodeFail; // Step 1b (sync)
class PrepareAndStartCompile; // Step 2 (sync)
class CompileFailed; // Step 4b (sync)
class CompileWrappers; // Step 5 (sync)
class FinishModule; // Step 6 (sync)
......@@ -109,7 +110,7 @@ class AsyncCompileJob {
void FinishCompile();
void CompileFailed(Handle<Object> error_reason);
void AsyncCompileFailed(Handle<Object> error_reason);
void AsyncCompileSucceeded(Handle<WasmModuleObject> result);
......
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