Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: Source/bindings/scripts/deprecated_code_generator_v8.pm

Issue 23471005: Use UNLIKELY() macro in generated bindings for minimum argument count checks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8Float64Array.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/deprecated_code_generator_v8.pm
diff --git a/Source/bindings/scripts/deprecated_code_generator_v8.pm b/Source/bindings/scripts/deprecated_code_generator_v8.pm
index 2fafb0f8ca417528c20d663623230d155913e627..46b05838fdfebddf0451f868b9269873a3dbc1d0 100644
--- a/Source/bindings/scripts/deprecated_code_generator_v8.pm
+++ b/Source/bindings/scripts/deprecated_code_generator_v8.pm
@@ -2085,7 +2085,7 @@ END
$code .= " }\n";
}
if ($leastNumMandatoryParams >= 1) {
- $code .= " if (args.Length() < $leastNumMandatoryParams) {\n";
+ $code .= " if (UNLIKELY(args.Length() < $leastNumMandatoryParams)) {\n";
$code .= " throwNotEnoughArgumentsError(args.GetIsolate());\n";
$code .= " return;\n";
$code .= " }\n";
@@ -2326,7 +2326,7 @@ sub GenerateArgumentsCountCheck
my $argumentsCountCheckString = "";
if ($numMandatoryParams >= 1) {
- $argumentsCountCheckString .= " if (args.Length() < $numMandatoryParams) {\n";
+ $argumentsCountCheckString .= " if (UNLIKELY(args.Length() < $numMandatoryParams)) {\n";
$argumentsCountCheckString .= " throwNotEnoughArgumentsError(args.GetIsolate());\n";
$argumentsCountCheckString .= " return;\n";
$argumentsCountCheckString .= " }\n";
@@ -2352,7 +2352,7 @@ sub GenerateParametersCheck
# Optional arguments with [Optional=...] should not generate the early call.
# Optional Dictionary arguments always considered to have default of empty dictionary.
if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default"} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) {
- $parameterCheckString .= " if (args.Length() <= $paramIndex)";
+ $parameterCheckString .= " if (UNLIKELY(args.Length() <= $paramIndex))";
my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $interface, $forMainWorldSuffix, %replacements);
my $multiLine = ($functionCall =~ tr/\n//) > 1;
$parameterCheckString .= $multiLine ? " {\n" : "\n";
@@ -2492,7 +2492,7 @@ END
$code .= " }\n";
}
if ($leastNumMandatoryParams >= 1) {
- $code .= " if (args.Length() < $leastNumMandatoryParams) {\n";
+ $code .= " if (UNLIKELY(args.Length() < $leastNumMandatoryParams)) {\n";
$code .= " throwNotEnoughArgumentsError(args.GetIsolate());\n";
$code .= " return;\n";
$code .= " }\n";
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8Float64Array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698