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

Unified Diff: src/compiler/raw-machine-assembler.cc

Issue 2247353005: [builtins] support exception handling in TFJ builtins (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/raw-machine-assembler.cc
diff --git a/src/compiler/raw-machine-assembler.cc b/src/compiler/raw-machine-assembler.cc
index 8fd8b5c763059a13e7afcda4eca3fdd135fef286..3bc5db86b67dd526047d887ab55d655d98b501f5 100644
--- a/src/compiler/raw-machine-assembler.cc
+++ b/src/compiler/raw-machine-assembler.cc
@@ -85,6 +85,29 @@ void RawMachineAssembler::Branch(Node* condition, RawMachineLabel* true_val,
current_block_ = nullptr;
}
+void RawMachineAssembler::BranchIfException(Node* node,
+ RawMachineLabel* if_exception) {
+ RawMachineLabel success, call, exception;
+ DCHECK_NE(schedule()->end(), current_block_);
+ DCHECK(!node->op()->HasProperty(Operator::kNoThrow));
+
+ Goto(&call);
+ Bind(&call);
+ schedule()->AddCall(CurrentBlock(), node, Use(&success), Use(&exception));
+ current_block_ = nullptr;
+
+ Bind(&exception);
+ {
+ const Operator* op = common()->IfException();
+ Node* args[] = {node, node};
+ Node* on_exception = MakeNode(op, arraysize(args), args);
+ schedule()->AddNode(CurrentBlock(), on_exception);
+ Goto(if_exception);
+ }
+
+ Bind(&success);
+}
+
void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label,
const int32_t* case_values,
RawMachineLabel** case_labels,

Powered by Google App Engine
This is Rietveld 408576698