Commit 2ce2c9c7 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[compiler] Don't fallthrough liveness across Return/Throw

Return/Throw/Rethrow all unconditionally exit the bytecode, so the
bytecode liveness analysis shouldn't merge their next bytecode's
liveness into them.

Change-Id: I62f53d16f2763e12a702b8b40b2573c264488968
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3439915
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78951}
parent d3038386
......@@ -254,7 +254,9 @@ void UpdateOutLiveness(Bytecode bytecode, BytecodeLiveness& liveness,
// Update from next bytecode (unless there isn't one or this is an
// unconditional jump).
if (next_bytecode_in_liveness != nullptr &&
!Bytecodes::IsUnconditionalJump(bytecode)) {
!Bytecodes::IsUnconditionalJump(bytecode) &&
!Bytecodes::Returns(bytecode) &&
!Bytecodes::UnconditionallyThrows(bytecode)) {
if (IsFirstUpdate) {
// On first update, we can assume that this out-liveness is the same as
// the next liveness, and can directly alias it -- we'll allocate a new
......
......@@ -537,6 +537,10 @@ namespace interpreter {
V(Return) \
V(SuspendGenerator)
#define UNCONDITIONAL_THROW_BYTECODE_LIST(V) \
V(Throw) \
V(ReThrow)
// Enumeration of interpreter bytecodes.
enum class Bytecode : uint8_t {
#define DECLARE_BYTECODE(Name, ...) k##Name,
......@@ -801,6 +805,13 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
#undef OR_BYTECODE
}
// Returns true if the bytecode unconditionally throws.
static constexpr bool UnconditionallyThrows(Bytecode bytecode) {
#define OR_BYTECODE(NAME) || bytecode == Bytecode::k##NAME
return false UNCONDITIONAL_THROW_BYTECODE_LIST(OR_BYTECODE);
#undef OR_BYTECODE
}
// Returns the number of operands expected by |bytecode|.
static int NumberOfOperands(Bytecode bytecode) {
DCHECK_LE(bytecode, Bytecode::kLast);
......
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