Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (260721 => 260722)
--- trunk/Source/_javascript_Core/ChangeLog 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-04-26 05:07:21 UTC (rev 260722)
@@ -1,3 +1,35 @@
+2020-04-25 Ross Kirsling <[email protected]>
+
+ [JSC] isCallable is redundant with isFunction
+ https://bugs.webkit.org/show_bug.cgi?id=211037
+
+ Reviewed by Yusuke Suzuki.
+
+ isCallable is only being used in two places and has the same definition as isFunction (aside from out params).
+ Where CallData is needed, getCallData should be used; where CallData is not needed, isFunction should be used.
+
+ * runtime/JSCJSValue.h:
+ * runtime/JSCJSValueInlines.h:
+ (JSC::JSValue::isCallable const): Deleted.
+ * runtime/JSCell.h:
+ * runtime/JSCellInlines.h:
+ (JSC::JSCell::isCallable): Deleted.
+ Remove isCallable.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::toJSON):
+ Use getCallData if you need CallData.
+
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::errorDescriptionForValue):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::toPropertyDescriptor):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ Don't use getCallData if you don't need CallData.
+
2020-04-25 Yusuke Suzuki <[email protected]>
[JSC] Handle BigInt32 INT32_MIN shift amount
Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2020-04-26 05:07:21 UTC (rev 260722)
@@ -94,9 +94,8 @@
return asSymbol(v)->descriptiveString();
if (v.isObject()) {
VM& vm = globalObject->vm();
- CallData callData;
JSObject* object = asObject(v);
- if (object->methodTable(vm)->getCallData(object, callData) != CallType::None)
+ if (object->isFunction(vm))
return vm.smallStrings.functionString()->value(globalObject);
return JSObject::calculatedClassName(object);
}
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.h (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2020-04-26 05:07:21 UTC (rev 260722)
@@ -234,8 +234,6 @@
// Querying the type.
bool isEmpty() const;
bool isFunction(VM&) const;
- bool isCallable(VM&) const;
- bool isCallable(VM&, CallType&, CallData&) const;
bool isConstructor(VM&) const;
bool isConstructor(VM&, ConstructType&, ConstructData&) const;
bool isUndefined() const;
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2020-04-26 05:07:21 UTC (rev 260722)
@@ -882,20 +882,6 @@
return asCell()->isFunction(vm);
}
-inline bool JSValue::isCallable(VM& vm) const
-{
- CallType unusedType;
- CallData unusedData;
- return isCallable(vm, unusedType, unusedData);
-}
-
-inline bool JSValue::isCallable(VM& vm, CallType& callType, CallData& callData) const
-{
- if (!isCell())
- return false;
- return asCell()->isCallable(vm, callType, callData);
-}
-
inline bool JSValue::isConstructor(VM& vm) const
{
if (!isCell())
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2020-04-26 05:07:21 UTC (rev 260722)
@@ -108,7 +108,6 @@
bool isCustomGetterSetter() const;
bool isProxy() const;
bool isFunction(VM&);
- bool isCallable(VM&, CallType&, CallData&);
bool isConstructor(VM&);
bool isConstructor(VM&, ConstructType&, ConstructData&);
bool inherits(VM&, const ClassInfo*) const;
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2020-04-26 05:07:21 UTC (rev 260722)
@@ -240,14 +240,6 @@
return false;
}
-inline bool JSCell::isCallable(VM& vm, CallType& callType, CallData& callData)
-{
- if (type() != JSFunctionType && !(inlineTypeFlags() & OverridesGetCallData))
- return false;
- callType = methodTable(vm)->getCallData(this, callData);
- return callType != CallType::None;
-}
-
inline bool JSCell::isConstructor(VM& vm)
{
ConstructType constructType;
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2020-04-26 05:07:21 UTC (rev 260722)
@@ -231,8 +231,8 @@
if (m_replacer.isObject()) {
JSObject* replacerObject = asObject(m_replacer);
- m_replacerCallType = CallType::None;
- if (!replacerObject->isCallable(vm, m_replacerCallType, m_replacerCallData)) {
+ m_replacerCallType = getCallData(vm, replacerObject, m_replacerCallData);
+ if (m_replacerCallType == CallType::None) {
bool isArrayReplacer = JSC::isArray(globalObject, replacerObject);
RETURN_IF_EXCEPTION(scope, );
if (isArrayReplacer) {
@@ -304,9 +304,9 @@
JSValue toJSONFunction = baseValue.get(m_globalObject, vm.propertyNames->toJSON);
RETURN_IF_EXCEPTION(scope, { });
- CallType callType;
CallData callData;
- if (!toJSONFunction.isCallable(vm, callType, callData))
+ CallType callType = getCallData(vm, toJSONFunction, callData);
+ if (callType == CallType::None)
return baseValue;
MarkedArgumentBuffer args;
Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-04-26 05:07:21 UTC (rev 260722)
@@ -531,12 +531,9 @@
if (hasProperty) {
JSValue get = description->get(globalObject, vm.propertyNames->get);
RETURN_IF_EXCEPTION(scope, false);
- if (!get.isUndefined()) {
- CallData callData;
- if (getCallData(vm, get, callData) == CallType::None) {
- throwTypeError(globalObject, scope, "Getter must be a function."_s);
- return false;
- }
+ if (!get.isUndefined() && !get.isFunction(vm)) {
+ throwTypeError(globalObject, scope, "Getter must be a function."_s);
+ return false;
}
desc.setGetter(get);
} else
@@ -547,12 +544,9 @@
if (hasProperty) {
JSValue set = description->get(globalObject, vm.propertyNames->set);
RETURN_IF_EXCEPTION(scope, false);
- if (!set.isUndefined()) {
- CallData callData;
- if (getCallData(vm, set, callData) == CallType::None) {
- throwTypeError(globalObject, scope, "Setter must be a function."_s);
- return false;
- }
+ if (!set.isUndefined() && !set.isFunction(vm)) {
+ throwTypeError(globalObject, scope, "Setter must be a function."_s);
+ return false;
}
desc.setSetter(set);
} else
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (260721 => 260722)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2020-04-26 05:07:21 UTC (rev 260722)
@@ -154,8 +154,7 @@
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue get = callFrame->argument(1);
- CallData callData;
- if (getCallData(vm, get, callData) == CallType::None)
+ if (!get.isFunction(vm))
return throwVMTypeError(globalObject, scope, "invalid getter usage"_s);
auto propertyName = callFrame->argument(0).toPropertyKey(globalObject);
@@ -182,8 +181,7 @@
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue set = callFrame->argument(1);
- CallData callData;
- if (getCallData(vm, set, callData) == CallType::None)
+ if (!set.isFunction(vm))
return throwVMTypeError(globalObject, scope, "invalid setter usage"_s);
auto propertyName = callFrame->argument(0).toPropertyKey(globalObject);
Modified: trunk/Source/WebCore/ChangeLog (260721 => 260722)
--- trunk/Source/WebCore/ChangeLog 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/WebCore/ChangeLog 2020-04-26 05:07:21 UTC (rev 260722)
@@ -1,3 +1,16 @@
+2020-04-25 Ross Kirsling <[email protected]>
+
+ [JSC] isCallable is redundant with isFunction
+ https://bugs.webkit.org/show_bug.cgi?id=211037
+
+ Reviewed by Yusuke Suzuki.
+
+ * bindings/js/JSDOMConvertScheduledAction.h:
+ (WebCore::Converter<IDLScheduledAction>::convert):
+ * worklets/PaintWorkletGlobalScope.cpp:
+ (WebCore::PaintWorkletGlobalScope::registerPaint):
+ Don't use getCallData if you don't need CallData.
+
2020-04-25 Alex Christensen <[email protected]>
Build fix.
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h (260721 => 260722)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h 2020-04-26 05:07:21 UTC (rev 260722)
@@ -38,8 +38,7 @@
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
- JSC::CallData callData;
- if (getCallData(vm, value, callData) == JSC::CallType::None) {
+ if (!value.isFunction(vm)) {
auto code = Converter<IDLDOMString>::convert(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(scope, nullptr);
return ScheduledAction::create(globalObject.world(), WTFMove(code));
Modified: trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp (260721 => 260722)
--- trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp 2020-04-26 04:57:48 UTC (rev 260721)
+++ trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp 2020-04-26 05:07:21 UTC (rev 260722)
@@ -75,8 +75,7 @@
auto scope = DECLARE_THROW_SCOPE(vm);
// Validate that paintConstructor is a VoidFunction
- CallData callData;
- if (JSC::getCallData(vm, paintConstructor.get(), callData) == JSC::CallType::None)
+ if (!paintConstructor->isFunction(vm))
return Exception { TypeError, "paintConstructor must be callable" };
if (name.isEmpty())