From 39e9a9030defbd31ad85dfc5f8ad99a278ce824d Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Wed, 29 May 2013 12:36:41 +0000 Subject: [PATCH] Make sure IfBuilder::Return clears the current block. This is a follow-up to an earlier bugfix. It doesn't yet trigger any known bugs but is a safety precaution since IfBuilder usage increases. R=jkummerow@chromium.org BUG=chromium:243868 Review URL: https://codereview.chromium.org/15832005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14882 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs-hydrogen.cc | 3 ++- src/hydrogen.cc | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 26b6e290ad..d400bd8642 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -186,11 +186,12 @@ bool CodeStubGraphBuilderBase::BuildGraph() { } } - if (!current_block()->IsFinished()) { + if (current_block() != NULL) { HReturn* hreturn_instruction = new(zone) HReturn(return_value, context_, stack_pop_count); current_block()->Finish(hreturn_instruction); + set_current_block(NULL); } return true; } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index f8771d11b1..2d1e844ecc 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -822,9 +822,10 @@ void HGraphBuilder::IfBuilder::Deopt() { void HGraphBuilder::IfBuilder::Return(HValue* value) { HBasicBlock* block = builder_->current_block(); - block->Finish(new(zone()) HReturn(value, - builder_->environment()->LookupContext(), - builder_->graph()->GetConstantMinus1())); + HValue* context = builder_->environment()->LookupContext(); + HValue* parameter_count = builder_->graph()->GetConstantMinus1(); + block->FinishExit(new(zone()) HReturn(value, context, parameter_count)); + builder_->set_current_block(NULL); if (did_else_) { first_false_block_ = NULL; } else {