JavaScriptCore:
[WebKit.git] / JavaScriptCore / kjs / nodes.cpp
index 6d7b305a793e965cf16192eedc3f216a2ca1406a..3c0b24d5539e8725933bd69bb2149614a62654c2 100644 (file)
@@ -5745,6 +5745,11 @@ RegisterID* TryNode::emitCode(CodeGenerator& generator, RegisterID* dst)
 
     if (m_finallyBlock) {
         generator.popFinallyContext();
+        // there may be important registers live at the time we jump
+        // to a finally block (such as for a return or throw) so we
+        // ref the highest register ever used as a conservative
+        // approach to not clobbering anything important
+        RefPtr<RegisterID> highestUsedRegister = generator.highestUsedRegister();
         RefPtr<LabelID> finallyEndLabel = generator.newLabel();
         generator.emitJumpSubroutine(finallyReturnAddr.get(), finallyStart.get());
         generator.emitJump(finallyEndLabel.get());