Title: [200374] trunk/Source/WebCore
Revision
200374
Author
[email protected]
Date
2016-05-03 08:44:36 -0700 (Tue, 03 May 2016)

Log Message

Drop some unnecessary exception checking in the generated bindings
https://bugs.webkit.org/show_bug.cgi?id=157299

Reviewed by Darin Adler.

Drop some unnecessary exception checking in the generated bindings.
Only do a check for state->hadException() after converting a JSValue
to a native value when necessary. Update JSValueToNative() to
indicate the caller if converting to the native value may throw an
exception.

This gets rid of a lot of unnecessary branching in the bindings.

No new tests, no intended web-exposed behavior change.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateParametersCheck):
(JSValueToNative):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200373 => 200374)


--- trunk/Source/WebCore/ChangeLog	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/ChangeLog	2016-05-03 15:44:36 UTC (rev 200374)
@@ -1,3 +1,29 @@
+2016-05-03  Chris Dumez  <[email protected]>
+
+        Drop some unnecessary exception checking in the generated bindings
+        https://bugs.webkit.org/show_bug.cgi?id=157299
+
+        Reviewed by Darin Adler.
+
+        Drop some unnecessary exception checking in the generated bindings.
+        Only do a check for state->hadException() after converting a JSValue
+        to a native value when necessary. Update JSValueToNative() to
+        indicate the caller if converting to the native value may throw an
+        exception.
+
+        This gets rid of a lot of unnecessary branching in the bindings.
+
+        No new tests, no intended web-exposed behavior change.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        (GenerateParametersCheck):
+        (JSValueToNative):
+        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+
 2016-05-03  Brady Eidson  <[email protected]>
 
         Add/refactor isolatedCopy methods for 3 IDB classes.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200373 => 200374)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-03 15:44:36 UTC (rev 200374)
@@ -2863,9 +2863,12 @@
                     push(@implContent, "    };\n");
                 }
 
-                push(@implContent, "    " . GetNativeTypeFromSignature($attribute->signature) . " nativeValue = " . JSValueToNative($interface, $attribute->signature, "value", $attribute->signature->extendedAttributes->{"Conditional"}) . ";\n");
-                push(@implContent, "    if (UNLIKELY(state->hadException()))\n");
-                push(@implContent, "        return false;\n");
+                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute->signature, "value", $attribute->signature->extendedAttributes->{"Conditional"});
+                push(@implContent, "    " . GetNativeTypeFromSignature($attribute->signature) . " nativeValue = $nativeValue;\n");
+                if ($mayThrowException) {
+                    push(@implContent, "    if (UNLIKELY(state->hadException()))\n");
+                    push(@implContent, "        return false;\n");
+                }
 
                 if ($codeGenerator->IsEnumType($type)) {
                     push (@implContent, "    if (UNLIKELY(!nativeValue))\n");
@@ -3693,6 +3696,8 @@
                 push(@$outputArray, "    AtomicString $name = state->argument($argsIndex).toString(state)->toExistingAtomicString(state).get();\n");
                 push(@$outputArray, "    if ($name.isNull())\n");
                 push(@$outputArray, "        return JSValue::encode(jsNull());\n");
+                push(@$outputArray, "    if (UNLIKELY(state->hadException()))\n");
+                push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
             } else {
                 my $outer;
                 my $inner;
@@ -3731,13 +3736,14 @@
                     $outer = "";
                     $inner = "state->argument($argsIndex)";
                 }
-                push(@$outputArray, "    $nativeType $name = $outer" . JSValueToNative($interface, $parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");
+                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $inner, $function->signature->extendedAttributes->{"Conditional"});
+                push(@$outputArray, "    $nativeType $name = ${outer}${nativeValue};\n");
+                if ($mayThrowException) {
+                    push(@$outputArray, "    if (UNLIKELY(state->hadException()))\n");
+                    push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
+                }
             }
 
-            # Check if the type conversion succeeded.
-            push(@$outputArray, "    if (UNLIKELY(state->hadException()))\n");
-            push(@$outputArray, "        return JSValue::encode(jsUndefined());\n");
-
             my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($argType) && $interfaceName !~ /List$/;
             my $shouldPassByReference = ShouldPassWrapperByReference($parameter, $interface);
             if ($isTearOff or $shouldPassByReference) {
@@ -4327,6 +4333,7 @@
     "unsigned short" => "toUInt16",
 );
 
+# Returns (convertString, mayThrowException).
 sub JSValueToNative
 {
     my ($interface, $signature, $value, $conditional) = @_;
@@ -4338,54 +4345,54 @@
         my $conversionType = "NormalConversion";
         $conversionType = "EnforceRange" if $signature->extendedAttributes->{"EnforceRange"};
         $conversionType = "Clamp" if $signature->extendedAttributes->{"Clamp"};
-        return "$function(state, $value, $conversionType)";
+        return ("$function(state, $value, $conversionType)", 1);
     }
 
     if ($type eq "DOMString") {
         if ($signature->extendedAttributes->{"TreatNullAs"}) {
-            return "valueToStringTreatingNullAsEmptyString(state, $value)" if $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString";
-            return "valueToStringWithNullCheck(state, $value)" if $signature->extendedAttributes->{"TreatNullAs"} eq "LegacyNullString";
+            return ("valueToStringTreatingNullAsEmptyString(state, $value)", 1) if $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString";
+            return ("valueToStringWithNullCheck(state, $value)", 1) if $signature->extendedAttributes->{"TreatNullAs"} eq "LegacyNullString";
         }
-        return "valueToStringWithUndefinedOrNullCheck(state, $value)" if $signature->isNullable;
-        return "$value.toString(state)->toAtomicString(state)" if $signature->extendedAttributes->{"AtomicString"};
-        return "$value.toWTFString(state)";
+        return ("valueToStringWithUndefinedOrNullCheck(state, $value)", 1) if $signature->isNullable;
+        return ("$value.toString(state)->toAtomicString(state)", 1) if $signature->extendedAttributes->{"AtomicString"};
+        return ("$value.toWTFString(state)", 1);
     }
 
     if ($type eq "SerializedScriptValue") {
         AddToImplIncludes("SerializedScriptValue.h", $conditional);
-        return "SerializedScriptValue::create(state, $value, 0, 0)";
+        return ("SerializedScriptValue::create(state, $value, 0, 0)", 1);
     }
 
     if ($type eq "Dictionary") {
         AddToImplIncludes("Dictionary.h", $conditional);
-        return "{ state, $value }";
+        return ("{ state, $value }", 0);
     }
 
     my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($type);
     if ($arrayOrSequenceType) {
         if ($codeGenerator->IsRefPtrType($arrayOrSequenceType)) {
             AddToImplIncludes("JS${arrayOrSequenceType}.h");
-            return "(toRefPtrNativeArray<${arrayOrSequenceType}, JS${arrayOrSequenceType}>(state, $value, &JS${arrayOrSequenceType}::toWrapped))";
+            return ("(toRefPtrNativeArray<${arrayOrSequenceType}, JS${arrayOrSequenceType}>(state, $value, &JS${arrayOrSequenceType}::toWrapped))", 1);
         }
-        return "toNativeArray<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">(state, $value)";
+        return ("toNativeArray<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">(state, $value)", 1);
     }
 
-    return $value if $type eq "any";
+    return ($value, 0) if $type eq "any";
 
-    return "$value.toBoolean(state)" if $type eq "boolean";
-    return "$value.toNumber(state)" if $type eq "double" or $type eq "unrestricted double";
-    return "$value.toFloat(state)" if $type eq "float" or $type eq "unrestricted float";
-    return "valueToDate(state, $value)" if $type eq "Date";
+    return ("$value.toBoolean(state)", 1) if $type eq "boolean";
+    return ("$value.toNumber(state)", 1) if $type eq "double" or $type eq "unrestricted double";
+    return ("$value.toFloat(state)", 1) if $type eq "float" or $type eq "unrestricted float";
+    return ("valueToDate(state, $value)", 1) if $type eq "Date";
 
-    return "to$type($value)" if $codeGenerator->IsTypedArrayType($type);
-    return "parse" . GetEnumerationClassIdentifier($interface, $type) . "(*state, $value)" if $codeGenerator->IsEnumType($type);
+    return ("to$type($value)", 1) if $codeGenerator->IsTypedArrayType($type);
+    return ("parse" . GetEnumerationClassIdentifier($interface, $type) . "(*state, $value)", 1) if $codeGenerator->IsEnumType($type);
 
     AddToImplIncludes("JS$type.h", $conditional);
 
-    return "toDOMStringList(state, $value)" if $type eq "DOMStringList";
-    return "JSNodeFilter::toWrapped(state->vm(), $value)" if $type eq "NodeFilter";
+    return ("toDOMStringList(state, $value)", 1) if $type eq "DOMStringList";
+    return ("JSNodeFilter::toWrapped(state->vm(), $value)", 1) if $type eq "NodeFilter";
 
-    return "JS${type}::toWrapped($value)";
+    return ("JS${type}::toWrapped($value)", 0);
 }
 
 sub NativeToJSValue

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (200373 => 200374)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2016-05-03 15:44:36 UTC (rev 200374)
@@ -204,8 +204,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     Node* nextChild = JSNode::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!nextChild))
         return throwVMTypeError(state);
     impl.excitingFunction(*nextChild);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (200373 => 200374)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-03 15:44:36 UTC (rev 200374)
@@ -684,8 +684,6 @@
     }
     auto& impl = castedThis->wrapped();
     Node* nativeValue = JSNode::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -754,8 +752,6 @@
     }
     auto& impl = castedThis->wrapped();
     Node* nativeValue = JSNode::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -805,8 +801,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.implementsMethod2(*context, strArg, *objArg, ec)));
@@ -873,8 +867,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(impl, *context, strArg, *objArg, ec)));

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200373 => 200374)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-03 15:44:36 UTC (rev 200374)
@@ -2684,8 +2684,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -2705,8 +2703,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     impl.setTestNullableObjAttr(nativeValue);
     return true;
 }
@@ -2722,8 +2718,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -2760,8 +2754,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3103,8 +3095,6 @@
         return false;
     };
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3197,8 +3187,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3221,8 +3209,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3242,8 +3228,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3266,8 +3250,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3290,8 +3272,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3314,8 +3294,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3338,8 +3316,6 @@
     }
     auto& impl = castedThis->wrapped();
     TestObj* nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     if (UNLIKELY(!nativeValue)) {
         throwVMTypeError(state);
         return false;
@@ -3461,8 +3437,6 @@
     }
     auto& impl = castedThis->wrapped();
     JSC::JSValue nativeValue = value;
-    if (UNLIKELY(state->hadException()))
-        return false;
     impl.setAnyAttribute(nativeValue);
     return true;
 }
@@ -3478,8 +3452,6 @@
     }
     auto& impl = castedThis->wrapped();
     SVGPropertyTearOff<SVGPoint>* nativeValue = JSSVGPoint::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     impl.setMutablePoint(nativeValue);
     return true;
 }
@@ -3495,8 +3467,6 @@
     }
     auto& impl = castedThis->wrapped();
     SVGPropertyTearOff<SVGPoint>* nativeValue = JSSVGPoint::toWrapped(value);
-    if (UNLIKELY(state->hadException()))
-        return false;
     impl.setImmutablePoint(nativeValue);
     return true;
 }
@@ -3775,8 +3745,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     impl.voidMethodWithArgs(longArg, strArg, *objArg);
@@ -3812,8 +3780,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = jsNumber(impl.byteMethodWithArgs(byteArg, strArg, *objArg));
@@ -3849,8 +3815,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = jsNumber(impl.octetMethodWithArgs(octetArg, strArg, *objArg));
@@ -3886,8 +3850,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = jsNumber(impl.longMethodWithArgs(longArg, strArg, *objArg));
@@ -3923,8 +3885,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.objMethodWithArgs(longArg, strArg, *objArg)));
@@ -4090,8 +4050,6 @@
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.methodThatRequiresAllArgsAndThrows(strArg, *objArg, ec)));
@@ -4128,11 +4086,7 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     Dictionary oo = { state, state->argument(0) };
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     Dictionary ooo = { state, state->argument(1) };
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.optionsObject(oo, ooo);
     return JSValue::encode(jsUndefined());
 }
@@ -4768,8 +4722,6 @@
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
     JSC::JSValue a = state->argument(0);
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.methodWithOptionalAny(a);
     return JSValue::encode(jsUndefined());
 }
@@ -4783,8 +4735,6 @@
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
     TestObj* obj = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.methodWithOptionalNullableWrapper(obj);
     return JSValue::encode(jsUndefined());
 }
@@ -4798,8 +4748,6 @@
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
     TestObj* obj = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.methodWithOptionalNullableWrapperIsNull(obj);
     return JSValue::encode(jsUndefined());
 }
@@ -4993,8 +4941,6 @@
     if (UNLIKELY(state->argumentCount() < 2))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     String strArg = state->argument(1).toWTFString(state);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
@@ -5013,8 +4959,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     Optional<int> longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
@@ -5118,8 +5062,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     impl.overloadedMethod(*objArg);
@@ -5240,11 +5182,7 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestObj* objArg1 = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     TestObj* objArg2 = JSTestObj::toWrapped(state->argument(1));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.overloadedMethodWithOptionalParameter(objArg1, objArg2);
     return JSValue::encode(jsUndefined());
 }
@@ -5260,8 +5198,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     Optional<int> longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
@@ -5519,8 +5455,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestNode* value = JSTestNode::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!value))
         return throwVMTypeError(state);
     impl.convert1(*value);
@@ -5538,8 +5472,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     TestNode* value = JSTestNode::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     impl.convert2(value);
     return JSValue::encode(jsUndefined());
 }
@@ -5654,8 +5586,6 @@
     if (UNLIKELY(!state->argument(0).isUndefinedOrNull() && !state->argument(0).inherits(JSTestObj::info())))
         return throwArgumentTypeError(*state, 0, "objArg", "TestObj", "strictFunctionWithSequence", "TestObj");
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     Vector<unsigned> a = toNativeArray<unsigned>(state, state->argument(1));
@@ -5681,8 +5611,6 @@
     if (UNLIKELY(!state->argument(0).isUndefinedOrNull() && !state->argument(0).inherits(JSTestObj::info())))
         return throwArgumentTypeError(*state, 0, "objArg", "TestObj", "strictFunctionWithArray", "TestObj");
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!objArg))
         return throwVMTypeError(state);
     Vector<int> array = toNativeArray<int>(state, state->argument(1));
@@ -5745,8 +5673,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     Node* head = JSNode::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!head))
         return throwVMTypeError(state);
     Vector<Node*> tail;
@@ -5905,8 +5831,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     FetchRequest* request = JSFetchRequest::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!request))
         return throwVMTypeError(state);
     impl.testPromiseOverloadedFunction(*request, DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (200373 => 200374)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2016-05-03 15:39:28 UTC (rev 200373)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2016-05-03 15:44:36 UTC (rev 200374)
@@ -99,8 +99,6 @@
     if (UNLIKELY(state->argumentCount() < 1))
         return throwVMError(state, createNotEnoughArgumentsError(state));
     Blob* blob = JSBlob::toWrapped(state->argument(0));
-    if (UNLIKELY(state->hadException()))
-        return JSValue::encode(jsUndefined());
     if (UNLIKELY(!blob))
         return throwVMTypeError(state);
     RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(*blob);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to