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

[turbofan] Unroll loops calling kWasmStackGuard

Loops with function calls are not unrolled. This should not include
calls to kWasmStackGuard, which exist in many loops.

Bug: v8:11298, v8:12047, chromium:1238752
Change-Id: I62a17e708eaca9872f8244175be80ba22a68454c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3090338
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76278}
parent d8dc66f9
......@@ -5,12 +5,17 @@
#include "src/compiler/loop-analysis.h"
#include "src/codegen/tick-counter.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/graph.h"
#include "src/compiler/node-marker.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/zone/zone.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/wasm-code-manager.h"
#endif
namespace v8 {
namespace internal {
......@@ -581,12 +586,24 @@ ZoneUnorderedSet<Node*>* LoopFinder::FindSmallUnnestedLoopFromHeader(
loop_header);
// All uses are outside the loop, do nothing.
break;
case IrOpcode::kCall:
case IrOpcode::kTailCall:
case IrOpcode::kJSWasmCall:
case IrOpcode::kJSCall:
// Call nodes are considered to have unbounded size, i.e. >max_size.
// An exception is the call to the stack guard builtin at the beginning
// of many loops.
return nullptr;
case IrOpcode::kCall: {
Node* callee = node->InputAt(0);
if (callee->opcode() == IrOpcode::kRelocatableInt32Constant ||
callee->opcode() == IrOpcode::kRelocatableInt64Constant) {
auto info = OpParameter<RelocatablePtrConstantInfo>(callee->op());
if (info.value() != v8::internal::wasm::WasmCode::kWasmStackGuard) {
return nullptr;
}
}
V8_FALLTHROUGH;
}
default:
for (Node* use : node->uses()) {
if (visited->count(use) == 0) queue.push_back(use);
......
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