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

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

Issue 1087793002: [turbofan] add MachineType to AllocatedOperand (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: no flag Created 5 years, 8 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 | « src/compiler/register-allocator-verifier.cc ('k') | test/cctest/compiler/test-instruction.cc » ('j') | 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 09a7154089a1c9582d50758c418df810e75378f7..a081ddb8fe9d79410692e8fb43413b693e1ec2a0 100644
--- a/test/cctest/compiler/test-gap-resolver.cc
+++ b/test/cctest/compiler/test-gap-resolver.cc
@@ -89,7 +89,8 @@ class InterpreterState {
if (key.is_constant) {
return ConstantOperand(key.index);
}
- return AllocatedOperand(key.kind, key.index);
+ return AllocatedOperand(
+ key.kind, InstructionSequence::DefaultRepresentation(), key.index);
}
friend std::ostream& operator<<(std::ostream& os,
@@ -148,7 +149,7 @@ class ParallelMoveCreator : public HandleAndZoneScope {
ParallelMove* Create(int size) {
ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone());
- std::set<InstructionOperand> seen;
+ std::set<InstructionOperand, CompareOperandModuloType> seen;
for (int i = 0; i < size; ++i) {
MoveOperands mo(CreateRandomOperand(true), CreateRandomOperand(false));
if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) {
@@ -160,18 +161,38 @@ class ParallelMoveCreator : public HandleAndZoneScope {
}
private:
+ MachineType RandomType() {
+ int index = rng_->NextInt(3);
+ switch (index) {
+ case 0:
+ return kRepWord32;
+ case 1:
+ return kRepWord64;
+ case 2:
+ return kRepTagged;
+ }
+ UNREACHABLE();
+ return kMachNone;
+ }
+
+ MachineType RandomDoubleType() {
+ int index = rng_->NextInt(2);
+ if (index == 0) return kRepFloat64;
+ return kRepFloat32;
+ }
+
InstructionOperand CreateRandomOperand(bool is_source) {
int index = rng_->NextInt(6);
// destination can't be Constant.
switch (rng_->NextInt(is_source ? 5 : 4)) {
case 0:
- return StackSlotOperand(index);
+ return StackSlotOperand(RandomType(), index);
case 1:
- return DoubleStackSlotOperand(index);
+ return DoubleStackSlotOperand(RandomDoubleType(), index);
case 2:
- return RegisterOperand(index);
+ return RegisterOperand(RandomType(), index);
case 3:
- return DoubleRegisterOperand(index);
+ return DoubleRegisterOperand(RandomDoubleType(), index);
case 4:
return ConstantOperand(index);
}
« no previous file with comments | « src/compiler/register-allocator-verifier.cc ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698