Chromium Code Reviews| Index: src/ast/ast-numbering.cc |
| diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc |
| index 1be5940adc38654356e1e61bdec91dedf0ef7a36..e9b6db230da65a27d2bbff5162b9fcfda57fef50 100644 |
| --- a/src/ast/ast-numbering.cc |
| +++ b/src/ast/ast-numbering.cc |
| @@ -20,7 +20,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { |
| properties_(zone), |
| slot_cache_(zone), |
| dont_optimize_reason_(kNoReason), |
| - catch_predicted_(false) { |
| + catch_prediction_(HandlerTable::UNCAUGHT) { |
| InitializeAstVisitor(isolate); |
| } |
| @@ -80,7 +80,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { |
| // The slot cache allows us to reuse certain feedback vector slots. |
| FeedbackVectorSlotCache slot_cache_; |
| BailoutReason dont_optimize_reason_; |
| - bool catch_predicted_; |
| + HandlerTable::CatchPrediction catch_prediction_; |
| DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); |
| @@ -292,15 +292,16 @@ void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) { |
| IncrementNodeCount(); |
| DisableCrankshaft(kTryCatchStatement); |
| { |
| - const bool old_catch_predicted = catch_predicted_; |
| - // If the node's clear_pending_message flag is unset, we assume that the |
| - // catch block is a ReThrow and hence predict uncaught (unless caught by |
| - // outer handlers). Otherwise, we predict caught. |
| - const bool not_rethrow = node->clear_pending_message(); |
| - catch_predicted_ = catch_predicted_ || not_rethrow; |
| - node->set_catch_predicted(catch_predicted_); |
| + const HandlerTable::CatchPrediction old_prediction = catch_prediction_; |
| + // This node uses its own prediction, unless it's "uncaught", in which case |
| + // we adopt the prediction of the outer try-block. |
|
Michael Starzinger
2016/07/20 09:20:18
nit: s/outer/surrounding/
|
| + HandlerTable::CatchPrediction catch_prediction = node->catch_prediction(); |
| + if (catch_prediction != HandlerTable::UNCAUGHT) { |
| + catch_prediction_ = catch_prediction; |
| + } |
| + node->set_catch_prediction(catch_prediction_); |
| Visit(node->try_block()); |
| - catch_predicted_ = old_catch_predicted; |
| + catch_prediction_ = old_prediction; |
| } |
| Visit(node->catch_block()); |
| } |
| @@ -311,7 +312,7 @@ void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) { |
| DisableCrankshaft(kTryFinallyStatement); |
| // We can't know whether the finally block will override ("catch") an |
| // exception thrown in the try block, so we just adopt the outer prediction. |
| - node->set_catch_predicted(catch_predicted_); |
| + node->set_catch_prediction(catch_prediction_); |
| Visit(node->try_block()); |
| Visit(node->finally_block()); |
| } |