Commit 40fa77a8 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[wasm] Various small cleanups

Notably:
- As per convention, TrapIf/Unless should not return a control node.
- Wasm-gc pipeline should not depend on FLAG_wasm_inlining.

Change-Id: Ic593db1f979bec1cedfd9384b21487fc2763a35b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3771640Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81806}
parent a7329344
......@@ -2116,7 +2116,7 @@ struct WasmOptimizationPhase {
// then one around branch elimination. This is because those two
// optimizations sometimes display quadratic complexity when run together.
// We only need load elimination for managed objects.
if (FLAG_experimental_wasm_gc || FLAG_wasm_inlining) {
if (FLAG_experimental_wasm_gc) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead(),
......@@ -2136,10 +2136,8 @@ struct WasmOptimizationPhase {
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &value_numbering);
if (FLAG_experimental_wasm_gc) {
AddReducer(data, &graph_reducer, &load_elimination);
AddReducer(data, &graph_reducer, &escape);
}
AddReducer(data, &graph_reducer, &load_elimination);
AddReducer(data, &graph_reducer, &escape);
graph_reducer.ReduceGraph();
}
{
......
......@@ -1118,15 +1118,15 @@ TrapId WasmGraphBuilder::GetTrapIdForTrap(wasm::TrapReason reason) {
void WasmGraphBuilder::TrapIfTrue(wasm::TrapReason reason, Node* cond,
wasm::WasmCodePosition position) {
TrapId trap_id = GetTrapIdForTrap(reason);
Node* node = gasm_->TrapIf(cond, trap_id);
SetSourcePosition(node, position);
gasm_->TrapIf(cond, trap_id);
SetSourcePosition(control(), position);
}
void WasmGraphBuilder::TrapIfFalse(wasm::TrapReason reason, Node* cond,
wasm::WasmCodePosition position) {
TrapId trap_id = GetTrapIdForTrap(reason);
Node* node = gasm_->TrapUnless(cond, trap_id);
SetSourcePosition(node, position);
gasm_->TrapUnless(cond, trap_id);
SetSourcePosition(control(), position);
}
Node* WasmGraphBuilder::AssertNotNull(Node* object,
......
......@@ -11,7 +11,6 @@
#include "src/compiler/control-path-state.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/persistent-map.h"
#include "src/compiler/wasm-graph-assembler.h"
#include "src/wasm/wasm-subtyping.h"
......
......@@ -254,14 +254,14 @@ class WasmGraphAssembler : public GraphAssembler {
Node* HasInstanceType(Node* heap_object, InstanceType type);
Node* TrapIf(Node* condition, TrapId reason) {
return AddNode(graph()->NewNode(mcgraph()->common()->TrapIf(reason),
condition, effect(), control()));
void TrapIf(Node* condition, TrapId reason) {
AddNode(graph()->NewNode(mcgraph()->common()->TrapIf(reason), condition,
effect(), control()));
}
Node* TrapUnless(Node* condition, TrapId reason) {
return AddNode(graph()->NewNode(mcgraph()->common()->TrapUnless(reason),
condition, effect(), control()));
void TrapUnless(Node* condition, TrapId reason) {
AddNode(graph()->NewNode(mcgraph()->common()->TrapUnless(reason), condition,
effect(), control()));
}
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
......
......@@ -858,7 +858,7 @@ struct EncodeWtf8Immediate {
template <Decoder::ValidateFlag validate>
struct PcForErrors {
PcForErrors(const byte* /* pc */) {}
explicit PcForErrors(const byte* /* pc */) {}
const byte* pc() const { return nullptr; }
};
......@@ -867,7 +867,7 @@ template <>
struct PcForErrors<Decoder::kFullValidation> {
const byte* pc_for_errors = nullptr;
PcForErrors(const byte* pc) : pc_for_errors(pc) {}
explicit PcForErrors(const byte* pc) : pc_for_errors(pc) {}
const byte* pc() const { return pc_for_errors; }
};
......
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