Commit a01508e2 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Remove hack around named constructors

Avoid named constructors for Value and Control and the hack to also have
them on subclasses.
Instead, add a new template type and a constructor to create the subtype
from this template. Instead of the named constructors on the subtype,
we now create a template and initialize the subtype from the template.

R=herhut@chromium.org

Bug: v8:8562
Change-Id: I374fc4104ab1ae5769c587bdf5a4ca7f9a0a10d7
Reviewed-on: https://chromium-review.googlesource.com/c/1382454Reviewed-by: 's avatarStephan Herhut <herhut@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58408}
parent d045f666
......@@ -128,12 +128,16 @@ class LiftoffCompiler {
LiftoffAssembler::CacheState state;
};
struct Control : public ControlWithNamedConstructors<Control, Value> {
MOVE_ONLY_WITH_DEFAULT_CONSTRUCTORS(Control);
struct Control : public ControlBase<Value> {
std::unique_ptr<ElseState> else_state;
LiftoffAssembler::CacheState label_state;
MovableLabel label;
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(Control);
template <typename... Args>
explicit Control(Args&&... args) V8_NOEXCEPT
: ControlBase(std::forward<Args>(args)...) {}
};
using FullDecoder = WasmFullDecoder<validate, LiftoffCompiler>;
......
This diff is collapsed.
......@@ -70,8 +70,12 @@ class WasmGraphBuildingInterface {
static constexpr Decoder::ValidateFlag validate = Decoder::kValidate;
using FullDecoder = WasmFullDecoder<validate, WasmGraphBuildingInterface>;
struct Value : public ValueWithNamedConstructors<Value> {
TFNode* node;
struct Value : public ValueBase {
TFNode* node = nullptr;
template <typename... Args>
explicit Value(Args&&... args) V8_NOEXCEPT
: ValueBase(std::forward<Args>(args)...) {}
};
struct TryInfo : public ZoneObject {
......@@ -80,14 +84,22 @@ class WasmGraphBuildingInterface {
bool might_throw() const { return exception != nullptr; }
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(TryInfo);
explicit TryInfo(SsaEnv* c) : catch_env(c) {}
};
struct Control : public ControlWithNamedConstructors<Control, Value> {
SsaEnv* end_env; // end environment for the construct.
SsaEnv* false_env; // false environment (only for if).
TryInfo* try_info; // information used for compiling try statements.
int32_t previous_catch; // previous Control (on the stack) with a catch.
struct Control : public ControlBase<Value> {
SsaEnv* end_env = nullptr; // end environment for the construct.
SsaEnv* false_env = nullptr; // false environment (only for if).
TryInfo* try_info = nullptr; // information about try statements.
int32_t previous_catch = -1; // previous Control with a catch.
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(Control);
template <typename... Args>
explicit Control(Args&&... args) V8_NOEXCEPT
: ControlBase(std::forward<Args>(args)...) {}
};
explicit WasmGraphBuildingInterface(compiler::WasmGraphBuilder* builder)
......
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