Bug 18869

Summary: SQUIRRELFISH: function toString broken after calling
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: JavaScriptCoreAssignee: Maciej Stachowiak <mjs>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 18631    
Attachments:
Description Flags
fix by keeping references to the original source oliver: review+

Description Maciej Stachowiak 2008-05-03 01:38:34 PDT
function.toString does not work right after calling the function. This breaks at least the following layout tests:

  fast/js/toString-elision-trailing-comma.html
  fast/js/toString-prefix-postfix-preserve-parens.html
  fast/js/kde/lval-exceptions.html
Comment 1 Geoffrey Garen 2008-05-07 13:17:12 PDT
On IRC, Maciej said he was working on this.
Comment 2 Maciej Stachowiak 2008-05-10 05:10:05 PDT
Created attachment 21056 [details]
fix by keeping references to the original source
Comment 3 Oliver Hunt 2008-05-10 12:59:01 PDT
Comment on attachment 21056 [details]
fix by keeping references to the original source

r=me, although i am concerned about this approach in the long term.  As we are no longer actually decompiling there are two side effects:
* It is no longer possible to use function.toString to "prettify" source which makes debugging google, etc difficult (for us), and there are a number of places i've seen on the web that reference decompilation as a way to reformat JS.
* This renders a number of fuzzers somewhat useless.  JSFunFuzz for instance does roundtrip checks which in general are meant to pick up times when we have compiled code that does one thing into an incorrect form, which we now lose as all we do is regurgitate what we were given.

That said if we start doing significant optimisations and restructuring with the bytecode stream decopmilation may not be entirely helpful.