Reviewers: Vyacheslav Egorov,

Description:
Fix an inlining bug on the 3.3 branch.

When inlining a function in a test context, it's possible that control
flow does not reach one or both of the branch targets.  In that case
we should not try to construct a flow graph from that target.

This bug has been fixed on the 3.4 branch and later, but was present
on 3.3 and earlier.

[email protected]
BUG=
TEST=


Please review this at http://codereview.chromium.org/7739025/

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

Affected files:
  M src/hydrogen.cc
  M src/version.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 4888eace3a263d34f87bb89bad2a8b66e70f0522..f26ecfd92d1d22f4dfcc511a06496f5e712c7acc 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4337,17 +4337,21 @@ bool HGraphBuilder::TryInline(Call* expr) {
   if (inlined_test_context() != NULL) {
     HBasicBlock* if_true = inlined_test_context()->if_true();
     HBasicBlock* if_false = inlined_test_context()->if_false();
-    if_true->SetJoinId(expr->id());
-    if_false->SetJoinId(expr->id());
     ASSERT(ast_context() == inlined_test_context());
     // Pop the return test context from the expression context stack.
     ClearInlinedTestContext();

     // Forward to the real test context.
-    HBasicBlock* true_target = TestContext::cast(ast_context())->if_true();
- HBasicBlock* false_target = TestContext::cast(ast_context())->if_false();
-    if_true->Goto(true_target, false);
-    if_false->Goto(false_target, false);
+    if (if_true->HasPredecessor()) {
+      if_true->SetJoinId(expr->id());
+ HBasicBlock* true_target = TestContext::cast(ast_context())->if_true();
+      if_true->Goto(true_target, false);
+    }
+    if (if_false->HasPredecessor()) {
+      if_false->SetJoinId(expr->id());
+ HBasicBlock* false_target = TestContext::cast(ast_context())->if_false();
+      if_false->Goto(false_target, false);
+    }

     // TODO(kmillikin): Come up with a better way to handle this. It is too
// subtle. NULL here indicates that the enclosing context has no control
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index b5c7daa1c4746bf6948e4bc446bbea01dc9df07d..19b1e510116d20254806c54b13a4956b652994e0 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     3
 #define BUILD_NUMBER      10
-#define PATCH_LEVEL       33
+#define PATCH_LEVEL       34
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to