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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1158563008: [turbofan] Introduce prediction for exception handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Architecture ports. Created 5 years, 7 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/compiler/ast-graph-builder.h ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 038d2beb1e6472e9b01cf843993ca1b592e7dfd1..2bb372b4f7fed1e6c2c9a2cd406c8d6e082311bb 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -335,9 +335,11 @@ class AstGraphBuilder::ControlScopeForCatch : public ControlScope {
ControlScopeForCatch(AstGraphBuilder* owner, TryCatchBuilder* control)
: ControlScope(owner), control_(control) {
builder()->try_nesting_level_++; // Increment nesting.
+ builder()->try_catch_nesting_level_++;
}
~ControlScopeForCatch() {
builder()->try_nesting_level_--; // Decrement nesting.
+ builder()->try_catch_nesting_level_--;
}
protected:
@@ -437,6 +439,7 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
globals_(0, local_zone),
execution_control_(nullptr),
execution_context_(nullptr),
+ try_catch_nesting_level_(0),
try_nesting_level_(0),
input_buffer_size_(0),
input_buffer_(nullptr),
@@ -3562,17 +3565,22 @@ Node* AstGraphBuilder::MakeNode(const Operator* op, int value_input_count,
}
// Add implicit exception continuation for throwing nodes.
if (!result->op()->HasProperty(Operator::kNoThrow) && inside_try_scope) {
+ // Conservative prediction whether caught locally.
+ IfExceptionHint hint = try_catch_nesting_level_ > 0
+ ? IfExceptionHint::kLocallyCaught
+ : IfExceptionHint::kLocallyUncaught;
// Copy the environment for the success continuation.
Environment* success_env = environment()->CopyForConditional();
-
- Node* on_exception = graph()->NewNode(common()->IfException(), result);
+ const Operator* op = common()->IfException(hint);
+ Node* on_exception = graph()->NewNode(op, result);
environment_->UpdateControlDependency(on_exception);
execution_control()->ThrowValue(on_exception);
set_environment(success_env);
}
// Add implicit success continuation for throwing nodes.
if (!result->op()->HasProperty(Operator::kNoThrow)) {
- Node* on_success = graph()->NewNode(common()->IfSuccess(), result);
+ const Operator* op = common()->IfSuccess();
+ Node* on_success = graph()->NewNode(op, result);
environment_->UpdateControlDependency(on_success);
}
}
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698