Bug 34606 - [V8] Clean up code for getting a v8::FunctionTemplate
Summary: [V8] Clean up code for getting a v8::FunctionTemplate
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nate Chapin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-04 11:56 PST by Nate Chapin
Modified: 2010-02-05 08:31 PST (History)
1 user (show)

See Also:


Attachments
patch (17.20 KB, patch)
2010-02-04 12:02 PST, Nate Chapin
dglazkov: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Chapin 2010-02-04 11:56:06 PST
Each generated V8 class has a private GetTemplate() function.  V8ClassIndex is a friend of those classes, and it has a big, long, macro'ed switch statement that it uses to return the correct FunctionTemplate based on the passed in V8ClassIndex::WrapperType.  It also creates a cache of these templates, in spite of the fact that each generated class already caches its own FunctionTemplate.  To clean this up:

1. Make GetTemplate() public, un-friend V8ClassIndex
2. Remove the duplicate caching of FunctionTemplates
3. When the type of FunctionTemplate desired is known, call V8<classname>::GetTemplate() directly instead of using V8ClassIndex.
Comment 1 Nate Chapin 2010-02-04 12:02:29 PST
Created attachment 48158 [details]
patch
Comment 2 Dimitri Glazkov (Google) 2010-02-04 15:26:26 PST
Comment on attachment 48158 [details]
patch

sounds good. Are we going to rename GetTemplate() to template(), to match WebKit spirit?
Comment 3 Nate Chapin 2010-02-04 15:42:34 PST
If you'd like.  This patch or a later one?
Comment 4 Dimitri Glazkov (Google) 2010-02-04 17:23:06 PST
l8r.
Comment 5 Nate Chapin 2010-02-05 08:31:41 PST
http://trac.webkit.org/changeset/54425