Index: src/x64/fast-codegen-x64.cc |
diff --git a/src/x64/fast-codegen-x64.cc b/src/x64/fast-codegen-x64.cc |
index 69a2ff3af66cd18823ca3a43748dae976fece66f..7e3d2fb74b39638d7858ef12feb0a0a311f598eb 100644 |
--- a/src/x64/fast-codegen-x64.cc |
+++ b/src/x64/fast-codegen-x64.cc |
@@ -1638,6 +1638,41 @@ void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
Register FastCodeGenerator::result_register() { return rax; } |
+// ---------------------------------------------------------------------------- |
+// Non-local control flow support. |
+ |
+ |
+void FastCodeGenerator::EnterFinallyBlock() { |
+ // Cook return address on top of stack (smi encoded Code* delta) |
+ __ movq(rdx, Operand(rsp, 0)); |
+ __ Move(rcx, masm_->CodeObject()); |
+ __ subq(rdx, rcx); |
+ __ Integer32ToSmi(rdx, rdx); |
+ __ movq(Operand(rsp, 0), rdx); |
+ // Store result register while executing finally block. |
+ __ push(rax); |
+} |
+ |
+ |
+void FastCodeGenerator::ReturnFromFinallyBlock() { |
+ // Restore result register from stack. |
+ __ pop(rax); |
+ // Uncook return address. |
+ __ movq(rdx, Operand(rsp, 0)); |
+ __ SmiToInteger32(rdx, rdx); |
+ __ Move(rcx, masm_->CodeObject()); |
+ __ addq(rdx, rcx); |
+ __ movq(Operand(rsp, 0), rdx); |
+ // And return. |
+ __ ret(0); |
+} |
+ |
+ |
+void FastCodeGenerator::ThrowException() { |
+ __ push(rax); |
+ __ CallRuntime(Runtime::kThrow, 1); |
+} |
+ |
#undef __ |