Index: src/compiler/operator.cc |
diff --git a/src/compiler/operator.cc b/src/compiler/operator.cc |
index 35f9c889be314d3f94f91ea5b9186bacacb9d8ff..59354246dfdd94c388a30cd7d4800905434367b8 100644 |
--- a/src/compiler/operator.cc |
+++ b/src/compiler/operator.cc |
@@ -4,6 +4,8 @@ |
#include "src/compiler/operator.h" |
+#include <limits> |
+ |
namespace v8 { |
namespace internal { |
namespace compiler { |
@@ -11,16 +13,44 @@ namespace compiler { |
Operator::~Operator() {} |
+std::ostream& operator<<(std::ostream& os, const Operator& op) { |
+ op.PrintTo(os); |
+ return os; |
+} |
+ |
+ |
SimpleOperator::SimpleOperator(Opcode opcode, Properties properties, |
- int input_count, int output_count, |
+ size_t input_count, size_t output_count, |
const char* mnemonic) |
: Operator(opcode, properties, mnemonic), |
- input_count_(input_count), |
- output_count_(output_count) {} |
+ input_count_(static_cast<uint8_t>(input_count)), |
+ output_count_(static_cast<uint8_t>(output_count)) { |
+ DCHECK(input_count <= std::numeric_limits<uint8_t>::max()); |
+ DCHECK(output_count <= std::numeric_limits<uint8_t>::max()); |
+} |
SimpleOperator::~SimpleOperator() {} |
+ |
+bool SimpleOperator::Equals(const Operator* that) const { |
+ return opcode() == that->opcode(); |
+} |
+ |
+ |
+size_t SimpleOperator::HashCode() const { |
+ return base::hash<Opcode>()(opcode()); |
+} |
+ |
+ |
+int SimpleOperator::InputCount() const { return input_count_; } |
+ |
+ |
+int SimpleOperator::OutputCount() const { return output_count_; } |
+ |
+ |
+void SimpleOperator::PrintTo(std::ostream& os) const { os << mnemonic(); } |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |