From: jkummerow@chromium.org Date: Wed, 28 Aug 2013 15:00:30 +0000 (+0000) Subject: Delete HAbnormalExit. It does more harm than good. X-Git-Tag: upstream/4.7.83~12764 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3747b5bc6dff36eb8525e0f3d5bb91ae85626b95;p=platform%2Fupstream%2Fv8.git Delete HAbnormalExit. It does more harm than good. BUG=v8:2843 R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/23462007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16406 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index d0d7f5c..f9e21f7 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); diff --git a/src/hydrogen-environment-liveness.cc b/src/hydrogen-environment-liveness.cc index 9efa47b..fad9755 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; diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 2e9aa00..dd42190 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()) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index ea6288e..b19ca8f 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -5406,8 +5406,6 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) { HThrow* instr = Add(value); instr->set_position(expr->position()); Add(expr->id()); - current_block()->FinishExit(new(zone()) HAbnormalExit); - set_current_block(NULL); } diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index c2ffc50..e6cc719 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); diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index d71c32b..b8775c3 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); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 85181c0..1b4332a 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); diff --git a/test/mjsunit/regress/regress-2843.js b/test/mjsunit/regress/regress-2843.js new file mode 100644 index 0000000..5b28c2d --- /dev/null +++ b/test/mjsunit/regress/regress-2843.js @@ -0,0 +1,45 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --allow-natives-syntax + +function bailout() { throw "bailout"; } +var global; + +function foo(x, fun) { + var a = x + 1; + 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; +} + +assertThrows("foo(1, bailout)"); +assertThrows("foo(1, bailout)"); +%OptimizeFunctionOnNextCall(foo); +assertThrows("foo(1, bailout)"); +assertEquals(2, foo(1, function() {}));