Bug 93072 - V8Proxy::retrieve(*) leads to really obfuscated code and should be removed
Summary: V8Proxy::retrieve(*) leads to really obfuscated code and should be removed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Barth
URL:
Keywords:
Depends on:
Blocks: 75793
  Show dependency treegraph
 
Reported: 2012-08-03 00:07 PDT by Adam Barth
Modified: 2012-08-03 01:56 PDT (History)
5 users (show)

See Also:


Attachments
Patch (24.11 KB, patch)
2012-08-03 00:07 PDT, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (24.51 KB, patch)
2012-08-03 00:32 PDT, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2012-08-03 00:07:34 PDT
V8Proxy::retrieve(*) leads to really obfuscated code and should be removed
Comment 1 Adam Barth 2012-08-03 00:07:59 PDT
Created attachment 156273 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-08-03 00:12:15 PDT
Comment on attachment 156273 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156273&action=review

> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:3324
> +        frame->script()->windowShell()->initContextIfNeeded();

I guess if we're running script in the first place, then script() is never null...

> Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp:115
> +    V8Proxy* proxy = impl->document()->frame() ? impl->document()->frame()->script()->proxy() : 0;

This seems like a really long idiom... Maybe impl should have an accessor which can return script() for you?
Comment 3 Adam Barth 2012-08-03 00:23:30 PDT
(In reply to comment #2)
> (From update of attachment 156273 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156273&action=review
> 
> > Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:3324
> > +        frame->script()->windowShell()->initContextIfNeeded();
> 
> I guess if we're running script in the first place, then script() is never null...

script() is no longer ever null.  It's the object you ask if script is disabled.

> > Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp:115
> > +    V8Proxy* proxy = impl->document()->frame() ? impl->document()->frame()->script()->proxy() : 0;
> 
> This seems like a really long idiom... Maybe impl should have an accessor which can return script() for you?

Yeah, this is generated code, so I'm not that worried about it.  I'd like to get rid of V8Proxy entirely, we will make it shorter.
Comment 4 Adam Barth 2012-08-03 00:32:24 PDT
Created attachment 156275 [details]
Patch
Comment 5 Eric Seidel (no email) 2012-08-03 00:38:06 PDT
Comment on attachment 156275 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156275&action=review

OK.

> Source/WebCore/bindings/v8/V8LazyEventListener.cpp:91
> +        return v8::Local<v8::Value>();

Super ugly.
Comment 6 Adam Barth 2012-08-03 00:39:18 PDT
> > Source/WebCore/bindings/v8/V8LazyEventListener.cpp:91
> > +        return v8::Local<v8::Value>();
> 
> Super ugly.

We can make it v8::Undefined() if you like that better.
Comment 7 Kentaro Hara 2012-08-03 00:51:09 PDT
(In reply to comment #6)
> > > Source/WebCore/bindings/v8/V8LazyEventListener.cpp:91
> > > +        return v8::Local<v8::Value>();
> > 
> > Super ugly.
> 
> We can make it v8::Undefined() if you like that better.

Now the V8 team made v8::Handle<v8::Value>() as fast as v8::Undefined(Isolate). So we can use v8::Handle<v8::Value>() everywhere regardless of Isolate. I'm planning to implement

    v8::Handle<v8::Value> v8Undefined() { return v8::Handle<v8::Value>(); }

in V8Binding.cpp and use v8Undefined() everywhere in V8 bindings.
Comment 8 Adam Barth 2012-08-03 00:54:42 PDT
Comment on attachment 156275 [details]
Patch

Ok.  Sounds like we should land this with the ugly syntax and clean it up with the rest of them.
Comment 9 WebKit Review Bot 2012-08-03 01:56:25 PDT
Comment on attachment 156275 [details]
Patch

Clearing flags on attachment: 156275

Committed r124583: <http://trac.webkit.org/changeset/124583>
Comment 10 WebKit Review Bot 2012-08-03 01:56:30 PDT
All reviewed patches have been landed.  Closing bug.