Reviewers: titzer,

Message:
PTAL.

Description:
Revert a mistake in Node::CollectProjections.

Fix for a bug I introduced in r23270.

BUG=

Please review this at https://codereview.chromium.org/500023004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -4 lines):
  M src/compiler/instruction-selector.cc
  M src/compiler/node.cc


Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index 64878e42bc3c3c131e2df485910a7dc00b092bf0..143bd696311781bdda8666e5d614e324feba4738 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -284,9 +284,8 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
     if (buffer->descriptor->ReturnCount() == 1) {
       buffer->output_nodes.push_back(call);
     } else {
+      buffer->output_nodes.resize(buffer->descriptor->ReturnCount(), NULL);
       call->CollectProjections(&buffer->output_nodes);
-      DCHECK(buffer->output_nodes.size() <=
-             static_cast<size_t>(buffer->descriptor->ReturnCount()));
     }

// Filter out the outputs that aren't live because no projection uses them.
Index: src/compiler/node.cc
diff --git a/src/compiler/node.cc b/src/compiler/node.cc
index c60822e3d48f1894061d7aaf3ece14bbb80b5923..d12aeb82b3572c1d44b966c95335147e84ea3337 100644
--- a/src/compiler/node.cc
+++ b/src/compiler/node.cc
@@ -11,10 +11,16 @@ namespace internal {
 namespace compiler {

 void Node::CollectProjections(NodeVector* projections) {
+  for (size_t i = 0; i < projections->size(); i++) {
+    (*projections)[i] = NULL;
+  }
   for (UseIter i = uses().begin(); i != uses().end(); ++i) {
     if ((*i)->opcode() != IrOpcode::kProjection) continue;
-    DCHECK_GE(OpParameter<int32_t>(*i), 0);
-    projections->push_back(*i);
+    int32_t index = OpParameter<int32_t>(*i);
+    DCHECK_GE(index, 0);
+    DCHECK_LT(index, projections->size());
+    DCHECK_EQ(NULL, (*projections)[index]);
+    (*projections)[index] = *i;
   }
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to