Revision: 9144
Author:   [email protected]
Date:     Tue Sep  6 04:21:56 2011
Log:      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=

Review URL: http://codereview.chromium.org/7739025
http://code.google.com/p/v8/source/detail?r=9144

Modified:
 /branches/3.3/src/hydrogen.cc
 /branches/3.3/src/version.cc

=======================================
--- /branches/3.3/src/hydrogen.cc       Thu Sep  1 05:44:01 2011
+++ /branches/3.3/src/hydrogen.cc       Tue Sep  6 04:21:56 2011
@@ -4337,17 +4337,21 @@
   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
=======================================
--- /branches/3.3/src/version.cc        Thu Sep  1 05:44:01 2011
+++ /branches/3.3/src/version.cc        Tue Sep  6 04:21:56 2011
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     3
 #define BUILD_NUMBER      10
-#define PATCH_LEVEL       34
+#define PATCH_LEVEL       35
 // 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