Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Unified Diff: src/ast/ast-numbering.cc

Issue 2146493002: Move catch prediction into frontend. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable test on Turbofan Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/ast-numbering.h ('k') | src/ast/prettyprinter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast-numbering.cc
diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc
index b7b52a3b79e85965b6120ba9106acef774d3e8d0..e2ee8657976518ede891e3cd126108d1f223a214 100644
--- a/src/ast/ast-numbering.cc
+++ b/src/ast/ast-numbering.cc
@@ -20,7 +20,8 @@ class AstNumberingVisitor final : public AstVisitor {
yield_count_(0),
properties_(zone),
slot_cache_(zone),
- dont_optimize_reason_(kNoReason) {
+ dont_optimize_reason_(kNoReason),
+ catch_predicted_(false) {
InitializeAstVisitor(isolate);
}
@@ -80,6 +81,7 @@ class AstNumberingVisitor final : public AstVisitor {
// The slot cache allows us to reuse certain feedback vector slots.
FeedbackVectorSlotCache slot_cache_;
BailoutReason dont_optimize_reason_;
+ bool catch_predicted_;
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
@@ -297,7 +299,17 @@ void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) {
IncrementNodeCount();
DisableCrankshaft(kTryCatchStatement);
- Visit(node->try_block());
+ {
+ 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_);
+ Visit(node->try_block());
+ catch_predicted_ = old_catch_predicted;
+ }
Visit(node->catch_block());
}
@@ -305,6 +317,9 @@ void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) {
void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) {
IncrementNodeCount();
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_);
Visit(node->try_block());
Visit(node->finally_block());
}
« no previous file with comments | « src/ast/ast-numbering.h ('k') | src/ast/prettyprinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698