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 { ...@@ -2116,7 +2116,7 @@ struct WasmOptimizationPhase {
// then one around branch elimination. This is because those two // then one around branch elimination. This is because those two
// optimizations sometimes display quadratic complexity when run together. // optimizations sometimes display quadratic complexity when run together.
// We only need load elimination for managed objects. // 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(), GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(), data->broker(), &data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead(), data->jsgraph()->Dead(),
...@@ -2136,10 +2136,8 @@ struct WasmOptimizationPhase { ...@@ -2136,10 +2136,8 @@ struct WasmOptimizationPhase {
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &value_numbering); AddReducer(data, &graph_reducer, &value_numbering);
if (FLAG_experimental_wasm_gc) { AddReducer(data, &graph_reducer, &load_elimination);
AddReducer(data, &graph_reducer, &load_elimination); AddReducer(data, &graph_reducer, &escape);
AddReducer(data, &graph_reducer, &escape);
}
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
} }
{ {
......
...@@ -1118,15 +1118,15 @@ TrapId WasmGraphBuilder::GetTrapIdForTrap(wasm::TrapReason reason) { ...@@ -1118,15 +1118,15 @@ TrapId WasmGraphBuilder::GetTrapIdForTrap(wasm::TrapReason reason) {
void WasmGraphBuilder::TrapIfTrue(wasm::TrapReason reason, Node* cond, void WasmGraphBuilder::TrapIfTrue(wasm::TrapReason reason, Node* cond,
wasm::WasmCodePosition position) { wasm::WasmCodePosition position) {
TrapId trap_id = GetTrapIdForTrap(reason); TrapId trap_id = GetTrapIdForTrap(reason);
Node* node = gasm_->TrapIf(cond, trap_id); gasm_->TrapIf(cond, trap_id);
SetSourcePosition(node, position); SetSourcePosition(control(), position);
} }
void WasmGraphBuilder::TrapIfFalse(wasm::TrapReason reason, Node* cond, void WasmGraphBuilder::TrapIfFalse(wasm::TrapReason reason, Node* cond,
wasm::WasmCodePosition position) { wasm::WasmCodePosition position) {
TrapId trap_id = GetTrapIdForTrap(reason); TrapId trap_id = GetTrapIdForTrap(reason);
Node* node = gasm_->TrapUnless(cond, trap_id); gasm_->TrapUnless(cond, trap_id);
SetSourcePosition(node, position); SetSourcePosition(control(), position);
} }
Node* WasmGraphBuilder::AssertNotNull(Node* object, Node* WasmGraphBuilder::AssertNotNull(Node* object,
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "src/compiler/control-path-state.h" #include "src/compiler/control-path-state.h"
#include "src/compiler/graph-reducer.h" #include "src/compiler/graph-reducer.h"
#include "src/compiler/persistent-map.h"
#include "src/compiler/wasm-graph-assembler.h" #include "src/compiler/wasm-graph-assembler.h"
#include "src/wasm/wasm-subtyping.h" #include "src/wasm/wasm-subtyping.h"
......
...@@ -254,14 +254,14 @@ class WasmGraphAssembler : public GraphAssembler { ...@@ -254,14 +254,14 @@ class WasmGraphAssembler : public GraphAssembler {
Node* HasInstanceType(Node* heap_object, InstanceType type); Node* HasInstanceType(Node* heap_object, InstanceType type);
Node* TrapIf(Node* condition, TrapId reason) { void TrapIf(Node* condition, TrapId reason) {
return AddNode(graph()->NewNode(mcgraph()->common()->TrapIf(reason), AddNode(graph()->NewNode(mcgraph()->common()->TrapIf(reason), condition,
condition, effect(), control())); effect(), control()));
} }
Node* TrapUnless(Node* condition, TrapId reason) { void TrapUnless(Node* condition, TrapId reason) {
return AddNode(graph()->NewNode(mcgraph()->common()->TrapUnless(reason), AddNode(graph()->NewNode(mcgraph()->common()->TrapUnless(reason), condition,
condition, effect(), control())); effect(), control()));
} }
SimplifiedOperatorBuilder* simplified() { return &simplified_; } SimplifiedOperatorBuilder* simplified() { return &simplified_; }
......
...@@ -858,7 +858,7 @@ struct EncodeWtf8Immediate { ...@@ -858,7 +858,7 @@ struct EncodeWtf8Immediate {
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
struct PcForErrors { struct PcForErrors {
PcForErrors(const byte* /* pc */) {} explicit PcForErrors(const byte* /* pc */) {}
const byte* pc() const { return nullptr; } const byte* pc() const { return nullptr; }
}; };
...@@ -867,7 +867,7 @@ template <> ...@@ -867,7 +867,7 @@ template <>
struct PcForErrors<Decoder::kFullValidation> { struct PcForErrors<Decoder::kFullValidation> {
const byte* pc_for_errors = nullptr; 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; } 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