Commit 2ac7ce42 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][cleanup] Add constructor for FunctionBody

Also, remove {FunctionBodyForTesting}, which is only being used once.
Use the constructor directly instead.

R=ahaas@chromium.org

Change-Id: Ieceac41bf62ec2accf1bb39d8334563557c0dbbd
Reviewed-on: https://chromium-review.googlesource.com/847514
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50397}
parent 3a201654
......@@ -879,7 +879,7 @@ std::pair<uint32_t, uint32_t> StackEffect(const WasmModule* module,
void PrintRawWasmCode(const byte* start, const byte* end) {
AccountingAllocator allocator;
PrintRawWasmCode(&allocator, FunctionBodyForTesting(start, end), nullptr);
PrintRawWasmCode(&allocator, FunctionBody{nullptr, 0, start, end}, nullptr);
}
namespace {
......
......@@ -34,12 +34,11 @@ struct FunctionBody {
uint32_t offset; // offset in the module bytes, for error reporting
const byte* start; // start of the function body
const byte* end; // end of the function body
};
static inline FunctionBody FunctionBodyForTesting(const byte* start,
const byte* end) {
return {nullptr, 0, start, end};
}
FunctionBody(FunctionSig* sig, uint32_t offset, const byte* start,
const byte* end)
: sig(sig), offset(offset), start(start), end(end) {}
};
V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
const wasm::WasmModule* module,
......@@ -63,14 +62,14 @@ void PrintRawWasmCode(const byte* start, const byte* end);
inline DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
const WasmModule* module, FunctionSig* sig,
const byte* start, const byte* end) {
FunctionBody body = {sig, 0, start, end};
FunctionBody body(sig, 0, start, end);
return VerifyWasmCode(allocator, module, body);
}
inline DecodeResult BuildTFGraph(AccountingAllocator* allocator,
TFBuilder* builder, FunctionSig* sig,
const byte* start, const byte* end) {
FunctionBody body = {sig, 0, start, end};
FunctionBody body(sig, 0, start, end);
return BuildTFGraph(allocator, builder, body);
}
......
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