Commit 7dbdb055 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Store and pass compilation units by value

Wasm compilation units got smaller and smaller with recent refactorings
(https://crrev.com/c/1587386, https://crrev.com/c/1587387,
https://crrev.com/c/1587388, plus previous CLs).
They now only store a function index and the requested compilation
tier. Hence there is no reason any more to heap-allocate them.
This CL changes the compilation unit queues and interfaces to store and
pass compilation units by value. Methods that could return an empty
{unique_ptr} before are now returning a {base::Optional}.

R=mstarzinger@chromium.org

Bug: v8:8343
Change-Id: I63037156b1a700095c13010450e5fedb51544401
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1588456
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61133}
parent de8aaef5
......@@ -123,8 +123,9 @@ class CompilationState {
V8_EXPORT_PRIVATE bool top_tier_compilation_finished() const;
private:
// NativeModule is allowed to call the static {New} method.
friend class NativeModule;
friend class WasmCompilationUnit;
CompilationState() = delete;
// The CompilationState keeps a {std::weak_ptr} back to the {NativeModule}
......
......@@ -76,12 +76,15 @@ class V8_EXPORT_PRIVATE WasmCompilationUnit final {
ExecutionTier);
private:
const int func_index_;
const ExecutionTier tier_;
DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
int func_index_;
ExecutionTier tier_;
};
// {WasmCompilationUnit} should be trivially copyable and small enough so we can
// efficiently pass it by value.
ASSERT_TRIVIALLY_COPYABLE(WasmCompilationUnit);
STATIC_ASSERT(sizeof(WasmCompilationUnit) <= 2 * kSystemPointerSize);
} // namespace wasm
} // namespace internal
} // namespace v8
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ V8_EXPORT_PRIVATE Handle<Script> CreateWasmScript(
// Triggered by the WasmCompileLazy builtin. The return value indicates whether
// compilation was successful. Lazy compilation can fail only if validation is
// also lazy.
bool CompileLazy(Isolate*, NativeModule*, uint32_t func_index);
bool CompileLazy(Isolate*, NativeModule*, int func_index);
// Encapsulates all the state and steps of an asynchronous compilation.
// An asynchronous compile job consists of a number of tasks that are executed
......
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