Bug 28071

Summary: [V8] Speed up lookupDOMWrapper by using new V8 API function.
Product: WebKit Reporter: Vitaly Repeshko <vitalyr>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dglazkov
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
patch
dglazkov: review-
more succinct patch dglazkov: review+, abarth: commit-queue-

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