mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 20:51:50 +00:00
0834f9b7ac
This simplifies the code and makes it easier for later work related to lazy-deopt of the instruction when returning from runtime call. Issue https://github.com/dart-lang/sdk/issues/45213 TEST=Existing test suite. Change-Id: I72e72554bdc306a9490a1460927d1dd650bfbe7d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191040 Reviewed-by: Tess Strickland <sstrickl@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
79 lines
2.4 KiB
C++
79 lines
2.4 KiB
C++
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_CONSTANTS_H_
|
|
#define RUNTIME_VM_CONSTANTS_H_
|
|
|
|
#if defined(TARGET_ARCH_IA32)
|
|
#include "vm/constants_ia32.h"
|
|
#elif defined(TARGET_ARCH_X64)
|
|
#include "vm/constants_x64.h"
|
|
#elif defined(TARGET_ARCH_ARM)
|
|
#include "vm/constants_arm.h"
|
|
#elif defined(TARGET_ARCH_ARM64)
|
|
#include "vm/constants_arm64.h"
|
|
#else
|
|
#error Unknown architecture.
|
|
#endif
|
|
|
|
namespace dart {
|
|
|
|
// An architecture independent ABI for the InstantiateType stub.
|
|
//
|
|
// We re-use registers from another ABI to avoid duplicating this ABI across 4
|
|
// architectures.
|
|
struct InstantiateTypeABI {
|
|
static const Register kTypeReg =
|
|
InstantiationABI::kUninstantiatedTypeArgumentsReg;
|
|
static const Register kInstantiatorTypeArgumentsReg =
|
|
InstantiationABI::kInstantiatorTypeArgumentsReg;
|
|
static const Register kFunctionTypeArgumentsReg =
|
|
InstantiationABI::kFunctionTypeArgumentsReg;
|
|
static const Register kResultTypeReg = InstantiationABI::kResultTypeReg;
|
|
};
|
|
|
|
class RegisterNames {
|
|
public:
|
|
static const char* RegisterName(Register reg) {
|
|
ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
|
|
return cpu_reg_names[reg];
|
|
}
|
|
static const char* FpuRegisterName(FpuRegister reg) {
|
|
ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
|
|
return fpu_reg_names[reg];
|
|
}
|
|
#if defined(TARGET_ARCH_ARM)
|
|
static const char* FpuSRegisterName(SRegister reg) {
|
|
ASSERT((0 <= reg) && (reg < kNumberOfSRegisters));
|
|
return fpu_s_reg_names[reg];
|
|
}
|
|
static const char* FpuDRegisterName(DRegister reg) {
|
|
ASSERT((0 <= reg) && (reg < kNumberOfDRegisters));
|
|
return fpu_d_reg_names[reg];
|
|
}
|
|
#endif // defined(TARGET_ARCH_ARM)
|
|
};
|
|
|
|
static constexpr bool IsArgumentRegister(Register reg) {
|
|
return ((1 << reg) & CallingConventions::kArgumentRegisters) != 0;
|
|
}
|
|
|
|
static constexpr bool IsFpuArgumentRegister(FpuRegister reg) {
|
|
return ((1 << reg) & CallingConventions::kFpuArgumentRegisters) != 0;
|
|
}
|
|
|
|
static constexpr bool IsCalleeSavedRegister(Register reg) {
|
|
return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0;
|
|
}
|
|
|
|
#if !defined(TARGET_ARCH_IA32)
|
|
constexpr bool IsAbiPreservedRegister(Register reg) {
|
|
return (kAbiPreservedCpuRegs & (1 << reg)) != 0;
|
|
}
|
|
#endif
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_CONSTANTS_H_
|