Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 8681026391939e4ef56e0324f7eac83a8741d2c2..5b9f25df51b00f70b731e5ddcf181800ec7afd14 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -39,7 +39,6 @@ |
| #include "hydrogen-check-elimination.h" |
| #include "hydrogen-dce.h" |
| #include "hydrogen-dehoist.h" |
| -#include "hydrogen-deoptimizing-mark.h" |
| #include "hydrogen-environment-liveness.h" |
| #include "hydrogen-escape-analysis.h" |
| #include "hydrogen-infer-representation.h" |
| @@ -47,6 +46,7 @@ |
| #include "hydrogen-load-elimination.h" |
| #include "hydrogen-gvn.h" |
| #include "hydrogen-mark-deoptimize.h" |
| +#include "hydrogen-mark-unreachable.h" |
| #include "hydrogen-minus-zero.h" |
| #include "hydrogen-osr.h" |
| #include "hydrogen-range-analysis.h" |
| @@ -96,7 +96,7 @@ HBasicBlock::HBasicBlock(HGraph* graph) |
| parent_loop_header_(NULL), |
| inlined_entry_block_(NULL), |
| is_inline_return_target_(false), |
| - is_deoptimizing_(false), |
| + is_reachable_(true), |
| dominates_loop_successors_(false), |
| is_osr_entry_(false) { } |
| @@ -106,6 +106,11 @@ Isolate* HBasicBlock::isolate() const { |
| } |
| +void HBasicBlock::MarkUnreachable() { |
| + is_reachable_ = false; |
| +} |
| + |
| + |
| void HBasicBlock::AttachLoopInformation() { |
| ASSERT(!IsLoopHeader()); |
| loop_information_ = new(zone()) HLoopInformation(this, zone()); |
| @@ -2283,7 +2288,6 @@ HGraph::HGraph(CompilationInfo* info) |
| zone_(info->zone()), |
| is_recursive_(false), |
| use_optimistic_licm_(false), |
| - has_soft_deoptimize_(false), |
| depends_on_empty_array_proto_elements_(false), |
| type_change_checksum_(0), |
| maximum_environment_size_(0), |
| @@ -3130,7 +3134,6 @@ bool HGraph::Optimize(BailoutReason* bailout_reason) { |
| Run<HEnvironmentLivenessAnalysisPhase>(); |
| } |
| - Run<HPropagateDeoptimizingMarkPhase>(); |
| if (!CheckConstPhiUses()) { |
| *bailout_reason = kUnsupportedPhiUseOfConstVariable; |
| return false; |
| @@ -3141,6 +3144,10 @@ bool HGraph::Optimize(BailoutReason* bailout_reason) { |
| return false; |
| } |
| + // Find and mark unreachable code to simplify optimizations, especially gvn, |
| + // where unreachable code could unnecessarily defeat LICM. |
| + Run<HMarkUnreachableBlocksPhase>(); |
| + |
| if (FLAG_check_elimination) Run<HCheckEliminationPhase>(); |
| if (FLAG_dead_code_elimination) Run<HDeadCodeEliminationPhase>(); |
| if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>(); |
| @@ -3187,6 +3194,10 @@ bool HGraph::Optimize(BailoutReason* bailout_reason) { |
| RestoreActualValues(); |
| + // Find unreachable code a second time, GVN and other optimizations may have |
| + // made blocks unreachable that were previously reachable. |
| + Run<HMarkUnreachableBlocksPhase>(); |
| + |
| return true; |
| } |
| @@ -3621,6 +3632,13 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { |
| last_block = NULL; // Cleared to indicate we've handled it. |
| } |
| } else { |
| + // If the current test block is deoptimizing due to an unhandle clause |
|
Jakob Kummerow
2013/10/01 11:59:20
nit: unhandled
danno
2013/10/23 11:46:51
Done.
|
| + // of the switch, the test instruction is in the next block since (the |
|
Jakob Kummerow
2013/10/01 11:59:20
nit: no ()
danno
2013/10/23 11:46:51
Done.
|
| + // deopt must end the current block). |
| + if (curr_test_block->IsDeoptimizing()) { |
| + ASSERT(curr_test_block->end()->SecondSuccessor() == NULL); |
| + curr_test_block = curr_test_block->end()->FirstSuccessor(); |
| + } |
| normal_block = curr_test_block->end()->FirstSuccessor(); |
| curr_test_block = curr_test_block->end()->SecondSuccessor(); |
| } |