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

Unified Diff: src/compiler/operator.cc

Issue 680313003: Move input/output counts directly into Operators, simplying OperatorProperties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yes Created 6 years, 2 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/operator.h ('k') | src/compiler/operator-properties-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/operator.cc
diff --git a/src/compiler/operator.cc b/src/compiler/operator.cc
index 59354246dfdd94c388a30cd7d4800905434367b8..c8687f4304817669cfdefdc2b30a91dc733880b4 100644
--- a/src/compiler/operator.cc
+++ b/src/compiler/operator.cc
@@ -10,46 +10,35 @@ namespace v8 {
namespace internal {
namespace compiler {
-Operator::~Operator() {}
-
-std::ostream& operator<<(std::ostream& os, const Operator& op) {
- op.PrintTo(os);
- return os;
+template <typename N>
+static inline N CheckRange(size_t val) {
+ CHECK(val <= std::numeric_limits<N>::max());
+ return static_cast<N>(val);
}
-SimpleOperator::SimpleOperator(Opcode opcode, Properties properties,
- size_t input_count, size_t output_count,
- const char* mnemonic)
- : Operator(opcode, properties, mnemonic),
- 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());
-}
+Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic,
+ size_t value_in, size_t effect_in, size_t control_in,
+ size_t value_out, size_t effect_out, size_t control_out)
+ : opcode_(opcode),
+ properties_(properties),
+ mnemonic_(mnemonic),
+ value_in_(CheckRange<uint32_t>(value_in)),
+ effect_in_(CheckRange<uint16_t>(effect_in)),
+ control_in_(CheckRange<uint16_t>(control_in)),
+ value_out_(CheckRange<uint16_t>(value_out)),
+ effect_out_(CheckRange<uint8_t>(effect_out)),
+ control_out_(CheckRange<uint8_t>(control_out)) {}
-SimpleOperator::~SimpleOperator() {}
-
-
-bool SimpleOperator::Equals(const Operator* that) const {
- return opcode() == that->opcode();
-}
-
-
-size_t SimpleOperator::HashCode() const {
- return base::hash<Opcode>()(opcode());
+std::ostream& operator<<(std::ostream& os, const Operator& op) {
+ op.PrintTo(os);
+ return os;
}
-int SimpleOperator::InputCount() const { return input_count_; }
-
-
-int SimpleOperator::OutputCount() const { return output_count_; }
-
-
-void SimpleOperator::PrintTo(std::ostream& os) const { os << mnemonic(); }
+void Operator::PrintTo(std::ostream& os) const { os << mnemonic(); }
} // namespace compiler
} // namespace internal
« no previous file with comments | « src/compiler/operator.h ('k') | src/compiler/operator-properties-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698