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

Unified Diff: test/cctest/compiler/test-gap-resolver.cc

Issue 2060273003: [tests] Don't test moves between different reps in test-gap-resolver.cc (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-gap-resolver.cc
diff --git a/test/cctest/compiler/test-gap-resolver.cc b/test/cctest/compiler/test-gap-resolver.cc
index 9781aeb5cdb41de4c82303f0f6fc5d48c878af91..0c771251b6e7bca754361563656e160c7812b192 100644
--- a/test/cctest/compiler/test-gap-resolver.cc
+++ b/test/cctest/compiler/test-gap-resolver.cc
@@ -167,8 +167,10 @@ class ParallelMoveCreator : public HandleAndZoneScope {
ParallelMove* Create(int size) {
ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone());
std::set<InstructionOperand, CompareOperandModuloType> seen;
+ MachineRepresentation rep = RandomRepresentation();
for (int i = 0; i < size; ++i) {
- MoveOperands mo(CreateRandomOperand(true), CreateRandomOperand(false));
+ MoveOperands mo(CreateRandomOperand(true, rep),
+ CreateRandomOperand(false, rep));
if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) {
parallel_move->AddMove(mo.source(), mo.destination());
seen.insert(mo.destination());
@@ -179,52 +181,43 @@ class ParallelMoveCreator : public HandleAndZoneScope {
private:
MachineRepresentation RandomRepresentation() {
- int index = rng_->NextInt(3);
+ int index = rng_->NextInt(5);
switch (index) {
case 0:
return MachineRepresentation::kWord32;
case 1:
return MachineRepresentation::kWord64;
case 2:
+ return MachineRepresentation::kFloat32;
+ case 3:
+ return MachineRepresentation::kFloat64;
+ case 4:
return MachineRepresentation::kTagged;
}
UNREACHABLE();
return MachineRepresentation::kNone;
}
- MachineRepresentation RandomDoubleRepresentation() {
- int index = rng_->NextInt(2);
- if (index == 0) return MachineRepresentation::kFloat64;
- return MachineRepresentation::kFloat32;
- }
-
- InstructionOperand CreateRandomOperand(bool is_source) {
+ InstructionOperand CreateRandomOperand(bool is_source,
+ MachineRepresentation rep) {
int index = rng_->NextInt(7);
// destination can't be Constant.
- switch (rng_->NextInt(is_source ? 7 : 6)) {
+ switch (rng_->NextInt(is_source ? 5 : 4)) {
case 0:
- return AllocatedOperand(LocationOperand::STACK_SLOT,
- RandomRepresentation(), index);
+ return AllocatedOperand(LocationOperand::STACK_SLOT, rep, index);
case 1:
- return AllocatedOperand(LocationOperand::STACK_SLOT,
- RandomDoubleRepresentation(), index);
+ return AllocatedOperand(LocationOperand::REGISTER, rep, index);
case 2:
- return AllocatedOperand(LocationOperand::REGISTER,
- RandomRepresentation(), index);
- case 3:
- return AllocatedOperand(LocationOperand::REGISTER,
- RandomDoubleRepresentation(), index);
- case 4:
return ExplicitOperand(
- LocationOperand::REGISTER, RandomRepresentation(),
+ LocationOperand::REGISTER, rep,
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
->GetAllocatableGeneralCode(1));
- case 5:
+ case 3:
return ExplicitOperand(
- LocationOperand::STACK_SLOT, RandomRepresentation(),
+ LocationOperand::STACK_SLOT, rep,
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
->GetAllocatableGeneralCode(index));
- case 6:
+ case 4:
return ConstantOperand(index);
}
UNREACHABLE();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698