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

Unified Diff: src/compiler/node-properties.cc

Issue 935033004: Introduce and test NodeProperties::CollectControlProjections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/node-properties.h ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-properties.cc
diff --git a/src/compiler/node-properties.cc b/src/compiler/node-properties.cc
index 1575310a7f3a26517fba1289cbdde6263c783159..47de74e3292307b300cb8e6e971d778bf013eca2 100644
--- a/src/compiler/node-properties.cc
+++ b/src/compiler/node-properties.cc
@@ -182,6 +182,50 @@ Node* NodeProperties::FindProjection(Node* node, size_t projection_index) {
// static
+void NodeProperties::CollectControlProjections(Node* node, Node** projections,
+ size_t projection_count) {
+#ifdef DEBUG
+ DCHECK_EQ(static_cast<int>(projection_count), node->UseCount());
+ std::memset(projections, 0, sizeof(*projections) * projection_count);
+#endif
+ size_t if_value_index = 0;
+ for (Node* const use : node->uses()) {
+ size_t index;
+ switch (use->opcode()) {
+ default:
+ UNREACHABLE();
+ // Fall through.
+ case IrOpcode::kIfTrue:
+ DCHECK_EQ(IrOpcode::kBranch, node->opcode());
+ index = 0;
+ break;
+ case IrOpcode::kIfFalse:
+ DCHECK_EQ(IrOpcode::kBranch, node->opcode());
+ index = 1;
+ break;
+ case IrOpcode::kIfValue:
+ DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
+ index = if_value_index++;
+ break;
+ case IrOpcode::kIfDefault:
+ DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
+ index = projection_count - 1;
+ break;
+ }
+ DCHECK_LT(if_value_index, projection_count);
+ DCHECK_LT(index, projection_count);
+ DCHECK_NULL(projections[index]);
+ projections[index] = use;
+ }
+#ifdef DEBUG
+ for (size_t index = 0; index < projection_count; ++index) {
+ DCHECK_NOT_NULL(projections[index]);
+ }
+#endif
+}
+
+
+// static
bool NodeProperties::AllValueInputsAreTyped(Node* node) {
int input_count = node->op()->ValueInputCount();
for (int index = 0; index < input_count; ++index) {
« no previous file with comments | « src/compiler/node-properties.h ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698