cache parsed interfaces in CodeGenerator.pm

https://bugs.webkit.org/show_bug.cgi?id=113446

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2013-03-27
Reviewed by Kentaro Hara.

When generating binding for an interface, informations about parent
interfaces are sometimes needed several times. This patch caches
those the parsed interface. When generating all WebCore bindings, this
results in a speedup of about 40% for JavaScriptCore and about 80% for
V8.

No new tests: no change in behaviour.

* bindings/scripts/CodeGenerator.pm:
(ParseInterface):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e4ebde0a
2013-03-27 Arnaud Renevier <a.renevier@sisa.samsung.com>
cache parsed interfaces in CodeGenerator.pm
https://bugs.webkit.org/show_bug.cgi?id=113446
Reviewed by Kentaro Hara.
When generating binding for an interface, informations about parent
interfaces are sometimes needed several times. This patch caches
those the parsed interface. When generating all WebCore bindings, this
results in a speedup of about 40% for JavaScriptCore and about 80% for
V8.
No new tests: no change in behaviour.
* bindings/scripts/CodeGenerator.pm:
(ParseInterface):
2013-03-27 KyungTae Kim <ktf.kim@samsung.com> and Yongjun Zhang <yongjun_zhang@apple.com>
Add a settings to disallow initializing background-size if background shorthand doesn't include it.
......@@ -95,6 +95,7 @@ my %svgTypeWithWritablePropertiesNeedingTearOff = (
# Cache of IDL file pathnames.
my $idlFiles;
my $cachedInterfaces = {};
# Default constructor
sub new
......@@ -293,6 +294,10 @@ sub ParseInterface
return undef if $interfaceName eq 'Object';
if (exists $cachedInterfaces->{$interfaceName}) {
return $cachedInterfaces->{$interfaceName};
}
# Step #1: Find the IDL file associated with 'interface'
my $filename = $object->IDLFileForInterface($interfaceName)
or die("Could NOT find IDL file for interface \"$interfaceName\"!\n");
......@@ -304,7 +309,10 @@ sub ParseInterface
my $document = $parser->Parse($filename, $defines, $preprocessor, $parentsOnly);
foreach my $interface (@{$document->interfaces}) {
return $interface if $interface->name eq $interfaceName;
if ($interface->name eq $interfaceName) {
$cachedInterfaces->{$interfaceName} = $interface;
return $interface;
}
}
die("Could NOT find interface definition for $interfaceName in $filename");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment