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

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

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. Created 5 years, 10 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/common-operator.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698