[wasm] Mark stack check call operator as kNoWrite

So that it doesn't cause loops to think that they have side effects,
which would impede load elimination and similar optimizations.
For compiling JavaScript, there is an equivalent annotation
in JSOperatorBuilder::StackCheck.

Change-Id: Ic9380df424062deb565671c8650b46550621fce5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3440662
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78994}
This commit is contained in:
Jakob Kummerow 2022-02-08 12:29:39 +01:00 committed by V8 LUCI CQ
parent 52c539e37c
commit dfecb7bddb

View File

@ -747,12 +747,18 @@ void WasmGraphBuilder::StackCheck(
stack_check_code_node_.set(mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmStackGuard, RelocInfo::WASM_STUB_CALL));
constexpr Operator::Properties properties =
Operator::kNoThrow | Operator::kNoWrite;
// If we ever want to mark this call as kNoDeopt, we'll have to make it
// non-eliminatable some other way.
STATIC_ASSERT((properties & Operator::kEliminatable) !=
Operator::kEliminatable);
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), // zone
NoContextDescriptor{}, // descriptor
0, // stack parameter count
CallDescriptor::kNoFlags, // flags
Operator::kNoThrow, // properties
properties, // properties
StubCallMode::kCallWasmRuntimeStub); // stub call mode
stack_check_call_operator_ = mcgraph()->common()->Call(call_descriptor);
}