On Wed, Feb 9, 2011 at 12:57 PM, Scott Blum <[email protected]> wrote > > > Maybe that pass is simply generating the wrong code. I'm not saying this, > by itself, would work, but maybe the right solution involves generating > something like: > > (foo instanceof JavaScriptObject) ? JsoFoo.$method(foo) : foo.method() > > So that dead code can optimize the instanceof test at some point. > > That seems more elegant to me. Consider the case where 'foo' is known to be type Foo, and Foo is a SingleJsoImpl that is not dual-imp. Then DeadCodeElimination could immediately replace this instanceof check with true.
> If we model the JSO method as having an upref to the interface method, CFA > and TypeTightener might do the right things implicitly, then we modify the > appropriate optimizer pass to convert the interface call into the JSO direct > call if that's the only viable option. > > Is this kind of like how regular static methods have an upref to the instance methods they came from? Could we reuse the same program.staticToInstanceMap? -Ray -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
