[wasm] Remove redundant subclass from ModuleDecoder
Bug: v8:7748 Change-Id: I45726b178760c63ef77fa9d1c9cffce35cc6b8d0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4194719 Auto-Submit: Matthias Liedtke <mliedtke@chromium.org> Reviewed-by: Manos Koukoutos <manoskouk@chromium.org> Commit-Queue: Manos Koukoutos <manoskouk@chromium.org> Cr-Commit-Position: refs/heads/main@{#85481}
This commit is contained in:
parent
8c8dfc75bb
commit
22bef706e1
@ -272,11 +272,11 @@ class WasmSectionIterator {
|
||||
};
|
||||
|
||||
// The main logic for decoding the bytes of a module.
|
||||
class ModuleDecoderBase : public Decoder {
|
||||
class ModuleDecoderImpl : public Decoder {
|
||||
public:
|
||||
ModuleDecoderBase(WasmFeatures enabled_features,
|
||||
ModuleDecoderImpl(WasmFeatures enabled_features,
|
||||
base::Vector<const uint8_t> wire_bytes, ModuleOrigin origin,
|
||||
ITracer* tracer)
|
||||
ITracer* tracer = ITracer::NoTrace)
|
||||
: Decoder(wire_bytes),
|
||||
enabled_features_(enabled_features),
|
||||
module_(std::make_shared<WasmModule>(origin)),
|
||||
@ -2392,12 +2392,12 @@ class ModuleDecoderBase : public Decoder {
|
||||
// We store next_ordered_section_ as uint8_t instead of SectionCode so that
|
||||
// we can increment it. This static_assert should make sure that SectionCode
|
||||
// does not get bigger than uint8_t accidentally.
|
||||
static_assert(sizeof(ModuleDecoderBase::next_ordered_section_) ==
|
||||
static_assert(sizeof(ModuleDecoderImpl::next_ordered_section_) ==
|
||||
sizeof(SectionCode),
|
||||
"type mismatch");
|
||||
uint32_t seen_unordered_sections_ = 0;
|
||||
static_assert(kBitsPerByte *
|
||||
sizeof(ModuleDecoderBase::seen_unordered_sections_) >
|
||||
sizeof(ModuleDecoderImpl::seen_unordered_sections_) >
|
||||
kLastKnownModuleSection,
|
||||
"not enough bits");
|
||||
AccountingAllocator allocator_;
|
||||
|
@ -69,17 +69,6 @@ const char* SectionName(SectionCode code) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(mliedtke): Convert ModuleDecoderBase to ModuleDecoder[Impl] and get rid
|
||||
// of this additional subclass. Then move the implementation from the impl
|
||||
// header to the cc as it isn't a template any more.
|
||||
class ModuleDecoderImpl : public ModuleDecoderBase {
|
||||
public:
|
||||
ModuleDecoderImpl(WasmFeatures enabled_features,
|
||||
base::Vector<const uint8_t> wire_bytes, ModuleOrigin origin)
|
||||
: ModuleDecoderBase(enabled_features, wire_bytes, origin,
|
||||
ITracer::NoTrace) {}
|
||||
};
|
||||
|
||||
ModuleResult DecodeWasmModule(
|
||||
WasmFeatures enabled_features, base::Vector<const uint8_t> wire_bytes,
|
||||
bool validate_functions, ModuleOrigin origin, Counters* counters,
|
||||
|
@ -583,7 +583,7 @@ class OffsetsProvider : public ITracer {
|
||||
element_offsets_.reserve(module->elem_segments.size());
|
||||
data_offsets_.reserve(module->data_segments.size());
|
||||
|
||||
ModuleDecoderBase decoder{WasmFeatures::All(), wire_bytes, kWasmOrigin,
|
||||
ModuleDecoderImpl decoder{WasmFeatures::All(), wire_bytes, kWasmOrigin,
|
||||
this};
|
||||
constexpr bool kNoVerifyFunctions = false;
|
||||
decoder.DecodeModule(kNoVerifyFunctions);
|
||||
|
@ -358,7 +358,7 @@ class ExtendedFunctionDis : public FunctionBodyDisassembler {
|
||||
// e.g.:
|
||||
// 0x01, 0x70, 0x00, // table count 1: funcref no maximum
|
||||
class HexDumpModuleDis;
|
||||
class DumpingModuleDecoder : public ModuleDecoderBase {
|
||||
class DumpingModuleDecoder : public ModuleDecoderImpl {
|
||||
public:
|
||||
DumpingModuleDecoder(ModuleWireBytes wire_bytes,
|
||||
HexDumpModuleDis* module_dis);
|
||||
@ -1054,7 +1054,7 @@ class FormatConverter {
|
||||
|
||||
DumpingModuleDecoder::DumpingModuleDecoder(ModuleWireBytes wire_bytes,
|
||||
HexDumpModuleDis* module_dis)
|
||||
: ModuleDecoderBase(WasmFeatures::All(), wire_bytes.module_bytes(),
|
||||
: ModuleDecoderImpl(WasmFeatures::All(), wire_bytes.module_bytes(),
|
||||
kWasmOrigin, module_dis) {}
|
||||
|
||||
} // namespace wasm
|
||||
|
Loading…
Reference in New Issue
Block a user