Reviewers: Michael Starzinger,

Message:
Fixed bug by deleting code -- please take a look.

Description:
Delete HAbnormalExit. It does more harm than good.

BUG=v8:2843

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

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

Affected files:
  M src/arm/lithium-arm.cc
  M src/hydrogen-environment-liveness.cc
  M src/hydrogen-instructions.h
  M src/hydrogen.cc
  M src/ia32/lithium-ia32.cc
  M src/mips/lithium-mips.cc
  M src/x64/lithium-x64.cc
  A + test/mjsunit/regress/regress-2843.js


Index: src/arm/lithium-arm.cc
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
index 5978fad604cd54eb30904d6448b6e84ea09d9c19..fe7150d5284b18eefb1eae3d8166552bd991bd47 100644
--- a/src/arm/lithium-arm.cc
+++ b/src/arm/lithium-arm.cc
@@ -1872,13 +1872,6 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
 }


-LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
-  // The control instruction marking the end of a block that completed
-  // abruptly (e.g., threw an exception).  There is nothing specific to do.
-  return NULL;
-}
-
-
 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
   LOperand* value = UseFixed(instr->value(), r0);
   return MarkAsCall(new(zone()) LThrow(value), instr);
Index: src/hydrogen-environment-liveness.cc
diff --git a/src/hydrogen-environment-liveness.cc b/src/hydrogen-environment-liveness.cc index 9efa47bd34d7133ae8416fcc05009405adcc64a3..fad9755e5c714176da1a57db03b33a9320a034d1 100644
--- a/src/hydrogen-environment-liveness.cc
+++ b/src/hydrogen-environment-liveness.cc
@@ -163,11 +163,7 @@ void HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtInstruction(
       live->Clear();
       for (int i = 0; i < enter->return_targets()->length(); ++i) {
         int return_id = enter->return_targets()->at(i)->block_id();
-        // When an AbnormalExit is involved, it can happen that the return
-        // target block doesn't actually exist.
-        if (return_id < live_at_block_start_.length()) {
-          live->Union(*live_at_block_start_[return_id]);
-        }
+        live->Union(*live_at_block_start_[return_id]);
       }
       last_simulate_ = NULL;
       break;
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 773ba3bc25f97918c3b72c0245a6da92488b489d..fcd3c733cae22795f4dba6d53f8b6aba1ab776d7 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -63,7 +63,6 @@ class LChunkBuilder;


 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V)  \
-  V(AbnormalExit)                              \
   V(AccessArgumentsAt)                         \
   V(Add)                                       \
   V(Allocate)                                  \
@@ -1443,16 +1442,6 @@ class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
 };


-class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
- public:
- virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
-    return Representation::None();
-  }
-
-  DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
-};
-
-
 class HUnaryOperation : public HTemplateInstruction<1> {
  public:
   HUnaryOperation(HValue* value, HType type = HType::Tagged())
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 4847f1aac0a511e9d36a469330003619368123ba..73e8bb2c3f0d2b7455fd1b7f02294fd5b2dd34f6 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5406,8 +5406,6 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) {
   HThrow* instr = Add<HThrow>(value);
   instr->set_position(expr->position());
   Add<HSimulate>(expr->id());
-  current_block()->FinishExit(new(zone()) HAbnormalExit);
-  set_current_block(NULL);
 }


Index: src/ia32/lithium-ia32.cc
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
index 7ec12582a9dba562d60380735abdef750551fe8e..e99b3cfe531583420fed3c973dfcbab14e94d715 100644
--- a/src/ia32/lithium-ia32.cc
+++ b/src/ia32/lithium-ia32.cc
@@ -1886,13 +1886,6 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
 }


-LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
-  // The control instruction marking the end of a block that completed
-  // abruptly (e.g., threw an exception).  There is nothing specific to do.
-  return NULL;
-}
-
-
 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* value = UseFixed(instr->value(), eax);
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index b11c9c232b3fa5dc88795c907637baed70c1b0c2..0c8ab214c07b4ad88f6b7726d86fcbd9b13219c2 100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -1791,13 +1791,6 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
 }


-LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
-  // The control instruction marking the end of a block that completed
-  // abruptly (e.g., threw an exception).  There is nothing specific to do.
-  return NULL;
-}
-
-
 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
   LOperand* value = UseFixed(instr->value(), a0);
   return MarkAsCall(new(zone()) LThrow(value), instr);
Index: src/x64/lithium-x64.cc
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index 57938b213fc634c8b0feffbedbfea27b186111fe..25a300553eb8ee9a12cfc30127b5171048871059 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -1789,13 +1789,6 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
 }


-LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
-  // The control instruction marking the end of a block that completed
-  // abruptly (e.g., threw an exception).  There is nothing specific to do.
-  return NULL;
-}
-
-
 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
   LOperand* value = UseFixed(instr->value(), rax);
   return MarkAsCall(new(zone()) LThrow(value), instr);
Index: test/mjsunit/regress/regress-2843.js
diff --git a/test/mjsunit/regress/regress-2813.js b/test/mjsunit/regress/regress-2843.js
similarity index 82%
copy from test/mjsunit/regress/regress-2813.js
copy to test/mjsunit/regress/regress-2843.js
index 97ae43b316a2177596927cf5465fa2214cc11c61..5b28c2d7948ee5b71f2cc072aea326057f8156db 100644
--- a/test/mjsunit/regress/regress-2813.js
+++ b/test/mjsunit/regress/regress-2843.js
@@ -27,18 +27,19 @@

 // Flags: --allow-natives-syntax

-function foo(x) {
+function bailout() { throw "bailout"; }
+var global;
+
+function foo(x, fun) {
   var a = x + 1;
-  var b = x + 2;
-  if (x != 0) {
-    if (x > 0 & x < 100) {
-      return a;
-    }
-  }
-  return 0;
+  var b = x + 2;  // Need another Simulate to fold the first one into.
+  global = true;  // Need a side effect to deopt to.
+  fun();
+  return a;
 }

-assertEquals(0, foo(0));
-assertEquals(0, foo(0));
+assertThrows("foo(1, bailout)");
+assertThrows("foo(1, bailout)");
 %OptimizeFunctionOnNextCall(foo);
-assertEquals(3, foo(2));
+assertThrows("foo(1, bailout)");
+assertEquals(2, foo(1, function() {}));


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