v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
register.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_CODEGEN_REGISTER_H_
6#define V8_CODEGEN_REGISTER_H_
7
10
11namespace v8 {
12namespace internal {
13
14constexpr int AddArgumentPaddingSlots(int argument_count) {
15 return argument_count + ArgumentPaddingSlots(argument_count);
16}
17
18constexpr bool ShouldPadArguments(int argument_count) {
19 return ArgumentPaddingSlots(argument_count) != 0;
20}
21
22template <typename... RegTypes>
23inline constexpr bool AreAliased(RegTypes... regs)
24 requires(std::conjunction_v<std::is_same<Register, RegTypes>...> ||
25 std::conjunction_v<std::is_same<DoubleRegister, RegTypes>...>
26#ifdef V8_TARGET_ARCH_X64
27 || std::conjunction_v<std::is_same<YMMRegister, RegTypes>...>
28#endif // V8_TARGET_ARCH_X64
29 )
30{
31 using FirstRegType = std::tuple_element_t<0, std::tuple<RegTypes...>>;
32 int num_different_regs = RegListBase<FirstRegType>{regs...}.Count();
33 int num_given_regs = (... + (regs.is_valid() ? 1 : 0));
34 return num_different_regs < num_given_regs;
35}
36
37} // namespace internal
38} // namespace v8
39
40#endif // V8_CODEGEN_REGISTER_H_
constexpr unsigned Count() const
constexpr bool ShouldPadArguments(int argument_count)
Definition register.h:18
constexpr int AddArgumentPaddingSlots(int argument_count)
Definition register.h:14
V8_EXPORT_PRIVATE bool AreAliased(const CPURegister &reg1, const CPURegister &reg2, const CPURegister &reg3=NoReg, const CPURegister &reg4=NoReg, const CPURegister &reg5=NoReg, const CPURegister &reg6=NoReg, const CPURegister &reg7=NoReg, const CPURegister &reg8=NoReg)
constexpr int ArgumentPaddingSlots(int argument_count)