Index: src/compiler/common-operator.cc |
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc |
index 9ce6f71a0f9949bb9b4ddc04ee2e76ed1e2f413f..8dce7ffbb532462b3438c21552e4915c85922209 100644 |
--- a/src/compiler/common-operator.cc |
+++ b/src/compiler/common-operator.cc |
@@ -171,6 +171,24 @@ std::ostream& operator<<(std::ostream& os, |
return os << p.value() << "|" << p.rmode() << "|" << p.type(); |
} |
+bool operator==(TypedStateValueInfo const& lhs, |
+ TypedStateValueInfo const& rhs) { |
+ return lhs.machine_types() == rhs.machine_types() && lhs.mask() == rhs.mask(); |
+} |
+ |
+bool operator!=(TypedStateValueInfo const& lhs, |
+ TypedStateValueInfo const& rhs) { |
+ return !(lhs == rhs); |
+} |
+ |
+size_t hash_value(TypedStateValueInfo const& p) { |
+ return base::hash_combine(p.machine_types(), p.mask()); |
+} |
+ |
+std::ostream& operator<<(std::ostream& os, TypedStateValueInfo const& p) { |
+ return os << p.machine_types() << "|" << p.mask(); |
Jarin
2016/12/07 08:56:20
Please update the printing to print something huma
Leszek Swirski
2016/12/08 15:44:30
Done.
|
+} |
+ |
size_t hash_value(RegionObservability observability) { |
return static_cast<size_t>(observability); |
} |
@@ -238,6 +256,10 @@ OsrGuardType OsrGuardTypeOf(Operator const* op) { |
ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) { |
DCHECK(op->opcode() == IrOpcode::kTypedObjectState || |
op->opcode() == IrOpcode::kTypedStateValues); |
+ |
+ if (op->opcode() == IrOpcode::kTypedStateValues) { |
+ return OpParameter<TypedStateValueInfo>(op).machine_types(); |
+ } |
return OpParameter<const ZoneVector<MachineType>*>(op); |
} |
@@ -588,13 +610,14 @@ struct CommonOperatorGlobalCache final { |
#undef CACHED_PROJECTION |
template <int kInputCount> |
- struct StateValuesOperator final : public Operator { |
+ struct StateValuesOperator final : public Operator1<uint32_t> { |
Jarin
2016/12/07 08:56:19
To get a good printing, it would be better to intr
Leszek Swirski
2016/12/08 15:44:30
Done.
|
StateValuesOperator() |
- : Operator( // -- |
- IrOpcode::kStateValues, // opcode |
- Operator::kPure, // flags |
- "StateValues", // name |
- kInputCount, 0, 0, 1, 0, 0) {} // counts |
+ : Operator1<uint32_t>( // -- |
+ IrOpcode::kStateValues, // opcode |
+ Operator::kPure, // flags |
+ "StateValues", // name |
+ kInputCount, 0, 0, 1, 0, 0, // counts |
+ 0) {} // parameter |
}; |
#define CACHED_STATE_VALUES(input_count) \ |
StateValuesOperator<input_count> kStateValues##input_count##Operator; |
@@ -1000,30 +1023,35 @@ const Operator* CommonOperatorBuilder::BeginRegion( |
return nullptr; |
} |
-const Operator* CommonOperatorBuilder::StateValues(int arguments) { |
- switch (arguments) { |
+const Operator* CommonOperatorBuilder::StateValues(int arguments, |
+ uint32_t bitmask) { |
+ if (bitmask == 0) { |
+ switch (arguments) { |
#define CACHED_STATE_VALUES(arguments) \ |
case arguments: \ |
return &cache_.kStateValues##arguments##Operator; |
- CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES) |
+ CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES) |
#undef CACHED_STATE_VALUES |
- default: |
- break; |
+ default: |
+ break; |
+ } |
} |
+ |
// Uncached. |
- return new (zone()) Operator( // -- |
+ return new (zone()) Operator1<uint32_t>( // -- |
IrOpcode::kStateValues, Operator::kPure, // opcode |
"StateValues", // name |
- arguments, 0, 0, 1, 0, 0); // counts |
+ arguments, 0, 0, 1, 0, 0, // counts |
+ bitmask); // parameter |
} |
const Operator* CommonOperatorBuilder::TypedStateValues( |
- const ZoneVector<MachineType>* types) { |
- return new (zone()) Operator1<const ZoneVector<MachineType>*>( // -- |
- IrOpcode::kTypedStateValues, Operator::kPure, // opcode |
- "TypedStateValues", // name |
- static_cast<int>(types->size()), 0, 0, 1, 0, 0, // counts |
- types); // parameter |
+ const ZoneVector<MachineType>* types, uint32_t bitmask) { |
+ return new (zone()) Operator1<TypedStateValueInfo>( // -- |
+ IrOpcode::kTypedStateValues, Operator::kPure, // opcode |
+ "TypedStateValues", // name |
+ static_cast<int>(types->size()), 0, 0, 1, 0, 0, // counts |
+ TypedStateValueInfo(types, bitmask)); // parameters |
} |
const Operator* CommonOperatorBuilder::ObjectState(int pointer_slots) { |