[wasm] Validate sequentially in --single-threaded mode
Do not post a task if --single-threaded is enabled. Instead, execute the task synchronously. R=ahaas@chromium.org Bug: v8:13447 Change-Id: I853125325953a750cb32984db449b3e07ccc4dce Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4026342 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#84251}
This commit is contained in:
parent
1aa2263d69
commit
d7b4e86f9e
@ -1622,13 +1622,32 @@ class ModuleDecoderTemplate : public Decoder {
|
|||||||
void ValidateAllFunctions() {
|
void ValidateAllFunctions() {
|
||||||
DCHECK(ok());
|
DCHECK(ok());
|
||||||
|
|
||||||
// Spawn a {ValidateFunctionsTask} and join it. The earliest error found
|
class NeverYieldDelegate final : public JobDelegate {
|
||||||
// will be set on this decoder.
|
public:
|
||||||
std::unique_ptr<JobHandle> job_handle = V8::GetCurrentPlatform()->CreateJob(
|
bool ShouldYield() override { return false; }
|
||||||
TaskPriority::kUserVisible,
|
|
||||||
std::make_unique<ValidateFunctionsTask>(this));
|
bool IsJoiningThread() const override { UNIMPLEMENTED(); }
|
||||||
|
void NotifyConcurrencyIncrease() override { UNIMPLEMENTED(); }
|
||||||
|
uint8_t GetTaskId() override { UNIMPLEMENTED(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a {ValidateFunctionsTask} to validate all functions. The earliest
|
||||||
|
// error found will be set on this decoder.
|
||||||
|
std::unique_ptr<JobTask> validate_job =
|
||||||
|
std::make_unique<ValidateFunctionsTask>(this);
|
||||||
|
|
||||||
|
if (v8_flags.single_threaded) {
|
||||||
|
// In single-threaded mode, run the {ValidateFunctionsTask} synchronously.
|
||||||
|
NeverYieldDelegate delegate;
|
||||||
|
validate_job->Run(&delegate);
|
||||||
|
} else {
|
||||||
|
// Spawn the task and join it.
|
||||||
|
std::unique_ptr<JobHandle> job_handle =
|
||||||
|
V8::GetCurrentPlatform()->CreateJob(TaskPriority::kUserVisible,
|
||||||
|
std::move(validate_job));
|
||||||
job_handle->Join();
|
job_handle->Join();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Decodes an entire module.
|
// Decodes an entire module.
|
||||||
ModuleResult DecodeModule(Counters* counters, AccountingAllocator* allocator,
|
ModuleResult DecodeModule(Counters* counters, AccountingAllocator* allocator,
|
||||||
|
Loading…
Reference in New Issue
Block a user