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
<rdar://problem/6692138>
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.
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.
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