Commit 5405bbc5 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove dead methods from wasm-compiler.{h,cc}

This removes dead methods from wasm-compiler.h and wasm-compiler.cc.
Even though e.g. {BranchExpectTrue} could become useful again in the
future, we still have {BranchExpectFalse} as a template to easily add it
back, and for now it's just untested code which adds to the compile time
and maintenance cost.

R=manoskouk@chromium.org

Bug: v8:10949
Change-Id: Ia3918c4cdfedd2c56bfbfbe7173d11386b9f2499
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2544522Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71293}
parent 4aa6c1b8
......@@ -381,8 +381,6 @@ WasmGraphBuilder::WasmGraphBuilder(
// available.
WasmGraphBuilder::~WasmGraphBuilder() = default;
Node* WasmGraphBuilder::Error() { return mcgraph()->Dead(); }
Node* WasmGraphBuilder::Start(unsigned params) {
Node* start = graph()->NewNode(mcgraph()->common()->Start(params));
graph()->SetStart(start);
......@@ -1176,12 +1174,6 @@ Node* WasmGraphBuilder::BranchNoHint(Node* cond, Node** true_node,
BranchHint::kNone);
}
Node* WasmGraphBuilder::BranchExpectTrue(Node* cond, Node** true_node,
Node** false_node) {
return Branch(mcgraph(), cond, true_node, false_node, control(),
BranchHint::kTrue);
}
Node* WasmGraphBuilder::BranchExpectFalse(Node* cond, Node** true_node,
Node** false_node) {
return Branch(mcgraph(), cond, true_node, false_node, control(),
......@@ -3852,34 +3844,6 @@ Node* WasmGraphBuilder::BoundsCheckMem(uint8_t access_size, Node* index,
return index;
}
Node* WasmGraphBuilder::BoundsCheckRange(Node* start, Node** size, Node* max,
wasm::WasmCodePosition position) {
auto m = mcgraph()->machine();
// The region we are trying to access is [start, start+size). If
// {start} > {max}, none of this region is valid, so we trap. Otherwise,
// there may be a subset of the region that is valid. {max - start} is the
// maximum valid size, so if {max - start < size}, then the region is
// partially out-of-bounds.
TrapIfTrue(wasm::kTrapMemOutOfBounds,
graph()->NewNode(m->Uint32LessThan(), max, start), position);
Node* sub = graph()->NewNode(m->Int32Sub(), max, start);
Node* fail = graph()->NewNode(m->Uint32LessThan(), sub, *size);
Diamond d(graph(), mcgraph()->common(), fail, BranchHint::kFalse);
d.Chain(control());
*size = d.Phi(MachineRepresentation::kWord32, sub, *size);
return fail;
}
Node* WasmGraphBuilder::BoundsCheckMemRange(Node** start, Node** size,
wasm::WasmCodePosition position) {
// TODO(binji): Support trap handler and no bounds check mode.
Node* fail =
BoundsCheckRange(*start, size, instance_cache_->mem_size, position);
*start = graph()->NewNode(mcgraph()->machine()->IntAdd(), MemBuffer(0),
Uint32ToUintptr(*start));
return fail;
}
const Operator* WasmGraphBuilder::GetSafeLoadOperator(int offset,
wasm::ValueType type) {
int alignment = offset % type.element_size_bytes();
......
......@@ -192,7 +192,6 @@ class WasmGraphBuilder {
//-----------------------------------------------------------------------
// Operations independent of {control} or {effect}.
//-----------------------------------------------------------------------
Node* Error();
Node* Start(unsigned params);
Node* Param(unsigned index);
Node* Loop(Node* entry);
......@@ -239,7 +238,6 @@ class WasmGraphBuilder {
// Operations that read and/or write {control} and {effect}.
//-----------------------------------------------------------------------
Node* BranchNoHint(Node* cond, Node** true_node, Node** false_node);
Node* BranchExpectTrue(Node* cond, Node** true_node, Node** false_node);
Node* BranchExpectFalse(Node* cond, Node** true_node, Node** false_node);
Node* TrapIfTrue(wasm::TrapReason reason, Node* cond,
......@@ -464,16 +462,6 @@ class WasmGraphBuilder {
// BoundsCheckMem receives a uint32 {index} node and returns a ptrsize index.
Node* BoundsCheckMem(uint8_t access_size, Node* index, uint64_t offset,
wasm::WasmCodePosition, EnforceBoundsCheck);
// Check that the range [start, start + size) is in the range [0, max).
// Also updates *size with the valid range. Returns true if the range is
// partially out-of-bounds, traps if it is completely out-of-bounds.
Node* BoundsCheckRange(Node* start, Node** size, Node* max,
wasm::WasmCodePosition);
// BoundsCheckMemRange receives a uint32 {start} and {size}, and checks if it
// is in bounds. Also updates *size with the valid range, and converts *start
// to a pointer into memory at that index. Returns true if the range is
// partially out-of-bounds, traps if it is completely out-of-bounds.
Node* BoundsCheckMemRange(Node** start, Node** size, wasm::WasmCodePosition);
Node* CheckBoundsAndAlignment(int8_t access_size, Node* index,
uint64_t offset, wasm::WasmCodePosition);
......
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