From d90290bdae287ead719a940ffceabc4d18b1fd3d Mon Sep 17 00:00:00 2001 From: "jarin@chromium.org" Date: Mon, 25 Aug 2014 14:28:15 +0000 Subject: [PATCH] Revert a mistake in Node::CollectProjections. Fix for a bug I introduced in r23270. BUG= R=titzer@chromium.org Review URL: https://codereview.chromium.org/500023004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler/instruction-selector.cc | 3 +-- src/compiler/node.cc | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index 64878e42bc..143bd69631 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(buffer->descriptor->ReturnCount())); } // Filter out the outputs that aren't live because no projection uses them. diff --git a/src/compiler/node.cc b/src/compiler/node.cc index c60822e3d4..d12aeb82b3 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(*i), 0); - projections->push_back(*i); + int32_t index = OpParameter(*i); + DCHECK_GE(index, 0); + DCHECK_LT(index, projections->size()); + DCHECK_EQ(NULL, (*projections)[index]); + (*projections)[index] = *i; } }