Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: test/cctest/compiler/test-run-native-calls.cc

Issue 2092413002: [RegisterConfiguration] Streamline access to arch defaults, simplify Registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-multiple-return.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-native-calls.cc
diff --git a/test/cctest/compiler/test-run-native-calls.cc b/test/cctest/compiler/test-run-native-calls.cc
index 7434712d7190374c5dded311acd55f9c573f89be..9c67fd523fb57e3a824fb3a44584174f9fede372 100644
--- a/test/cctest/compiler/test-run-native-calls.cc
+++ b/test/cctest/compiler/test-run-native-calls.cc
@@ -18,6 +18,8 @@ namespace v8 {
namespace internal {
namespace compiler {
+const auto GetRegConfig = RegisterConfiguration::Turbofan;
+
namespace {
typedef float float32;
typedef double float64;
@@ -76,12 +78,8 @@ class Pairs {
class RegisterPairs : public Pairs {
public:
RegisterPairs()
- : Pairs(
- 100,
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_general_registers(),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->allocatable_general_codes()) {}
+ : Pairs(100, GetRegConfig()->num_allocatable_general_registers(),
+ GetRegConfig()->allocatable_general_codes()) {}
};
@@ -93,16 +91,11 @@ class Float32RegisterPairs : public Pairs {
100,
#if V8_TARGET_ARCH_ARM
// TODO(bbudge) Modify wasm linkage to allow use of all float regs.
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers() /
- 2 -
- 2,
+ GetRegConfig()->num_allocatable_double_registers() / 2 - 2,
#else
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers(),
+ GetRegConfig()->num_allocatable_double_registers(),
#endif
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->allocatable_double_codes()) {
+ GetRegConfig()->allocatable_double_codes()) {
}
};
@@ -111,12 +104,8 @@ class Float32RegisterPairs : public Pairs {
class Float64RegisterPairs : public Pairs {
public:
Float64RegisterPairs()
- : Pairs(
- 100,
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers(),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->allocatable_double_codes()) {}
+ : Pairs(100, GetRegConfig()->num_allocatable_double_registers(),
+ GetRegConfig()->allocatable_double_codes()) {}
};
@@ -647,15 +636,14 @@ static void Test_RunInt32SubWithRet(int retreg) {
// Separate tests for parallelization.
-#define TEST_INT32_SUB_WITH_RET(x) \
- TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \
- if (x < Register::kNumRegisters && \
- Register::from_code(x).IsAllocatable()) { \
- Test_RunInt32SubWithRet(x); \
- } \
+#define TEST_INT32_SUB_WITH_RET(x) \
+ TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \
+ if (x < Register::kNumRegisters && \
+ GetRegConfig()->IsAllocatableGeneralCode(x)) { \
+ Test_RunInt32SubWithRet(x); \
+ } \
}
-
TEST_INT32_SUB_WITH_RET(0)
TEST_INT32_SUB_WITH_RET(1)
TEST_INT32_SUB_WITH_RET(2)
@@ -703,9 +691,7 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) {
base::AccountingAllocator allocator;
Zone zone(&allocator);
int parray[2];
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
pairs.Next(&parray[0], &parray[1], false);
Allocator params(parray, 2, nullptr, 0);
Allocator rets(rarray, 1, nullptr, 0);
@@ -752,14 +738,12 @@ static int32_t Compute_Int32_WeightedSum(CallDescriptor* desc, int32_t* input) {
static void Test_Int32_WeightedSum_of_size(int count) {
Int32Signature sig(count);
for (int p0 = 0; p0 < Register::kNumRegisters; p0++) {
- if (Register::from_code(p0).IsAllocatable()) {
+ if (GetRegConfig()->IsAllocatableGeneralCode(p0)) {
base::AccountingAllocator allocator;
Zone zone(&allocator);
int parray[] = {p0};
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
Allocator params(parray, 1, nullptr, 0);
Allocator rets(rarray, 1, nullptr, 0);
RegisterConfig config(params, rets);
@@ -812,12 +796,8 @@ static void RunSelect(CallDescriptor* desc) {
template <int which>
void Test_Int32_Select() {
- int parray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
+ int parray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
Allocator params(parray, 1, nullptr, 0);
Allocator rets(rarray, 1, nullptr, 0);
RegisterConfig config(params, rets);
@@ -854,14 +834,10 @@ TEST_INT32_SELECT(63)
TEST(Int64Select_registers) {
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_general_registers() < 2)
- return;
+ if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
ArgsBuffer<int64_t>::Sig sig(2);
RegisterPairs pairs;
@@ -882,14 +858,11 @@ TEST(Int64Select_registers) {
TEST(Float32Select_registers) {
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers() < 2) {
+ if (GetRegConfig()->num_allocatable_double_registers() < 2) {
return;
}
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
ArgsBuffer<float32>::Sig sig(2);
Float32RegisterPairs pairs;
@@ -910,15 +883,9 @@ TEST(Float32Select_registers) {
TEST(Float64Select_registers) {
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers() < 2)
- return;
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_general_registers() < 2)
- return;
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ if (GetRegConfig()->num_allocatable_double_registers() < 2) return;
+ if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
+ int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
ArgsBuffer<float64>::Sig sig(2);
Float64RegisterPairs pairs;
@@ -939,9 +906,7 @@ TEST(Float64Select_registers) {
TEST(Float32Select_stack_params_return_reg) {
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets);
@@ -962,9 +927,7 @@ TEST(Float32Select_stack_params_return_reg) {
TEST(Float64Select_stack_params_return_reg) {
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets);
@@ -1017,9 +980,7 @@ static void Build_Select_With_Call(CallDescriptor* desc,
TEST(Float64StackParamsToStackParams) {
- int rarray[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
@@ -1038,9 +999,7 @@ TEST(Float64StackParamsToStackParams) {
void MixedParamTest(int start) {
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_double_registers() < 2)
- return;
+ if (GetRegConfig()->num_double_registers() < 2) return;
// TODO(titzer): mix in 64-bit types on all platforms when supported.
#if V8_TARGET_ARCH_32_BIT
@@ -1069,22 +1028,12 @@ void MixedParamTest(int start) {
const int num_params = static_cast<int>(arraysize(types) - start);
// Build call descriptor
- int parray_gp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(1)};
- int rarray_gp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
- int parray_fp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(1)};
- int rarray_fp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int parray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0),
+ GetRegConfig()->GetAllocatableGeneralCode(1)};
+ int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
+ int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0),
+ GetRegConfig()->GetAllocatableDoubleCode(1)};
+ int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
Allocator palloc(parray_gp, 2, parray_fp, 2);
Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
RegisterConfig config(palloc, ralloc);
@@ -1185,29 +1134,17 @@ void TestStackSlot(MachineType slot_type, T expected) {
// Test: Generate with a function f which reserves a stack slot, call an inner
// function g from f which writes into the stack slot of f.
- if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->num_allocatable_double_registers() < 2)
- return;
+ if (GetRegConfig()->num_allocatable_double_registers() < 2) return;
Isolate* isolate = CcTest::InitIsolateOnce();
// Lots of code to generate the build descriptor for the inner function.
- int parray_gp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(1)};
- int rarray_gp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableGeneralCode(0)};
- int parray_fp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0),
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(1)};
- int rarray_fp[] = {
- RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
- ->GetAllocatableDoubleCode(0)};
+ int parray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0),
+ GetRegConfig()->GetAllocatableGeneralCode(1)};
+ int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
+ int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0),
+ GetRegConfig()->GetAllocatableDoubleCode(1)};
+ int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
Allocator palloc(parray_gp, 2, parray_fp, 2);
Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
RegisterConfig config(palloc, ralloc);
« no previous file with comments | « test/cctest/compiler/test-multiple-return.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698