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
This commit is contained in:
mstarzinger@chromium.org 2013-05-29 12:36:41 +00:00
parent 2e21ff6768
commit 39e9a9030d
2 changed files with 6 additions and 4 deletions

View File

@ -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;
}

View File

@ -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 {