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

Unified Diff: src/compiler/control-builders.cc

Issue 873423004: First stab at try-catch and try-finally in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed moarer comments by Ben Titzer. Created 5 years, 11 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/control-builders.h ('k') | src/compiler/graph-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/control-builders.cc
diff --git a/src/compiler/control-builders.cc b/src/compiler/control-builders.cc
index 6cf2905e613e3e6b4837a262cbe1c3588906d606..6dba2d3ad6083756aef4fbc1e43d392b9e85465b 100644
--- a/src/compiler/control-builders.cc
+++ b/src/compiler/control-builders.cc
@@ -147,6 +147,61 @@ void BlockBuilder::EndBlock() {
break_environment_->Merge(environment());
set_environment(break_environment_);
}
+
+
+void TryCatchBuilder::BeginTry() {
+ catch_environment_ = environment()->CopyAsUnreachable();
+ catch_environment_->Push(nullptr);
+}
+
+
+void TryCatchBuilder::Throw(Node* exception) {
+ environment()->Push(exception);
+ catch_environment_->Merge(environment());
+ environment()->Pop();
+ environment()->MarkAsUnreachable();
+}
+
+
+void TryCatchBuilder::EndTry() {
+ exit_environment_ = environment();
+ exception_node_ = catch_environment_->Pop();
+ set_environment(catch_environment_);
+}
+
+
+void TryCatchBuilder::EndCatch() {
+ exit_environment_->Merge(environment());
+ set_environment(exit_environment_);
}
+
+
+void TryFinallyBuilder::BeginTry() {
+ finally_environment_ = environment()->CopyAsUnreachable();
+ finally_environment_->Push(nullptr);
+}
+
+
+void TryFinallyBuilder::LeaveTry(Node* token) {
+ environment()->Push(token);
+ finally_environment_->Merge(environment());
+ environment()->Pop();
+}
+
+
+void TryFinallyBuilder::EndTry(Node* fallthrough_token) {
+ environment()->Push(fallthrough_token);
+ finally_environment_->Merge(environment());
+ environment()->Pop();
+ token_node_ = finally_environment_->Pop();
+ set_environment(finally_environment_);
+}
+
+
+void TryFinallyBuilder::EndFinally() {
+ // Nothing to be done here.
}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/compiler/control-builders.h ('k') | src/compiler/graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698