Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 3f51057734253d4a8d3a64310c5800fa8530c6c0..d543de7861a91af637b259e54353ed19d1d2e050 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -4228,6 +4228,33 @@ void FullCodeGenerator::ExitFinallyBlock() { |
#undef __ |
+#define __ ACCESS_MASM(masm()) |
+ |
+FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( |
+ int* stack_depth, |
+ int* context_length) { |
+ // The macros used here must preserve the result register. |
+ |
+ // Because the handler block contains the context of the finally |
+ // code, we can restore it directly from there for the finally code |
+ // rather than iteratively unwinding contexts via their previous |
+ // links. |
+ __ Drop(*stack_depth); // Down to the handler block. |
+ if (*context_length > 0) { |
+ // Restore the context to its dedicated register and the stack. |
+ __ movq(rsi, Operand(rsp, StackHandlerConstants::kContextOffset)); |
+ __ movq(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); |
+ } |
+ __ PopTryHandler(); |
+ __ call(finally_entry_); |
+ |
+ *stack_depth = 0; |
+ *context_length = 0; |
+ return previous_; |
+} |
+ |
+ |
+#undef __ |
} } // namespace v8::internal |