Commit f47a8a88 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[compiler] Optimize Instruction::IsTailCall

Moves the TailCall instruction codes to the start of the enum, and
changes the test for IsTailCall from 4 equality tests to a single
inequality.

Bug: v8:10051
Change-Id: I679d6377161bd4f9a05f6202763d52c0a67b7900
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1964075Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65440}
parent b577c1fe
...@@ -64,18 +64,21 @@ inline RecordWriteMode WriteBarrierKindToRecordWriteMode( ...@@ -64,18 +64,21 @@ inline RecordWriteMode WriteBarrierKindToRecordWriteMode(
// Target-specific opcodes that specify which assembly sequence to emit. // Target-specific opcodes that specify which assembly sequence to emit.
// Most opcodes specify a single instruction. // Most opcodes specify a single instruction.
#define COMMON_ARCH_OPCODE_LIST(V) \ #define COMMON_ARCH_OPCODE_LIST(V) \
V(ArchCallCodeObject) \ /* Tail call opcodes are grouped together to make IsTailCall fast */ \
V(ArchTailCallCodeObjectFromJSFunction) \ V(ArchTailCallCodeObjectFromJSFunction) \
V(ArchTailCallCodeObject) \ V(ArchTailCallCodeObject) \
V(ArchCallJSFunction) \
V(ArchTailCallAddress) \ V(ArchTailCallAddress) \
V(ArchTailCallWasm) \
/* Update IsTailCall if further TailCall opcodes are added */ \
\
V(ArchCallCodeObject) \
V(ArchCallJSFunction) \
V(ArchPrepareCallCFunction) \ V(ArchPrepareCallCFunction) \
V(ArchSaveCallerRegisters) \ V(ArchSaveCallerRegisters) \
V(ArchRestoreCallerRegisters) \ V(ArchRestoreCallerRegisters) \
V(ArchCallCFunction) \ V(ArchCallCFunction) \
V(ArchPrepareTailCall) \ V(ArchPrepareTailCall) \
V(ArchCallWasmFunction) \ V(ArchCallWasmFunction) \
V(ArchTailCallWasm) \
V(ArchCallBuiltinPointer) \ V(ArchCallBuiltinPointer) \
V(ArchJmp) \ V(ArchJmp) \
V(ArchBinarySearchSwitch) \ V(ArchBinarySearchSwitch) \
......
...@@ -861,10 +861,7 @@ class V8_EXPORT_PRIVATE Instruction final { ...@@ -861,10 +861,7 @@ class V8_EXPORT_PRIVATE Instruction final {
bool IsJump() const { return arch_opcode() == ArchOpcode::kArchJmp; } bool IsJump() const { return arch_opcode() == ArchOpcode::kArchJmp; }
bool IsRet() const { return arch_opcode() == ArchOpcode::kArchRet; } bool IsRet() const { return arch_opcode() == ArchOpcode::kArchRet; }
bool IsTailCall() const { bool IsTailCall() const {
return arch_opcode() == ArchOpcode::kArchTailCallCodeObject || return arch_opcode() <= ArchOpcode::kArchTailCallWasm;
arch_opcode() == ArchOpcode::kArchTailCallCodeObjectFromJSFunction ||
arch_opcode() == ArchOpcode::kArchTailCallAddress ||
arch_opcode() == ArchOpcode::kArchTailCallWasm;
} }
bool IsThrow() const { bool IsThrow() const {
return arch_opcode() == ArchOpcode::kArchThrowTerminator; return arch_opcode() == ArchOpcode::kArchThrowTerminator;
......
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