diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-11-09 12:12:17 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-11-11 20:04:40 +0100 |
commit | f0f1a28c075d30b1621ec1cbb65623d3b4641eeb (patch) | |
tree | bcfaae7c6212aae42e42bcb5a42fce2112bafbb6 /deps/v8/src | |
parent | e83d7e8d88e48cb17a6517f0a85d6bc1480c9f3f (diff) | |
download | android-node-v8-f0f1a28c075d30b1621ec1cbb65623d3b4641eeb.tar.gz android-node-v8-f0f1a28c075d30b1621ec1cbb65623d3b4641eeb.tar.bz2 android-node-v8-f0f1a28c075d30b1621ec1cbb65623d3b4641eeb.zip |
deps: patch V8 to 7.0.276.38
Refs: https://github.com/v8/v8/compare/7.0.276.36...7.0.276.38
PR-URL: https://github.com/nodejs/node/pull/24271
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/v8/src')
-rw-r--r-- | deps/v8/src/wasm/module-compiler.cc | 58 | ||||
-rw-r--r-- | deps/v8/src/wasm/module-compiler.h | 4 |
2 files changed, 36 insertions, 26 deletions
diff --git a/deps/v8/src/wasm/module-compiler.cc b/deps/v8/src/wasm/module-compiler.cc index b950c590b5..892a4e980e 100644 --- a/deps/v8/src/wasm/module-compiler.cc +++ b/deps/v8/src/wasm/module-compiler.cc @@ -2329,12 +2329,6 @@ void AsyncCompileJob::CancelPendingForegroundTask() { pending_foreground_task_ = nullptr; } -template <typename Step, typename... Args> -void AsyncCompileJob::DoSync(Args&&... args) { - NextStep<Step>(std::forward<Args>(args)...); - StartForegroundTask(); -} - void AsyncCompileJob::StartBackgroundTask() { auto task = base::make_unique<CompileTask>(this, false); @@ -2348,6 +2342,18 @@ void AsyncCompileJob::StartBackgroundTask() { } template <typename Step, typename... Args> +void AsyncCompileJob::DoSync(Args&&... args) { + NextStep<Step>(std::forward<Args>(args)...); + StartForegroundTask(); +} + +template <typename Step, typename... Args> +void AsyncCompileJob::DoImmediately(Args&&... args) { + NextStep<Step>(std::forward<Args>(args)...); + ExecuteForegroundTaskImmediately(); +} + +template <typename Step, typename... Args> void AsyncCompileJob::DoAsync(Args&&... args) { NextStep<Step>(std::forward<Args>(args)...); StartBackgroundTask(); @@ -2686,11 +2692,10 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(size_t functions_count, FinishAsyncCompileJobWithError(decoder_.FinishDecoding(false)); return false; } - job_->NextStep<AsyncCompileJob::PrepareAndStartCompile>( - decoder_.shared_module(), false); // Execute the PrepareAndStartCompile step immediately and not in a separate // task. - job_->ExecuteForegroundTaskImmediately(); + job_->DoImmediately<AsyncCompileJob::PrepareAndStartCompile>( + decoder_.shared_module(), false); job_->native_module_->compilation_state()->SetNumberOfFunctionsToCompile( functions_count); @@ -2734,25 +2739,26 @@ void AsyncStreamingProcessor::OnFinishedChunk() { // Finish the processing of the stream. void AsyncStreamingProcessor::OnFinishedStream(OwnedVector<uint8_t> bytes) { TRACE_STREAMING("Finish stream...\n"); - if (job_->native_module_) { - job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector()); - job_->native_module_->set_wire_bytes(std::move(bytes)); - } ModuleResult result = decoder_.FinishDecoding(false); DCHECK(result.ok()); - if (job_->DecrementAndCheckFinisherCount()) { - if (job_->native_module_ == nullptr) { - // We are processing a WebAssembly module without code section. We need to - // prepare compilation first before we can finish it. - // {PrepareAndStartCompile} will call {FinishCompile} by itself if there - // is no code section. - job_->DoSync<AsyncCompileJob::PrepareAndStartCompile>(result.val, true); - } else { - HandleScope scope(job_->isolate_); - SaveContext saved_context(job_->isolate_); - job_->isolate_->set_context(*job_->native_context_); - job_->FinishCompile(); - } + bool needs_finish = job_->DecrementAndCheckFinisherCount(); + if (job_->native_module_ == nullptr) { + // We are processing a WebAssembly module without code section. We need to + // prepare compilation first before we can finish it. + // {PrepareAndStartCompile} will call {FinishCompile} by itself if there + // is no code section. + DCHECK(needs_finish); + needs_finish = false; + job_->DoImmediately<AsyncCompileJob::PrepareAndStartCompile>(result.val, + true); + } + job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector()); + job_->native_module_->set_wire_bytes(std::move(bytes)); + if (needs_finish) { + HandleScope scope(job_->isolate_); + SaveContext saved_context(job_->isolate_); + job_->isolate_->set_context(*job_->native_context_); + job_->FinishCompile(); } } diff --git a/deps/v8/src/wasm/module-compiler.h b/deps/v8/src/wasm/module-compiler.h index 57bbd883e2..934c978d49 100644 --- a/deps/v8/src/wasm/module-compiler.h +++ b/deps/v8/src/wasm/module-compiler.h @@ -126,6 +126,10 @@ class AsyncCompileJob { template <typename Step, typename... Args> void DoSync(Args&&... args); + // Switches to the compilation step {Step} and immediately executes that step. + template <typename Step, typename... Args> + void DoImmediately(Args&&... args); + // Switches to the compilation step {Step} and starts a background task to // execute it. template <typename Step, typename... Args> |