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

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

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 4c261f9a248826fe1fbdc63eac003fbad15f2ef3..239382eb07cc220c7acbaaf33967e36bdad67fba 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -102,7 +102,6 @@ std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
#define CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \
- V(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
@@ -116,6 +115,17 @@ std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1)
+#define CACHED_END_LIST(V) \
+ V(1) \
+ V(2) \
+ V(3) \
+ V(4) \
+ V(5) \
+ V(6) \
+ V(7) \
+ V(8)
+
+
#define CACHED_EFFECT_PHI_LIST(V) \
V(1) \
V(2) \
@@ -200,6 +210,19 @@ struct CommonOperatorGlobalCache final {
CACHED_OP_LIST(CACHED)
#undef CACHED
+ template <size_t kInputCount>
+ struct EndOperator final : public Operator {
+ EndOperator()
+ : Operator( // --
+ IrOpcode::kEnd, Operator::kKontrol, // opcode
+ "End", // name
+ 0, 0, kInputCount, 0, 0, 0) {} // counts
+ };
+#define CACHED_END(input_count) \
+ EndOperator<input_count> kEnd##input_count##Operator;
+ CACHED_END_LIST(CACHED_END)
+#undef CACHED_END
+
template <BranchHint kBranchHint>
struct BranchOperator final : public Operator1<BranchHint> {
BranchOperator()
@@ -329,6 +352,25 @@ CACHED_OP_LIST(CACHED)
#undef CACHED
+const Operator* CommonOperatorBuilder::End(size_t control_input_count) {
+ DCHECK_NE(0u, control_input_count); // Disallow empty ends.
+ switch (control_input_count) {
+#define CACHED_END(input_count) \
+ case input_count: \
+ return &cache_.kEnd##input_count##Operator;
+ CACHED_END_LIST(CACHED_END)
+#undef CACHED_END
+ default:
+ break;
+ }
+ // Uncached.
+ return new (zone()) Operator( //--
+ IrOpcode::kEnd, Operator::kKontrol, // opcode
+ "End", // name
+ 0, 0, control_input_count, 0, 0, 0); // counts
+}
+
+
const Operator* CommonOperatorBuilder::Branch(BranchHint hint) {
switch (hint) {
case BranchHint::kNone:

Powered by Google App Engine
This is Rietveld 408576698