Diff
Modified: trunk/ChangeLog (139330 => 139331)
--- trunk/ChangeLog 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/ChangeLog 2013-01-10 18:25:07 UTC (rev 139331)
@@ -1,3 +1,12 @@
+2013-01-10 Tony Chang <t...@chromium.org>
+
+ Speed up supplemental dependency computation
+ https://bugs.webkit.org/show_bug.cgi?id=106503
+
+ Reviewed by Adam Barth.
+
+ * Source/cmake/WebKitMacros.cmake: Add --idlAttributesFile to the binding generation step in cmake.
+
2013-01-10 Zan Dobersek <zandober...@gmail.com>
[Autotools] Add the AM_WEBKIT_FEATURE_CONDITIONAL macro
Modified: trunk/Source/WebCore/ChangeLog (139330 => 139331)
--- trunk/Source/WebCore/ChangeLog 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/ChangeLog 2013-01-10 18:25:07 UTC (rev 139331)
@@ -1,3 +1,36 @@
+2013-01-10 Tony Chang <t...@chromium.org>
+
+ Speed up supplemental dependency computation
+ https://bugs.webkit.org/show_bug.cgi?id=106503
+
+ Reviewed by Adam Barth.
+
+ On my machine, generating supplemental IDL dependencies was taking about 18s
+ because it has to run the C preprocessor on each IDL file. Avoid this by using
+ a regular _expression_ to find the Supplemental= value in each IDL file rather than
+ doing a full parse. Now generating supplemental IDL dependencies is less than a
+ second.
+
+ preprocess-idls.pl used to also check IDL attributes against IDLAttributes.txt.
+ Move this code to run in generate-bindings.pl. This change revealed that
+ TestRunner.idl uses PassContext so add that to IDLAttributes.txt.
+
+ No new tests, this is a build refactor. EWS bots should be green.
+
+ * DerivedSources.make: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * DerivedSources.pri: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * GNUmakefile.am: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * UseJSC.cmake: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * UseV8.cmake: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * WebCore.gyp/WebCore.gyp: Remove --idlAttributesFile from preprocess-idls.pl and add it to generate-bindings.pl.
+ * bindings/scripts/IDLAttributes.txt: Add PassContext needed by TestRunner.idl.
+ * bindings/scripts/generate-bindings.pl:
+ (loadIDLAttributes): Moved from preprocess-idls.pl.
+ (checkIDLAttributes): Moved from preprocess-idls.pl.
+ (checkIfIDLAttributesExists): Moved from preprocess-idls.pl.
+ * bindings/scripts/preprocess-idls.pl:
+ (getSupplementalFromIDLFile): Helper method to get Supplemental=* quickly.
+
2013-01-10 Max Vujovic <mvujo...@adobe.com>
[CSS Filters] RenderLayerCompositor::addToOverlapMap should take into account the filters outsets (ie. blur and drop-shadow)
Modified: trunk/Source/WebCore/DerivedSources.make (139330 => 139331)
--- trunk/Source/WebCore/DerivedSources.make 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/DerivedSources.make 2013-01-10 18:25:07 UTC (rev 139331)
@@ -944,7 +944,6 @@
bindings/scripts/preprocessor.pm
PREPROCESS_IDLS_SCRIPTS = \
- bindings/scripts/IDLParser.pm \
bindings/scripts/preprocess-idls.pl
generator_script = perl $(addprefix -I $(WebCore)/, $(sort $(dir $(1)))) $(WebCore)/bindings/scripts/generate-bindings.pl
@@ -1000,13 +999,13 @@
space :=
space +=
-$(SUPPLEMENTAL_MAKEFILE_DEPS) : $(PREPROCESS_IDLS_SCRIPTS) $(BINDING_IDLS) $(ADDITIONAL_IDLS) $(IDL_ATTRIBUTES_FILE)
+$(SUPPLEMENTAL_MAKEFILE_DEPS) : $(PREPROCESS_IDLS_SCRIPTS) $(BINDING_IDLS) $(ADDITIONAL_IDLS)
printf "$(subst $(space),,$(patsubst %,%\n,$(BINDING_IDLS) $(ADDITIONAL_IDLS)))" > $(IDL_FILES_TMP)
- $(call preprocess_idls_script, $(PREPROCESS_IDLS_SCRIPTS)) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --idlFilesList $(IDL_FILES_TMP) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) --supplementalMakefileDeps $@ --idlAttributesFile $(IDL_ATTRIBUTES_FILE)
+ $(call preprocess_idls_script, $(PREPROCESS_IDLS_SCRIPTS)) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --idlFilesList $(IDL_FILES_TMP) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) --supplementalMakefileDeps $@
rm -f $(IDL_FILES_TMP)
-JS%.h : %.idl $(JS_BINDINGS_SCRIPTS)
- $(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) $<
+JS%.h : %.idl $(JS_BINDINGS_SCRIPTS) $(IDL_ATTRIBUTES_FILE)
+ $(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --idlAttributesFile $(IDL_ATTRIBUTES_FILE) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) $<
include $(SUPPLEMENTAL_MAKEFILE_DEPS)
Modified: trunk/Source/WebCore/DerivedSources.pri (139330 => 139331)
--- trunk/Source/WebCore/DerivedSources.pri 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/DerivedSources.pri 2013-01-10 18:25:07 UTC (rev 139331)
@@ -729,12 +729,10 @@
preprocessIdls.commands += perl -I$$PWD/bindings/scripts $$preprocessIdls.script \
--defines \"$$_javascript_FeatureDefines()\" \
--idlFilesList $$IDL_FILES_TMP \
- --supplementalDependencyFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE \
- --idlAttributesFile $${IDL_ATTRIBUTES_FILE} \
- --preprocessor \"$${QMAKE_MOC} -E\"
+ --supplementalDependencyFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE
preprocessIdls.output = $$SUPPLEMENTAL_DEPENDENCY_FILE
preprocessIdls.add_output_to_sources = false
-preprocessIdls.depends = $$PWD/bindings/scripts/IDLParser.pm $$IDL_BINDINGS
+preprocessIdls.depends = $$IDL_BINDINGS
GENERATORS += preprocessIdls
# GENERATOR 1: Generate .h and .cpp from IDLs
@@ -771,6 +769,7 @@
--include xml \
--outputDir ${QMAKE_FUNC_FILE_OUT_PATH} \
--supplementalDependencyFile ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE \
+ --idlAttributesFile $${IDL_ATTRIBUTES_FILE} \
--preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME}
generateBindings.output = JS${QMAKE_FILE_BASE}.cpp
generateBindings.depends = ${QMAKE_FUNC_FILE_OUT_PATH}/$$SUPPLEMENTAL_DEPENDENCY_FILE \
@@ -778,7 +777,8 @@
$$PWD/bindings/scripts/CodeGeneratorJS.pm \
$$PWD/bindings/scripts/IDLParser.pm \
$$PWD/bindings/scripts/InFilesParser.pm \
- $$PWD/bindings/scripts/preprocessor.pm
+ $$PWD/bindings/scripts/preprocessor.pm \
+ $$IDL_ATTRIBUTES_FILE
GENERATORS += generateBindings
# GENERATOR 2: inspector idl compiler
Modified: trunk/Source/WebCore/GNUmakefile.am (139330 => 139331)
--- trunk/Source/WebCore/GNUmakefile.am 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/GNUmakefile.am 2013-01-10 18:25:07 UTC (rev 139331)
@@ -419,7 +419,6 @@
$(WebCore)/bindings/scripts/preprocessor.pm
SCRIPTS_FOR_PREPROCESS_IDLS = \
- $(WebCore)/bindings/scripts/IDLParser.pm \
$(WebCore)/bindings/scripts/preprocess-idls.pl
DerivedSources/WebCore/UserAgentStyleSheetsData.cpp: DerivedSources/WebCore/UserAgentStyleSheets.h
@@ -533,23 +532,23 @@
idl_attributes_file = $(WebCore)/bindings/scripts/IDLAttributes.txt
.SECONDARY:
-$(supplemental_dependency_file): $(SCRIPTS_FOR_PREPROCESS_IDLS) $(dom_binding_idls) $(idl_attributes_file)
+$(supplemental_dependency_file): $(SCRIPTS_FOR_PREPROCESS_IDLS) $(dom_binding_idls)
$(AM_V_GEN)
$(AM_V_at)echo -n > $(idl_files_list)
$(AM_V_at)($(foreach idl, $(dom_binding_idls), echo $(idl) &&) echo -n) >> $(idl_files_list)
- $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@ --idlAttributesFile $(idl_attributes_file)
+ $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@
# This does not appear to work correctly with gnumake unless
# it includes an empty command list (the semicolon).
DerivedSources/WebCore/JS%.cpp: DerivedSources/WebCore/JS%.h;
.SECONDARY:
-DerivedSources/WebCore/JS%.h: %.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file)
- $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $<
+DerivedSources/WebCore/JS%.h: %.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file) $(idl_attributes_file)
+ $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --idlAttributesFile $(idl_attributes_file) --supplementalDependencyFile $(supplemental_dependency_file) $<
.SECONDARY:
-DerivedSources/WebCore/JSInternalSettingsGenerated.h: DerivedSources/WebCore/InternalSettingsGenerated.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file)
- $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $<
+DerivedSources/WebCore/JSInternalSettingsGenerated.h: DerivedSources/WebCore/InternalSettingsGenerated.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file) $(idl_attributes_file)
+ $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --idlAttributesFile $(idl_attributes_file) --supplementalDependencyFile $(supplemental_dependency_file) $<
# See https://bugs.webkit.org/show_bug.cgi?id=76388
# We need to introduce a manual dependency to prevent non-generated sources from
Modified: trunk/Source/WebCore/UseJSC.cmake (139330 => 139331)
--- trunk/Source/WebCore/UseJSC.cmake 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/UseJSC.cmake 2013-01-10 18:25:07 UTC (rev 139331)
@@ -314,8 +314,8 @@
add_custom_command(
OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE}
- DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${SCRIPTS_PREPROCESS_IDLS} ${WebCore_IDL_FILES} ${WebCoreTestSupport_IDL_FILES} ${IDL_ATTRIBUTES_FILE}
- COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --idlAttributesFile ${IDL_ATTRIBUTES_FILE}
+ DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${SCRIPTS_PREPROCESS_IDLS} ${WebCore_IDL_FILES} ${WebCoreTestSupport_IDL_FILES}
+ COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE}
VERBATIM)
GENERATE_BINDINGS(WebCore_SOURCES
@@ -324,6 +324,7 @@
"${IDL_INCLUDES}"
"${FEATURE_DEFINES_JAVASCRIPT}"
${DERIVED_SOURCES_WEBCORE_DIR} JS JS
+ ${IDL_ATTRIBUTES_FILE}
${SUPPLEMENTAL_DEPENDENCY_FILE})
GENERATE_BINDINGS(WebCoreTestSupport_SOURCES
@@ -332,4 +333,5 @@
"${IDL_INCLUDES}"
"${FEATURE_DEFINES_JAVASCRIPT}"
${DERIVED_SOURCES_WEBCORE_DIR} JS JS
+ ${IDL_ATTRIBUTES_FILE}
${SUPPLEMENTAL_DEPENDENCY_FILE})
Modified: trunk/Source/WebCore/UseV8.cmake (139330 => 139331)
--- trunk/Source/WebCore/UseV8.cmake 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/UseV8.cmake 2013-01-10 18:25:07 UTC (rev 139331)
@@ -266,7 +266,7 @@
add_custom_command(
OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE}
DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${SCRIPTS_PREPROCESS_IDLS} ${WebCore_IDL_FILES} ${WebCoreTestSupport_IDL_FILES} ${IDL_ATTRIBUTES_FILE}
- COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --idlAttributesFile ${IDL_ATTRIBUTES_FILE}
+ COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE}
VERBATIM)
GENERATE_BINDINGS(WebCore_SOURCES
@@ -275,6 +275,7 @@
"${IDL_INCLUDES}"
"${FEATURE_DEFINES_JAVASCRIPT}"
${DERIVED_SOURCES_WEBCORE_DIR} V8 V8
+ ${IDL_ATTRIBUTES_FILE}
${SUPPLEMENTAL_DEPENDENCY_FILE})
GENERATE_BINDINGS(WebCoreTestSupport_SOURCES
@@ -283,4 +284,5 @@
"${IDL_INCLUDES}"
"${FEATURE_DEFINES_JAVASCRIPT}"
${DERIVED_SOURCES_WEBCORE_DIR} V8 V8
+ ${IDL_ATTRIBUTES_FILE}
${SUPPLEMENTAL_DEPENDENCY_FILE})
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (139330 => 139331)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2013-01-10 18:25:07 UTC (rev 139331)
@@ -567,8 +567,6 @@
},
'inputs': [
'../bindings/scripts/preprocess-idls.pl',
- '../bindings/scripts/IDLParser.pm',
- '../bindings/scripts/IDLAttributes.txt',
'<(idl_files_list)',
'<!@(cat <(idl_files_list))',
],
@@ -587,9 +585,6 @@
'<(idl_files_list)',
'--supplementalDependencyFile',
'<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
- '--idlAttributesFile',
- '../bindings/scripts/IDLAttributes.txt',
- '<@(preprocessor)',
],
'message': 'Resolving [Supplemental=XXX] dependencies in all IDL files',
}
@@ -1168,6 +1163,7 @@
'../bindings/scripts/CodeGenerator.pm',
'../bindings/scripts/CodeGeneratorV8.pm',
'../bindings/scripts/IDLParser.pm',
+ '../bindings/scripts/IDLAttributes.txt',
'../bindings/scripts/preprocessor.pm',
'<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
'<@(webcore_test_support_idl_files)',
@@ -1218,6 +1214,8 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
'--outputDir',
'<(SHARED_INTERMEDIATE_DIR)/webcore/bindings',
+ '--idlAttributesFile',
+ '../bindings/scripts/IDLAttributes.txt',
'--defines',
'<(feature_defines) LANGUAGE_JAVASCRIPT V8_BINDING',
'--generator',
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (139330 => 139331)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2013-01-10 18:25:07 UTC (rev 139331)
@@ -94,6 +94,7 @@
ObjCProtocol
OmitConstructor
Optional=|DefaultIsNullString|DefaultIsUndefined
+PassContext
PassThisToCallback=*
Reflect=*
Replaceable
Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings.pl (139330 => 139331)
--- trunk/Source/WebCore/bindings/scripts/generate-bindings.pl 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings.pl 2013-01-10 18:25:07 UTC (rev 139331)
@@ -51,6 +51,7 @@
my $verbose;
my $supplementalDependencyFile;
my $additionalIdlFiles;
+my $idlAttributesFile;
GetOptions('include=s@' => \@idlDirectories,
'outputDir=s' => \$outputDirectory,
@@ -63,7 +64,8 @@
'verbose' => \$verbose,
'write-dependencies' => \$writeDependencies,
'supplementalDependencyFile=s' => \$supplementalDependencyFile,
- 'additionalIdlFiles=s' => \$additionalIdlFiles);
+ 'additionalIdlFiles=s' => \$additionalIdlFiles,
+ 'idlAttributesFile=s' => \$idlAttributesFile);
my $targetIdlFile = $ARGV[0];
@@ -124,6 +126,11 @@
my $targetParser = IDLParser->new(!$verbose);
my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor);
+if ($idlAttributesFile) {
+ my $idlAttributes = loadIDLAttributes($idlAttributesFile);
+ checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile));
+}
+
foreach my $idlFile (@supplementedIdlFiles) {
next if $idlFile eq $targetIdlFile;
@@ -180,6 +187,8 @@
}
push(@{$targetDataNode->constants}, $constant);
}
+ } else {
+ die "$idlFile is not a supplemental dependency of $targetIdlFile. There maybe a bug in the the supplemental dependency generator (preprocess-idls.pl).\n";
}
}
}
@@ -209,3 +218,86 @@
print FH $contents;
close FH;
}
+
+sub loadIDLAttributes
+{
+ my $idlAttributesFile = shift;
+
+ my %idlAttributes;
+ open FH, "<", $idlAttributesFile or die "Couldn't open $idlAttributesFile: $!";
+ while (my $line = <FH>) {
+ chomp $line;
+ next if $line =~ /^\s*#/;
+ next if $line =~ /^\s*$/;
+
+ if ($line =~ /^\s*([^=\s]*)\s*=?\s*(.*)/) {
+ my $name = $1;
+ $idlAttributes{$name} = {};
+ if ($2) {
+ foreach my $rightValue (split /\|/, $2) {
+ $rightValue =~ s/^\s*|\s*$//g;
+ $rightValue = "VALUE_IS_MISSING" unless $rightValue;
+ $idlAttributes{$name}{$rightValue} = 1;
+ }
+ } else {
+ $idlAttributes{$name}{"VALUE_IS_MISSING"} = 1;
+ }
+ } else {
+ die "The format of " . basename($idlAttributesFile) . " is wrong: line $.\n";
+ }
+ }
+ close FH;
+
+ return \%idlAttributes;
+}
+
+sub checkIDLAttributes
+{
+ my $idlAttributes = shift;
+ my $document = shift;
+ my $idlFile = shift;
+
+ foreach my $interface (@{$document->interfaces}) {
+ checkIfIDLAttributesExists($idlAttributes, $interface->extendedAttributes, $idlFile);
+
+ foreach my $attribute (@{$interface->attributes}) {
+ checkIfIDLAttributesExists($idlAttributes, $attribute->signature->extendedAttributes, $idlFile);
+ }
+
+ foreach my $function (@{$interface->functions}) {
+ checkIfIDLAttributesExists($idlAttributes, $function->signature->extendedAttributes, $idlFile);
+ foreach my $parameter (@{$function->parameters}) {
+ checkIfIDLAttributesExists($idlAttributes, $parameter->extendedAttributes, $idlFile);
+ }
+ }
+ }
+}
+
+sub checkIfIDLAttributesExists
+{
+ my $idlAttributes = shift;
+ my $extendedAttributes = shift;
+ my $idlFile = shift;
+
+ my $error;
+ OUTER: for my $name (keys %$extendedAttributes) {
+ if (!exists $idlAttributes->{$name}) {
+ $error = "Unknown IDL attribute [$name] is found at $idlFile.";
+ last OUTER;
+ }
+ if ($idlAttributes->{$name}{"*"}) {
+ next;
+ }
+ for my $rightValue (split /\s*\|\s*/, $extendedAttributes->{$name}) {
+ if (!exists $idlAttributes->{$name}{$rightValue}) {
+ $error = "Unknown IDL attribute [$name=" . $extendedAttributes->{$name} . "] is found at $idlFile.";
+ last OUTER;
+ }
+ }
+ }
+ if ($error) {
+ die "IDL ATTRIBUTE CHECKER ERROR: $error
+If you want to add a new IDL attribute, you need to add it to WebCore/bindings/scripts/IDLAttributes.txt and add explanations to the WebKit IDL document (https://trac.webkit.org/wiki/WebKitIDL).
+";
+ }
+}
Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (139330 => 139331)
--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2013-01-10 18:25:07 UTC (rev 139331)
@@ -24,21 +24,15 @@
use Getopt::Long;
use Cwd;
-use IDLParser;
-
my $defines;
my $preprocessor;
-my $verbose;
my $idlFilesList;
-my $idlAttributesFile;
my $supplementalDependencyFile;
my $supplementalMakefileDeps;
GetOptions('defines=s' => \$defines,
'preprocessor=s' => \$preprocessor,
- 'verbose' => \$verbose,
'idlFilesList=s' => \$idlFilesList,
- 'idlAttributesFile=s' => \$idlAttributesFile,
'supplementalDependencyFile=s' => \$supplementalDependencyFile,
'supplementalMakefileDeps=s' => \$supplementalMakefileDeps);
@@ -46,49 +40,35 @@
die('Must specify an output file using --supplementalDependencyFile.') unless defined($supplementalDependencyFile);
die('Must specify the file listing all IDLs using --idlFilesList.') unless defined($idlFilesList);
-if ($verbose) {
- print "Resolving [Supplemental=XXX] dependencies in all IDL files.\n";
-}
-
open FH, "< $idlFilesList" or die "Cannot open $idlFilesList\n";
my @idlFiles = <FH>;
chomp(@idlFiles);
close FH;
# Parse all IDL files.
-my %documents;
my %interfaceNameToIdlFile;
my %idlFileToInterfaceName;
+my %supplementalDependencies;
+my %supplementals;
foreach my $idlFile (@idlFiles) {
my $fullPath = Cwd::realpath($idlFile);
- my $parser = IDLParser->new(!$verbose);
- $documents{$fullPath} = $parser->Parse($idlFile, $defines, $preprocessor);
+ my $supplemental = getSupplementalFromIDLFile($fullPath);
+ if ($supplemental) {
+ $supplementalDependencies{$fullPath} = $supplemental;
+ }
my $interfaceName = fileparse(basename($idlFile), ".idl");
$interfaceNameToIdlFile{$interfaceName} = $fullPath;
$idlFileToInterfaceName{$fullPath} = $interfaceName;
+ $supplementals{$fullPath} = [];
}
-# Runs the IDL attribute checker.
-my $idlAttributes = loadIDLAttributes($idlAttributesFile);
-foreach my $idlFile (keys %documents) {
- checkIDLAttributes($idlAttributes, $documents{$idlFile}, basename($idlFile));
-}
-
# Resolves [Supplemental=XXX] dependencies.
-my %supplementals;
-foreach my $idlFile (keys %documents) {
- $supplementals{$idlFile} = [];
+foreach my $idlFile (keys %supplementalDependencies) {
+ my $baseFile = $supplementalDependencies{$idlFile};
+ my $targetIdlFile = $interfaceNameToIdlFile{$baseFile};
+ push(@{$supplementals{$targetIdlFile}}, $idlFile);
+ delete $supplementals{$idlFile};
}
-foreach my $idlFile (keys %documents) {
- foreach my $interface (@{$documents{$idlFile}->interfaces}) {
- if ($interface->extendedAttributes->{"Supplemental"}) {
- my $targetIdlFile = $interfaceNameToIdlFile{$interface->extendedAttributes->{"Supplemental"}};
- push(@{$supplementals{$targetIdlFile}}, $idlFile);
- # Treats as if this IDL file does not exist.
- delete $supplementals{$idlFile};
- }
- }
-}
# Outputs the dependency.
# The format of a supplemental dependency file:
@@ -130,85 +110,21 @@
}
-sub loadIDLAttributes
+sub getSupplementalFromIDLFile
{
- my $idlAttributesFile = shift;
-
- my %idlAttributes;
- open FH, "<", $idlAttributesFile or die "Couldn't open $idlAttributesFile: $!";
- while (my $line = <FH>) {
- chomp $line;
- next if $line =~ /^\s*#/;
- next if $line =~ /^\s*$/;
-
- if ($line =~ /^\s*([^=\s]*)\s*=?\s*(.*)/) {
- my $name = $1;
- $idlAttributes{$name} = {};
- if ($2) {
- foreach my $rightValue (split /\|/, $2) {
- $rightValue =~ s/^\s*|\s*$//g;
- $rightValue = "VALUE_IS_MISSING" unless $rightValue;
- $idlAttributes{$name}{$rightValue} = 1;
- }
- } else {
- $idlAttributes{$name}{"VALUE_IS_MISSING"} = 1;
- }
- } else {
- die "The format of " . basename($idlAttributesFile) . " is wrong: line $.\n";
- }
- }
- close FH;
-
- return \%idlAttributes;
-}
-
-sub checkIDLAttributes
-{
- my $idlAttributes = shift;
- my $document = shift;
my $idlFile = shift;
- foreach my $interface (@{$document->interfaces}) {
- checkIfIDLAttributesExists($idlAttributes, $interface->extendedAttributes, $idlFile);
+ open FILE, "<", $idlFile;
+ my @lines = <FILE>;
+ close FILE;
- foreach my $attribute (@{$interface->attributes}) {
- checkIfIDLAttributesExists($idlAttributes, $attribute->signature->extendedAttributes, $idlFile);
- }
-
- foreach my $function (@{$interface->functions}) {
- checkIfIDLAttributesExists($idlAttributes, $function->signature->extendedAttributes, $idlFile);
- foreach my $parameter (@{$function->parameters}) {
- checkIfIDLAttributesExists($idlAttributes, $parameter->extendedAttributes, $idlFile);
+ my $fileContents = join('', @lines);
+ while ($fileContents =~ /\[(.*?)\] interface (\w+)/gs) {
+ my @attributes = split(',', $1);
+ foreach (@attributes) {
+ if (/Supplemental=(\w+)/) {
+ return $1;
}
}
}
}
-
-sub checkIfIDLAttributesExists
-{
- my $idlAttributes = shift;
- my $extendedAttributes = shift;
- my $idlFile = shift;
-
- my $error;
- OUTER: for my $name (keys %$extendedAttributes) {
- if (!exists $idlAttributes->{$name}) {
- $error = "Unknown IDL attribute [$name] is found at $idlFile.";
- last OUTER;
- }
- if ($idlAttributes->{$name}{"*"}) {
- next;
- }
- for my $rightValue (split /\s*\|\s*/, $extendedAttributes->{$name}) {
- if (!exists $idlAttributes->{$name}{$rightValue}) {
- $error = "Unknown IDL attribute [$name=" . $extendedAttributes->{$name} . "] is found at $idlFile.";
- last OUTER;
- }
- }
- }
- if ($error) {
- die "IDL ATTRIBUTE CHECKER ERROR: $error
-If you want to add a new IDL attribute, you need to add it to WebCore/bindings/scripts/IDLAttributes.txt and add explanations to the WebKit IDL document (https://trac.webkit.org/wiki/WebKitIDL).
-";
- }
-}
Modified: trunk/Source/cmake/WebKitMacros.cmake (139330 => 139331)
--- trunk/Source/cmake/WebKitMacros.cmake 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Source/cmake/WebKitMacros.cmake 2013-01-10 18:25:07 UTC (rev 139331)
@@ -34,7 +34,7 @@
# _prefix is a prefix of output files. (eg. JS - it makes JSXXX.cpp JSXXX.h from XXX.idl)
# _generator is a value of --generator argument.
# _supplemental_dependency_file is a value of --supplementalDependencyFile. (optional)
-macro(GENERATE_BINDINGS _output_source _input_files _base_dir _idl_includes _features _destination _prefix _generator)
+macro(GENERATE_BINDINGS _output_source _input_files _base_dir _idl_includes _features _destination _prefix _generator _idl_attributes_file)
set(BINDING_GENERATOR ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl)
set(_supplemental_dependency_file ${ARGN})
@@ -48,8 +48,8 @@
add_custom_command(
OUTPUT ${_destination}/${_prefix}${_name}.cpp ${_destination}/${_prefix}${_name}.h
MAIN_DEPENDENCY ${_file}
- DEPENDS ${BINDING_GENERATOR} ${SCRIPTS_BINDINGS} ${_supplemental_dependency_file}
- COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${BINDING_GENERATOR} --defines "${_features}" --generator ${_generator} ${_idl_includes} --outputDir "${_destination}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" ${_supplemental_dependency} ${_file}
+ DEPENDS ${BINDING_GENERATOR} ${SCRIPTS_BINDINGS} ${_supplemental_dependency_file} ${_idl_attributes_file}
+ COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${BINDING_GENERATOR} --defines "${_features}" --generator ${_generator} ${_idl_includes} --outputDir "${_destination}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --idlAttributesFile ${_idl_attributes_file} ${_supplemental_dependency} ${_file}
WORKING_DIRECTORY ${_base_dir}
VERBATIM)
Modified: trunk/Tools/ChangeLog (139330 => 139331)
--- trunk/Tools/ChangeLog 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Tools/ChangeLog 2013-01-10 18:25:07 UTC (rev 139331)
@@ -1,3 +1,14 @@
+2013-01-10 Tony Chang <t...@chromium.org>
+
+ Speed up supplemental dependency computation
+ https://bugs.webkit.org/show_bug.cgi?id=106503
+
+ Reviewed by Adam Barth.
+
+ Pass the IDL attributes file for generating the bindings in WebKitTestRunner.
+
+ * WebKitTestRunner/CMakeLists.txt:
+
2013-01-10 Zan Dobersek <zandober...@gmail.com>
Remove the ENABLE_ANIMATION_API feature define occurences
Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (139330 => 139331)
--- trunk/Tools/WebKitTestRunner/CMakeLists.txt 2013-01-10 18:16:00 UTC (rev 139330)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt 2013-01-10 18:25:07 UTC (rev 139331)
@@ -82,7 +82,7 @@
"--include=${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings"
"${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}"
${DERIVED_SOURCES_DIR}/InjectedBundle JS TestRunner
- )
+ ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
INCLUDE_IF_EXISTS(${WEBKIT_TESTRUNNER_DIR}/Platform${PORT}.cmake)