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

Unified Diff: src/compiler/common-operator.cc

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 years 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/common-operator.h ('k') | src/compiler/diamond.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 011bd2e683a9edcb777a6c8c1a88529f88984d9d..4246e5b60bcd6344bc2e2b92a5c9e315c52d7813 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -73,7 +73,8 @@ std::ostream& operator<<(std::ostream& os, IfExceptionHint hint) {
bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
- return lhs.type() == rhs.type() && lhs.hint() == rhs.hint();
+ return lhs.representation() == rhs.representation() &&
+ lhs.hint() == rhs.hint();
}
@@ -83,12 +84,12 @@ bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
size_t hash_value(SelectParameters const& p) {
- return base::hash_combine(p.type(), p.hint());
+ return base::hash_combine(p.representation(), p.hint());
}
std::ostream& operator<<(std::ostream& os, SelectParameters const& p) {
- return os << p.type() << "|" << p.hint();
+ return os << p.representation() << "|" << p.hint();
}
@@ -104,6 +105,12 @@ size_t ProjectionIndexOf(const Operator* const op) {
}
+MachineRepresentation PhiRepresentationOf(const Operator* const op) {
+ DCHECK_EQ(IrOpcode::kPhi, op->opcode());
+ return OpParameter<MachineRepresentation>(op);
+}
+
+
int ParameterIndexOf(const Operator* const op) {
DCHECK_EQ(IrOpcode::kParameter, op->opcode());
return OpParameter<ParameterInfo>(op).index();
@@ -203,15 +210,15 @@ std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
#define CACHED_PHI_LIST(V) \
- V(kMachAnyTagged, 1) \
- V(kMachAnyTagged, 2) \
- V(kMachAnyTagged, 3) \
- V(kMachAnyTagged, 4) \
- V(kMachAnyTagged, 5) \
- V(kMachAnyTagged, 6) \
- V(kMachBool, 2) \
- V(kMachFloat64, 2) \
- V(kMachInt32, 2)
+ V(kTagged, 1) \
+ V(kTagged, 2) \
+ V(kTagged, 3) \
+ V(kTagged, 4) \
+ V(kTagged, 5) \
+ V(kTagged, 6) \
+ V(kBit, 2) \
+ V(kFloat64, 2) \
+ V(kWord32, 2)
#define CACHED_PROJECTION_LIST(V) \
@@ -353,17 +360,18 @@ struct CommonOperatorGlobalCache final {
CACHED_MERGE_LIST(CACHED_MERGE)
#undef CACHED_MERGE
- template <MachineType kType, int kInputCount>
- struct PhiOperator final : public Operator1<MachineType> {
+ template <MachineRepresentation kRep, int kInputCount>
+ struct PhiOperator final : public Operator1<MachineRepresentation> {
PhiOperator()
- : Operator1<MachineType>( //--
+ : Operator1<MachineRepresentation>( //--
IrOpcode::kPhi, Operator::kPure, // opcode
"Phi", // name
kInputCount, 0, 1, 1, 0, 0, // counts
- kType) {} // parameter
+ kRep) {} // parameter
};
-#define CACHED_PHI(type, input_count) \
- PhiOperator<type, input_count> kPhi##type##input_count##Operator;
+#define CACHED_PHI(rep, input_count) \
+ PhiOperator<MachineRepresentation::rep, input_count> \
+ kPhi##rep##input_count##Operator;
CACHED_PHI_LIST(CACHED_PHI)
#undef CACHED_PHI
@@ -661,31 +669,32 @@ const Operator* CommonOperatorBuilder::HeapConstant(
}
-const Operator* CommonOperatorBuilder::Select(MachineType type,
+const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep,
BranchHint hint) {
return new (zone()) Operator1<SelectParameters>( // --
IrOpcode::kSelect, Operator::kPure, // opcode
"Select", // name
3, 0, 0, 1, 0, 0, // counts
- SelectParameters(type, hint)); // parameter
+ SelectParameters(rep, hint)); // parameter
}
-const Operator* CommonOperatorBuilder::Phi(MachineType type,
+const Operator* CommonOperatorBuilder::Phi(MachineRepresentation rep,
int value_input_count) {
DCHECK(value_input_count > 0); // Disallow empty phis.
-#define CACHED_PHI(kType, kValueInputCount) \
- if (kType == type && kValueInputCount == value_input_count) { \
- return &cache_.kPhi##kType##kValueInputCount##Operator; \
+#define CACHED_PHI(kRep, kValueInputCount) \
+ if (MachineRepresentation::kRep == rep && \
+ kValueInputCount == value_input_count) { \
+ return &cache_.kPhi##kRep##kValueInputCount##Operator; \
}
CACHED_PHI_LIST(CACHED_PHI)
#undef CACHED_PHI
// Uncached.
- return new (zone()) Operator1<MachineType>( // --
- IrOpcode::kPhi, Operator::kPure, // opcode
- "Phi", // name
- value_input_count, 0, 1, 1, 0, 0, // counts
- type); // parameter
+ return new (zone()) Operator1<MachineRepresentation>( // --
+ IrOpcode::kPhi, Operator::kPure, // opcode
+ "Phi", // name
+ value_input_count, 0, 1, 1, 0, 0, // counts
+ rep); // parameter
}
@@ -832,7 +841,7 @@ const Operator* CommonOperatorBuilder::Projection(size_t index) {
const Operator* CommonOperatorBuilder::ResizeMergeOrPhi(const Operator* op,
int size) {
if (op->opcode() == IrOpcode::kPhi) {
- return Phi(OpParameter<MachineType>(op), size);
+ return Phi(PhiRepresentationOf(op), size);
} else if (op->opcode() == IrOpcode::kEffectPhi) {
return EffectPhi(size);
} else if (op->opcode() == IrOpcode::kMerge) {
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/diamond.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698