Commit d696c37d authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Split decoder functions

Instead of having one method with a big switch, and specializing that
method for each single opcode, we now have one proper method per opcode.
This makes the code way more readable, and also reduces the compile time
of liftoff-compiler.cc significantly.

Unfortunately, we cannot use template specializations for this, since
GCC does not support specializing the methods within an unspecialized
templated class.
Hence, we need to have another dispatch per opcode when generating the
opcode handler table. I left a comment explaining why we do it this way.
The upside of this is that we get nicer method names.

R=thibaudm@chromium.org

Bug: v8:10576
Change-Id: I8c7026177490893711c999217eeb1e4f2fbb5e36
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2282533
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68732}
parent 6023de85
......@@ -23,12 +23,6 @@ constexpr inline auto make_array_helper(Function f,
return {{f(Indexes)...}};
}
template <template <size_t> class Value, std::size_t... Indexes>
constexpr inline auto make_array_helper(std::index_sequence<Indexes...>)
-> std::array<typename Value<0>::value_type, sizeof...(Indexes)> {
return {{Value<Indexes>()...}};
}
} // namespace detail
// base::make_array: Create an array of fixed length, initialized by a function.
......@@ -42,13 +36,6 @@ constexpr auto make_array(Function f) {
return detail::make_array_helper(f, std::make_index_sequence<Size>{});
}
// The same as above, but taking a template instead of a function to generate
// the values for the array.
template <std::size_t Size, template <size_t> class Value>
constexpr auto make_array() {
return detail::make_array_helper<Value>(std::make_index_sequence<Size>{});
}
// Helper to determine how to pass values: Pass scalars and arrays by value,
// others by const reference (even if it was a non-const ref before; this is
// disallowed by the style guide anyway).
......
This diff is collapsed.
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