[wasm] [cleanup] Remove unused DecodeStruct type

It was used before as a placeholder in Result<DecodeStruct*> to
communicate that no value was returned. We actually only created a
Results holding {nullptr} when returning such values. Thus, the whole
struct is not needed, and we return Result<nullptr_t> instead, which
clearly communicates that this result does not hold any value.

An alternative would be to use Result<void>, but this would require
partial specialization of the Result template, which would be overkill
here.

R=ahaas@chromium.org

Change-Id: Ib07d2c4fe716c735839675d11146c47f97997d40
Reviewed-on: https://chromium-review.googlesource.com/509551
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45464}
This commit is contained in:
Clemens Hammacher 2017-05-22 11:44:02 +02:00 committed by Commit Bot
parent 0819f4c289
commit c30cbb17c7
2 changed files with 7 additions and 9 deletions

View File

@ -2130,7 +2130,7 @@ DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
Zone zone(allocator, ZONE_NAME);
WasmFullDecoder decoder(&zone, module, body);
decoder.Decode();
return decoder.toResult<DecodeStruct*>(nullptr);
return decoder.toResult(nullptr);
}
DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder,
@ -2138,7 +2138,7 @@ DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder,
Zone zone(allocator, ZONE_NAME);
WasmFullDecoder decoder(&zone, builder, body);
decoder.Decode();
return decoder.toResult<DecodeStruct*>(nullptr);
return decoder.toResult(nullptr);
}
unsigned OpcodeLength(const byte* pc, const byte* end) {

View File

@ -42,13 +42,11 @@ static inline FunctionBody FunctionBodyForTesting(const byte* start,
return {nullptr, start, start, end};
}
struct DecodeStruct {
int unused;
};
typedef Result<DecodeStruct*> DecodeResult;
inline std::ostream& operator<<(std::ostream& os, const DecodeStruct& tree) {
return os;
}
// A {DecodeResult} only stores the failure / success status, but no data. Thus
// we use {nullptr_t} as data value, such that the only valid data stored in
// this type is a nullptr.
// Storing {void} would require template specialization.
using DecodeResult = Result<std::nullptr_t>;
V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
const wasm::WasmModule* module,