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.
Created attachment 48158 [details]
Comment on attachment 48158 [details]
sounds good. Are we going to rename GetTemplate() to template(), to match WebKit spirit?
If you'd like. This patch or a later one?