Commit ed27ae1b authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Use stub descriptor for stack check

The stack check builtin really has stub linkage, not wasm linkage. For
the stack check, it technically does not make a difference currently
since the stack check does not receive any arguments.

R=mstarzinger@chromium.org

Change-Id: Ia3e6ea192250dc3799c7a5166cf616f883c1f63f
Reviewed-on: https://chromium-review.googlesource.com/1107709Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53883}
parent 155c34d1
......@@ -264,8 +264,16 @@ void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position,
if (stack_check_call_operator_ == nullptr) {
// Build and cache the stack check call operator and the constant
// representing the stack check code.
wasm::FunctionSig dummy_sig(0, 0, nullptr);
auto call_descriptor = GetWasmCallDescriptor(mcgraph()->zone(), &dummy_sig);
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), // zone
WasmStackGuardDescriptor{}, // descriptor
0, // stack parameter count
CallDescriptor::kNoFlags, // flags
Operator::kNoProperties, // properties
MachineType::None(), // return type
0, // return count
Linkage::kNoContext, // context specification
StubCallMode::kCallWasmRuntimeStub); // stub call mode
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
stack_check_code_node_.set(mcgraph()->RelocatableIntPtrConstant(
......@@ -273,9 +281,9 @@ void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position,
stack_check_call_operator_ = mcgraph()->common()->Call(call_descriptor);
}
Node* call =
graph()->NewNode(stack_check_call_operator_, stack_check_code_node_.get(),
instance_node_.get(), *effect, stack_check.if_false);
Node* call = graph()->NewNode(stack_check_call_operator_.get(),
stack_check_code_node_.get(), *effect,
stack_check.if_false);
SetSourcePosition(call, position);
......
......@@ -350,7 +350,7 @@ class WasmGraphBuilder {
SetOncePointer<Node> globals_start_;
SetOncePointer<Node> imported_mutable_globals_;
SetOncePointer<Node> stack_check_code_node_;
const Operator* stack_check_call_operator_ = nullptr;
SetOncePointer<const Operator> stack_check_call_operator_;
Node** cur_buffer_;
size_t cur_bufsize_;
......
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