Bug 31420 - [V8] Table-driven setup for binding template callback functions
Summary: [V8] Table-driven setup for binding template callback functions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Enhancement
Assignee: Jens Alfke
URL:
Keywords:
Depends on:
Blocks: 31217
  Show dependency treegraph
 
Reported: 2009-11-12 10:34 PST by Jens Alfke
Modified: 2009-11-12 16:25 PST (History)
0 users

See Also:


Attachments
patch (16.10 KB, patch)
2009-11-12 10:37 PST, Jens Alfke
dglazkov: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Alfke 2009-11-12 10:34:27 PST
The ConfigureXXXTemplate() function generated for each binding class has a lot of common boilerplace that can be de-inlined, esp. since each of these functions is only called once. It also sets up the class's callback functions/methods with individual function calls, instead of using a table-driven approach (the way it already sets up accessors.)
Changing these results in 100kbytes of code size savings on x86/32.
Comment 1 Jens Alfke 2009-11-12 10:37:28 PST
Created attachment 43076 [details]
patch
Comment 2 Dimitri Glazkov (Google) 2009-11-12 10:51:10 PST
Comment on attachment 43076 [details]
patch

r=me, feel free to commit after this fix-up:

  
> +v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>desc,
> +                                           const char *interfaceName,
> +                                           V8ClassIndex::V8WrapperType parentClassIndex,
> +                                           int fieldCount,
> +                                           const BatchedAttribute* attributes, 
> +                                           size_t attributeCount,
> +                                           const BatchedCallback* callbacks,
> +                                           size_t callbackCount)
> +{
> +    desc->SetClassName(v8::String::New(interfaceName));
> +    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
> +    instance->SetInternalFieldCount(fieldCount);
> +    if (parentClassIndex)
> +        desc->Inherit(V8DOMWrapper::getTemplate(parentClassIndex));
> +    if (attributeCount)
> +        batchConfigureAttributes(instance, desc->PrototypeTemplate(),
> +                                 attributes, attributeCount);
> +    v8::Local<v8::Signature> default_signature = v8::Signature::New(desc);


Should be defaultSignature in WebKit-land.
Comment 3 Jens Alfke 2009-11-12 13:18:57 PST
Fixed that variable name, thanks.
Committed revision 50897.