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

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

Issue 1365073002: Revert of Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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-gap-resolver.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 af3748b8fd1b8049445a3155b8ecda39b779b1fa..bc6acf1bc97b4d57cc777ce9846cc03e898f8e30 100644
--- a/test/cctest/compiler/test-run-native-calls.cc
+++ b/test/cctest/compiler/test-run-native-calls.cc
@@ -7,7 +7,6 @@
#include "src/compiler/linkage.h"
#include "src/compiler/machine-type.h"
#include "src/compiler/raw-machine-assembler.h"
-#include "src/register-configuration.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
@@ -36,9 +35,8 @@
// to select a representative set.
class Pairs {
public:
- Pairs(int max_pairs, int range, const int* codes)
+ Pairs(int max_pairs, int range)
: range_(range),
- codes_(codes),
max_pairs_(std::min(max_pairs, range_ * range_)),
counter_(0) {}
@@ -48,33 +46,37 @@
do {
// Find the next pair.
if (exhaustive()) {
- *r0 = codes_[counter_ % range_];
- *r1 = codes_[counter_ / range_];
+ *r0 = counter_ % range_;
+ *r1 = counter_ / range_;
} else {
// Try each integer at least once for both r0 and r1.
int index = counter_ / 2;
if (counter_ & 1) {
- *r0 = codes_[index % range_];
- *r1 = codes_[index / range_];
+ *r0 = index % range_;
+ *r1 = index / range_;
} else {
- *r1 = codes_[index % range_];
- *r0 = codes_[index / range_];
+ *r1 = index % range_;
+ *r0 = index / range_;
}
}
counter_++;
- if ((same_is_ok) || (*r0 != *r1)) break;
- if (counter_ == max_pairs_) {
- // For the last hurrah, reg#0 with reg#n-1
- *r0 = codes_[0];
- *r1 = codes_[range_ - 1];
- break;
+ if (same_is_ok) break;
+ if (*r0 == *r1) {
+ if (counter_ >= max_pairs_) {
+ // For the last hurrah, reg#0 with reg#n-1
+ *r0 = 0;
+ *r1 = range_ - 1;
+ break;
+ }
}
} while (true);
+
+ DCHECK(*r0 >= 0 && *r0 < range_);
+ DCHECK(*r1 >= 0 && *r1 < range_);
}
private:
int range_;
- const int* codes_;
int max_pairs_;
int counter_;
bool exhaustive() { return max_pairs_ == (range_ * range_); }
@@ -84,12 +86,7 @@
// Pairs of general purpose registers.
class RegisterPairs : public Pairs {
public:
- RegisterPairs()
- : Pairs(
- 100, RegisterConfiguration::ArchDefault()
- ->num_allocatable_general_registers(),
- RegisterConfiguration::ArchDefault()->allocatable_general_codes()) {
- }
+ RegisterPairs() : Pairs(100, Register::kMaxNumAllocatableRegisters) {}
};
@@ -97,10 +94,7 @@
class Float32RegisterPairs : public Pairs {
public:
Float32RegisterPairs()
- : Pairs(
- 100, RegisterConfiguration::ArchDefault()
- ->num_allocatable_aliased_double_registers(),
- RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {}
+ : Pairs(100, DoubleRegister::NumAllocatableAliasedRegisters()) {}
};
@@ -108,10 +102,7 @@
class Float64RegisterPairs : public Pairs {
public:
Float64RegisterPairs()
- : Pairs(
- 100, RegisterConfiguration::ArchDefault()
- ->num_allocatable_aliased_double_registers(),
- RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {}
+ : Pairs(100, DoubleRegister::NumAllocatableAliasedRegisters()) {}
};
@@ -633,12 +624,9 @@
// 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 (Register::kMaxNumAllocatableRegisters > x) Test_RunInt32SubWithRet(x); \
}
@@ -689,8 +677,7 @@
while (pairs.More()) {
Zone zone;
int parray[2];
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
+ int rarray[] = {0};
pairs.Next(&parray[0], &parray[1], false);
Allocator params(parray, 2, nullptr, 0);
Allocator rets(rarray, 1, nullptr, 0);
@@ -737,20 +724,17 @@
static void Test_Int32_WeightedSum_of_size(int count) {
if (DISABLE_NATIVE_STACK_PARAMS) return;
Int32Signature sig(count);
- for (int p0 = 0; p0 < Register::kNumRegisters; p0++) {
- if (Register::from_code(p0).IsAllocatable()) {
- Zone zone;
-
- int parray[] = {p0};
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
- Allocator params(parray, 1, nullptr, 0);
- Allocator rets(rarray, 1, nullptr, 0);
- RegisterConfig config(params, rets);
- CallDescriptor* desc = config.Create(&zone, &sig);
- Run_Computation<int32_t>(desc, Build_Int32_WeightedSum,
- Compute_Int32_WeightedSum, 257 + count);
- }
+ for (int p0 = 0; p0 < Register::kMaxNumAllocatableRegisters; p0++) {
+ Zone zone;
+
+ int parray[] = {p0};
+ int rarray[] = {0};
+ Allocator params(parray, 1, nullptr, 0);
+ Allocator rets(rarray, 1, nullptr, 0);
+ RegisterConfig config(params, rets);
+ CallDescriptor* desc = config.Create(&zone, &sig);
+ Run_Computation<int32_t>(desc, Build_Int32_WeightedSum,
+ Compute_Int32_WeightedSum, 257 + count);
}
}
@@ -798,10 +782,8 @@
void Test_Int32_Select() {
if (DISABLE_NATIVE_STACK_PARAMS) return;
- int parray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
+ int parray[] = {0};
+ int rarray[] = {0};
Allocator params(parray, 1, nullptr, 0);
Allocator rets(rarray, 1, nullptr, 0);
RegisterConfig config(params, rets);
@@ -837,13 +819,10 @@
TEST(Int64Select_registers) {
- if (RegisterConfiguration::ArchDefault()
- ->num_allocatable_general_registers() < 2)
- return;
+ if (Register::kMaxNumAllocatableRegisters < 2) return;
if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
+ int rarray[] = {0};
ArgsBuffer<int64_t>::Sig sig(2);
RegisterPairs pairs;
@@ -863,13 +842,9 @@
TEST(Float32Select_registers) {
- if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() <
- 2) {
- return;
- }
-
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
+ if (RegisterConfiguration::ArchDefault()->num_double_registers() < 2) return;
+
+ int rarray[] = {0};
ArgsBuffer<float32>::Sig sig(2);
Float32RegisterPairs pairs;
@@ -889,14 +864,9 @@
TEST(Float64Select_registers) {
- if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() <
- 2)
- return;
- if (RegisterConfiguration::ArchDefault()
- ->num_allocatable_general_registers() < 2)
- return;
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
+ if (RegisterConfiguration::ArchDefault()->num_double_registers() < 2) return;
+
+ int rarray[] = {0};
ArgsBuffer<float64>::Sig sig(2);
Float64RegisterPairs pairs;
@@ -917,8 +887,7 @@
TEST(Float32Select_stack_params_return_reg) {
if (DISABLE_NATIVE_STACK_PARAMS) return;
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
+ int rarray[] = {0};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets);
@@ -939,8 +908,7 @@
TEST(Float64Select_stack_params_return_reg) {
if (DISABLE_NATIVE_STACK_PARAMS) return;
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
+ int rarray[] = {0};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets);
@@ -994,8 +962,7 @@
TEST(Float64StackParamsToStackParams) {
if (DISABLE_NATIVE_STACK_PARAMS) return;
- int rarray[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
+ int rarray[] = {0};
Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1);
@@ -1038,18 +1005,10 @@
const int num_params = static_cast<int>(arraysize(types) - start);
// Build call descriptor
- int parray_gp[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0),
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(1)};
- int rarray_gp[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
- int parray_fp[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0),
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(1)};
- int rarray_fp[] = {
- RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
- Allocator palloc(parray_gp, 2, parray_fp, 2);
- Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
+ int parray[] = {0, 1};
+ int rarray[] = {0};
+ Allocator palloc(parray, 2, parray, 2);
+ Allocator ralloc(rarray, 1, rarray, 1);
RegisterConfig config(palloc, ralloc);
for (int which = 0; which < num_params; which++) {
« no previous file with comments | « test/cctest/compiler/test-gap-resolver.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698