RESOLVED FIXED 24654
REGRESSION (Safari 4): Incorrect function return value when using IE "try ... finally" memory leak work-around
https://bugs.webkit.org/show_bug.cgi?id=24654
Summary REGRESSION (Safari 4): Incorrect function return value when using IE "try ......
Christopher Blum
Reported 2009-03-17 14:11:53 PDT
Hey, I recently checked out Safari 4 Public Beta and recognized that the following piece of javascript code behaves different than in other browsers (tested in Safari 3.2, FF 2, FF 3, IE 6, IE 7, IE 8, Opera 9.6). var foo = function() { var bar = {}; try { return bar; } finally { bar = null }; }; foo(); // this returns null in Safari 4 Public Beta (Win and Mac) Safari 4 is the only browser that doesn't return an empty object. The "try ... finally" is a known workaround for preventing memory leaks in IE 6. (http://www.hedgerwow.com/360/dhtml/ie6_memory_leak_fix/) Regards, Christopher
Attachments
Fix codegen for return statements if there are finalisers present. (5.80 KB, patch)
2009-03-17 23:35 PDT, Oliver Hunt
zwarich: review+
Geoffrey Garen
Comment 1 2009-03-17 16:11:50 PDT
Oliver Hunt
Comment 2 2009-03-17 23:35:49 PDT
Created attachment 28718 [details] Fix codegen for return statements if there are finalisers present. Fairly obvious fix, added test to existing finaliser test, and converted test to newer js test form.
Cameron Zwarich (cpst)
Comment 3 2009-03-17 23:39:36 PDT
Comment on attachment 28718 [details] Fix codegen for return statements if there are finalisers present. I like returnRegister more than returnReg, and it matches what we use elsewhere in the JIT codegen. Other than that, r=me if perf is fine. I always like seeing tests in the newer format.
Oliver Hunt
Comment 4 2009-03-18 00:25:12 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ... M JavaScriptCore/ChangeLog M JavaScriptCore/bytecompiler/BytecodeGenerator.h M JavaScriptCore/parser/Nodes.cpp M LayoutTests/ChangeLog M LayoutTests/fast/js/finally-codegen-failure-expected.txt M LayoutTests/fast/js/finally-codegen-failure.html A LayoutTests/fast/js/resources/finally-codegen-failure.js Committed r41806
Note You need to log in before you can comment on or make changes to this bug.