Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Binding] Use unchekcedArgument if argumentCount is already checked
https://bugs.webkit.org/show_bug.cgi?id=162502

Reviewed by Geoffrey Garen.

It is not necessary to use `exec->argument(n)` after checking the argument exists.
This patch changes `argument(n)` to `uncheckedArgument(n)` if we already proved that
the argument exists. This change drops branches generated by `exec->argument(n)`.
And it is good for small DOM operations in which DOM binding code occupies large
part of entire processing. This patch and another small patch[1] offer roughly 5%
improvement in Dromaeo dom-attr's getAttribute and setAttribute tests.

[1]: https://bugs.webkit.org/show_bug.cgi?id=162503

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck): GenerateParameterCheck requires GenerateArgumentsCountCheck.
As a result, existence of mandatory arguments are already checked. We can use `uncheckedArgument(n)`
for mandatory arguments.
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::construct):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorNamedConstructor::construct):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjConstructor::construct):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
(WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod):
(WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionOptionsObject):
(WebCore::jsTestObjPrototypeFunctionPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionAddEventListener):
(WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
(WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
(WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
(WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
(WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence):
(WebCore::jsTestObjPrototypeFunctionGetElementById):
(WebCore::jsTestObjPrototypeFunctionConvert1):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionConvert3):
(WebCore::jsTestObjPrototypeFunctionConvert4):
(WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
(WebCore::jsTestObjPrototypeFunctionAny):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::constructJSTestOverloadedConstructors1):
(WebCore::constructJSTestOverloadedConstructors2):
(WebCore::constructJSTestOverloadedConstructors3):
(WebCore::constructJSTestOverloadedConstructors4):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::constructJSTestOverloadedConstructorsWithSequence2):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefsConstructor::construct):
(WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2):
(WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):

Canonical link: https://commits.webkit.org/180467@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Constellation committed Sep 23, 2016
1 parent e5b0935 commit 03d6534
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 126 deletions.
126 changes: 126 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,129 @@
2016-09-23 Yusuke Suzuki <utatane.tea@gmail.com>

[Binding] Use unchekcedArgument if argumentCount is already checked
https://bugs.webkit.org/show_bug.cgi?id=162502

Reviewed by Geoffrey Garen.

It is not necessary to use `exec->argument(n)` after checking the argument exists.
This patch changes `argument(n)` to `uncheckedArgument(n)` if we already proved that
the argument exists. This change drops branches generated by `exec->argument(n)`.
And it is good for small DOM operations in which DOM binding code occupies large
part of entire processing. This patch and another small patch[1] offer roughly 5%
improvement in Dromaeo dom-attr's getAttribute and setAttribute tests.

[1]: https://bugs.webkit.org/show_bug.cgi?id=162503

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck): GenerateParameterCheck requires GenerateArgumentsCountCheck.
As a result, existence of mandatory arguments are already checked. We can use `uncheckedArgument(n)`
for mandatory arguments.
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::jsTestEventTargetPrototypeFunctionItem):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::construct):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorNamedConstructor::construct):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjConstructor::construct):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
(WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod):
(WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionOptionsObject):
(WebCore::jsTestObjPrototypeFunctionPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod):
(WebCore::jsTestObjPrototypeFunctionAddEventListener):
(WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
(WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
(WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
(WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
(WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence):
(WebCore::jsTestObjPrototypeFunctionGetElementById):
(WebCore::jsTestObjPrototypeFunctionConvert1):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionConvert3):
(WebCore::jsTestObjPrototypeFunctionConvert4):
(WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
(WebCore::jsTestObjPrototypeFunctionAny):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::constructJSTestOverloadedConstructors1):
(WebCore::constructJSTestOverloadedConstructors2):
(WebCore::constructJSTestOverloadedConstructors3):
(WebCore::constructJSTestOverloadedConstructors4):
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
(WebCore::constructJSTestOverloadedConstructorsWithSequence2):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::JSTestTypedefsConstructor::construct):
(WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2):
(WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):

2016-09-23 Alex Christensen <achristensen@webkit.org>

Refactor URLParser
Expand Down
21 changes: 14 additions & 7 deletions Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Expand Up @@ -3987,10 +3987,11 @@ sub GenerateParametersCheck
}
push(@$outputArray, " }\n");
} else {
die "CallbackInterface does not support Variadic parameter" if $parameter->isVariadic;
if ($codeGenerator->IsFunctionOnlyCallbackInterface($type)) {
push(@$outputArray, " if (UNLIKELY(!state->argument($argumentIndex).isFunction()))\n");
push(@$outputArray, " if (UNLIKELY(!state->uncheckedArgument($argumentIndex).isFunction()))\n");
} else {
push(@$outputArray, " if (UNLIKELY(!state->argument($argumentIndex).isObject()))\n");
push(@$outputArray, " if (UNLIKELY(!state->uncheckedArgument($argumentIndex).isObject()))\n");
}
push(@$outputArray, " return throwArgumentMustBeFunctionError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName);\n");
if ($function->isStatic) {
Expand Down Expand Up @@ -4026,13 +4027,16 @@ sub GenerateParametersCheck
my $defineOptionalValue = "auto optionalValue";
my $indent = "";

die "Variadic parameter is already handled here" if $parameter->isVariadic;
my $argumentLookupMethod = $parameter->isOptional ? "argument" : "uncheckedArgument";

if ($parameter->isOptional && !defined($parameter->default)) {
$nativeType = "Optional<$className>";
$optionalValue = $name;
$defineOptionalValue = $name;
}

push(@$outputArray, " auto ${name}Value = state->argument($argumentIndex);\n");
push(@$outputArray, " auto ${name}Value = state->$argumentLookupMethod($argumentIndex);\n");
push(@$outputArray, " $nativeType $name;\n");

if ($parameter->isOptional) {
Expand Down Expand Up @@ -4061,9 +4065,12 @@ sub GenerateParametersCheck
my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($type) && $interfaceName !~ /List$/;
my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($parameter, $interface);

die "Variadic parameter is already handled here" if $parameter->isVariadic;
my $argumentLookupMethod = $parameter->isOptional ? "argument" : "uncheckedArgument";

if (!$shouldPassByReference && $codeGenerator->IsWrapperType($type)) {
$implIncludes{"<runtime/Error.h>"} = 1;
my $checkedArgument = "state->argument($argumentIndex)";
my $checkedArgument = "state->$argumentLookupMethod($argumentIndex)";
my $uncheckedArgument = "state->uncheckedArgument($argumentIndex)";
my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $uncheckedArgument, $function->signature->extendedAttributes->{"Conditional"});
push(@$outputArray, " $nativeType $name = nullptr;\n");
Expand Down Expand Up @@ -4098,15 +4105,15 @@ sub GenerateParametersCheck
$defaultValue = "JSValue::JSUndefined" if $defaultValue eq "undefined";
}

$outer = "state->argument($argumentIndex).isUndefined() ? $defaultValue : ";
$outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : ";
$inner = "state->uncheckedArgument($argumentIndex)";
} elsif ($parameter->isOptional && !defined($parameter->default)) {
# Use WTF::Optional<>() for optional parameters that are missing or undefined and that do not have a default value in the IDL.
$outer = "state->argument($argumentIndex).isUndefined() ? Optional<$nativeType>() : ";
$outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? Optional<$nativeType>() : ";
$inner = "state->uncheckedArgument($argumentIndex)";
} else {
$outer = "";
$inner = "state->argument($argumentIndex)";
$inner = "state->$argumentLookupMethod($argumentIndex)";
}

my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $inner, $function->signature->extendedAttributes->{"Conditional"});
Expand Down
Expand Up @@ -203,7 +203,7 @@ EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunct
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto nextChild = JSNode::toWrapped(state->argument(0));
auto nextChild = JSNode::toWrapped(state->uncheckedArgument(0));
if (UNLIKELY(!nextChild))
return throwArgumentTypeError(*state, throwScope, 0, "nextChild", "TestActiveDOMObject", "excitingFunction", "Node");
impl.excitingFunction(*nextChild);
Expand All @@ -223,7 +223,7 @@ EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(E
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto message = state->argument(0).toWTFString(state);
auto message = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
impl.postMessage(WTFMove(message));
Expand Down
Expand Up @@ -200,7 +200,7 @@ EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunc
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto str = state->argument(0).toWTFString(state);
auto str = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
impl.anotherFunction(WTFMove(str));
Expand Down
Expand Up @@ -213,7 +213,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(ExecState* s
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion);
auto index = convert<uint32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
JSValue result = toJS(state, castedThis->globalObject(), impl.item(WTFMove(index)));
Expand Down
Expand Up @@ -375,7 +375,7 @@ EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionRegularOperation(
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto testParam = state->argument(0).toWTFString(state);
auto testParam = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
impl.regularOperation(WTFMove(testParam));
Expand All @@ -396,7 +396,7 @@ static inline EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeO
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto testParam = state->argument(0).toWTFString(state);
auto testParam = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(WTFMove(testParam));
Expand All @@ -419,7 +419,7 @@ static inline EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeO
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto testParam = convert<int32_t>(*state, state->argument(0), NormalConversion);
auto testParam = convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(WTFMove(testParam));
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Expand Up @@ -230,7 +230,7 @@ template<> EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::construct(Ex
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto str1 = state->argument(0).toWTFString(state);
auto str1 = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state);
Expand Down Expand Up @@ -859,10 +859,10 @@ EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionImplementsMethod2(E
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
if (!context)
return JSValue::encode(jsUndefined());
auto strArg = state->argument(0).toWTFString(state);
auto strArg = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
auto objArg = JSTestObj::toWrapped(state->argument(1));
auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
if (UNLIKELY(!objArg))
return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestInterface", "implementsMethod2", "TestObj");
JSValue result = toJS(state, castedThis->globalObject(), impl.implementsMethod2(*context, WTFMove(strArg), *objArg, ec));
Expand Down Expand Up @@ -937,10 +937,10 @@ EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
if (!context)
return JSValue::encode(jsUndefined());
auto strArg = state->argument(0).toWTFString(state);
auto strArg = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(throwScope.exception()))
return JSValue::encode(jsUndefined());
auto objArg = JSTestObj::toWrapped(state->argument(1));
auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
if (UNLIKELY(!objArg))
return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestInterface", "supplementalMethod2", "TestObj");
JSValue result = toJS(state, castedThis->globalObject(), WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg, ec));
Expand Down
Expand Up @@ -165,7 +165,7 @@ EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isFunction()))
if (UNLIKELY(!state->uncheckedArgument(0).isFunction()))
return throwArgumentMustBeFunctionError(*state, throwScope, 0, "listener", "TestMediaQueryListListener", "method");
auto listener = JSMediaQueryListListener::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
impl.method(WTFMove(listener));
Expand Down

0 comments on commit 03d6534

Please sign in to comment.