Bug 28071 - [V8] Speed up lookupDOMWrapper by using new V8 API function.
Summary: [V8] Speed up lookupDOMWrapper by using new V8 API function.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-07 09:38 PDT by Vitaly Repeshko
Modified: 2009-08-07 16:11 PDT (History)
2 users (show)

See Also:


Attachments
patch (2.64 KB, patch)
2009-08-07 09:41 PDT, Vitaly Repeshko
dglazkov: review-
Details | Formatted Diff | Diff
more succinct patch (2.53 KB, patch)
2009-08-07 09:59 PDT, Vitaly Repeshko
dglazkov: review+
abarth: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Repeshko 2009-08-07 09:38:55 PDT
V8 bindings: speed up lookupDOMWrapper by using new V8 API function.
Comment 1 Vitaly Repeshko 2009-08-07 09:41:22 PDT
Created attachment 34283 [details]
patch
Comment 2 Dimitri Glazkov (Google) 2009-08-07 09:51:00 PDT
Comment on attachment 34283 [details]
patch

This looks great, except for style nits:

> +
> +        V8 bindings: speed up lookupDOMWrapper by using new V8 API function.

The convention we use is to use a bracketed V8 qualifier:

[V8] Speed up lookupD....

>  
> -        static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value>);
> +        static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Object> object)
> +        {
> +            if (object.IsEmpty())
> +                return object;
> +
> +            v8::Handle<v8::FunctionTemplate> descriptor = getTemplate(type);
> +            return object->FindInstanceInPrototypeChain(descriptor);

Great! Can we go even more succinct here?:

return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(getTemplate(type));

> +        }

>          // A helper function extract native object pointer from a DOM wrapper
>          // and cast to the specified type.
Comment 3 Vitaly Repeshko 2009-08-07 09:59:50 PDT
Created attachment 34286 [details]
more succinct patch
Comment 4 Dimitri Glazkov (Google) 2009-08-07 10:08:01 PDT
Comment on attachment 34286 [details]
more succinct patch

r=me. You forgot the ChageLog change, but it's no big deal -- doesn't affect the quality of the patch.
Comment 5 Adam Barth 2009-08-07 16:07:49 PDT
Comment on attachment 34286 [details]
more succinct patch

Boo.  Tabs in changelog.  I'll land manually.
Comment 6 Adam Barth 2009-08-07 16:11:45 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/bindings/v8/V8DOMWrapper.cpp
	M	WebCore/bindings/v8/V8DOMWrapper.h
Committed r46921