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

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: 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
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..a3ce1ac049abe937fd1866e7b89506b69af4c952 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,20 @@ 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.
+ bool caught = try_catch_nesting_level_ > 0;
// 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(caught);
+ 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);
}
}

Powered by Google App Engine
This is Rietveld 408576698