Reviewers: Jakob,

Description:
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.

[email protected]
BUG=chromium:243868

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

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

Affected files:
  M src/code-stubs-hydrogen.cc
  M src/hydrogen.cc


Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 26b6e290add989c7eae008712e7c3852aa0e4cd4..d400bd86422e1d61901b7bbde4a20c4a472f6fd0 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;
 }
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index f8771d11b1bc36be311f1c02a6987d5d3269f084..2d1e844ecc37c565004575764d88af7554bb83a9 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 {


--
--
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/groups/opt_out.


Reply via email to