Index: src/compiler/common-operator.cc |
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc |
index d2a19dd57ebc9216fc3a69b5f0ec2782ef556fe1..880908952ba4d2f367a1244be2e98196ff286fb5 100644 |
--- a/src/compiler/common-operator.cc |
+++ b/src/compiler/common-operator.cc |
@@ -36,6 +36,12 @@ BranchHint BranchHintOf(const Operator* const op) { |
} |
+size_t CaseIndexOf(const Operator* const op) { |
+ DCHECK_EQ(IrOpcode::kCase, op->opcode()); |
+ return OpParameter<size_t>(op); |
+} |
+ |
+ |
bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) { |
return lhs.type() == rhs.type() && lhs.hint() == rhs.hint(); |
} |
@@ -250,6 +256,24 @@ const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { |
} |
+const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { |
+ DCHECK_GE(control_output_count, 2u); // Disallow trivial switches. |
+ return new (zone()) Operator( // -- |
+ IrOpcode::kSwitch, Operator::kFoldable, // opcode |
+ "Switch", // name |
+ 1, 0, 1, 0, 0, control_output_count); // counts |
+} |
+ |
+ |
+const Operator* CommonOperatorBuilder::Case(size_t index) { |
+ return new (zone()) Operator1<size_t>( // -- |
+ IrOpcode::kCase, Operator::kFoldable, // opcode |
+ "Case", // name |
+ 0, 0, 1, 0, 0, 1, // counts |
+ index); // parameter |
+} |
+ |
+ |
const Operator* CommonOperatorBuilder::Start(int num_formal_parameters) { |
// Outputs are formal parameters, plus context, receiver, and JSFunction. |
const int value_output_count = num_formal_parameters + 3; |