Changeset 260722 in webkit
- Timestamp:
- Apr 25, 2020, 10:07:21 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/runtime/ExceptionHelpers.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSCJSValue.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSCJSValueInlines.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSCell.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSCellInlines.h (modified) (1 diff)
-
JavaScriptCore/runtime/JSONObject.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/ObjectConstructor.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/ObjectPrototype.cpp (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/js/JSDOMConvertScheduledAction.h (modified) (1 diff)
-
WebCore/worklets/PaintWorkletGlobalScope.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r260720 r260722 1 2020-04-25 Ross Kirsling <ross.kirsling@sony.com> 2 3 [JSC] isCallable is redundant with isFunction 4 https://bugs.webkit.org/show_bug.cgi?id=211037 5 6 Reviewed by Yusuke Suzuki. 7 8 isCallable is only being used in two places and has the same definition as isFunction (aside from out params). 9 Where CallData is needed, getCallData should be used; where CallData is not needed, isFunction should be used. 10 11 * runtime/JSCJSValue.h: 12 * runtime/JSCJSValueInlines.h: 13 (JSC::JSValue::isCallable const): Deleted. 14 * runtime/JSCell.h: 15 * runtime/JSCellInlines.h: 16 (JSC::JSCell::isCallable): Deleted. 17 Remove isCallable. 18 19 * runtime/JSONObject.cpp: 20 (JSC::Stringifier::Stringifier): 21 (JSC::Stringifier::toJSON): 22 Use getCallData if you need CallData. 23 24 * runtime/ExceptionHelpers.cpp: 25 (JSC::errorDescriptionForValue): 26 * runtime/ObjectConstructor.cpp: 27 (JSC::toPropertyDescriptor): 28 * runtime/ObjectPrototype.cpp: 29 (JSC::objectProtoFuncDefineGetter): 30 (JSC::objectProtoFuncDefineSetter): 31 Don't use getCallData if you don't need CallData. 32 1 33 2020-04-25 Yusuke Suzuki <ysuzuki@apple.com> 2 34 -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r254464 r260722 95 95 if (v.isObject()) { 96 96 VM& vm = globalObject->vm(); 97 CallData callData;98 97 JSObject* object = asObject(v); 99 if (object-> methodTable(vm)->getCallData(object, callData) != CallType::None)98 if (object->isFunction(vm)) 100 99 return vm.smallStrings.functionString()->value(globalObject); 101 100 return JSObject::calculatedClassName(object); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r260683 r260722 235 235 bool isEmpty() const; 236 236 bool isFunction(VM&) const; 237 bool isCallable(VM&) const;238 bool isCallable(VM&, CallType&, CallData&) const;239 237 bool isConstructor(VM&) const; 240 238 bool isConstructor(VM&, ConstructType&, ConstructData&) const; -
trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h
r260683 r260722 881 881 return false; 882 882 return asCell()->isFunction(vm); 883 }884 885 inline bool JSValue::isCallable(VM& vm) const886 {887 CallType unusedType;888 CallData unusedData;889 return isCallable(vm, unusedType, unusedData);890 }891 892 inline bool JSValue::isCallable(VM& vm, CallType& callType, CallData& callData) const893 {894 if (!isCell())895 return false;896 return asCell()->isCallable(vm, callType, callData);897 883 } 898 884 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r260331 r260722 109 109 bool isProxy() const; 110 110 bool isFunction(VM&); 111 bool isCallable(VM&, CallType&, CallData&);112 111 bool isConstructor(VM&); 113 112 bool isConstructor(VM&, ConstructType&, ConstructData&); -
trunk/Source/JavaScriptCore/runtime/JSCellInlines.h
r260331 r260722 241 241 } 242 242 243 inline bool JSCell::isCallable(VM& vm, CallType& callType, CallData& callData)244 {245 if (type() != JSFunctionType && !(inlineTypeFlags() & OverridesGetCallData))246 return false;247 callType = methodTable(vm)->getCallData(this, callData);248 return callType != CallType::None;249 }250 251 243 inline bool JSCell::isConstructor(VM& vm) 252 244 { -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r258081 r260722 232 232 JSObject* replacerObject = asObject(m_replacer); 233 233 234 m_replacerCallType = CallType::None;235 if ( !replacerObject->isCallable(vm, m_replacerCallType, m_replacerCallData)) {234 m_replacerCallType = getCallData(vm, replacerObject, m_replacerCallData); 235 if (m_replacerCallType == CallType::None) { 236 236 bool isArrayReplacer = JSC::isArray(globalObject, replacerObject); 237 237 RETURN_IF_EXCEPTION(scope, ); … … 305 305 RETURN_IF_EXCEPTION(scope, { }); 306 306 307 CallType callType;308 307 CallData callData; 309 if (!toJSONFunction.isCallable(vm, callType, callData)) 308 CallType callType = getCallData(vm, toJSONFunction, callData); 309 if (callType == CallType::None) 310 310 return baseValue; 311 311 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r260447 r260722 532 532 JSValue get = description->get(globalObject, vm.propertyNames->get); 533 533 RETURN_IF_EXCEPTION(scope, false); 534 if (!get.isUndefined()) { 535 CallData callData; 536 if (getCallData(vm, get, callData) == CallType::None) { 537 throwTypeError(globalObject, scope, "Getter must be a function."_s); 538 return false; 539 } 534 if (!get.isUndefined() && !get.isFunction(vm)) { 535 throwTypeError(globalObject, scope, "Getter must be a function."_s); 536 return false; 540 537 } 541 538 desc.setGetter(get); … … 548 545 JSValue set = description->get(globalObject, vm.propertyNames->set); 549 546 RETURN_IF_EXCEPTION(scope, false); 550 if (!set.isUndefined()) { 551 CallData callData; 552 if (getCallData(vm, set, callData) == CallType::None) { 553 throwTypeError(globalObject, scope, "Setter must be a function."_s); 554 return false; 555 } 547 if (!set.isUndefined() && !set.isFunction(vm)) { 548 throwTypeError(globalObject, scope, "Setter must be a function."_s); 549 return false; 556 550 } 557 551 desc.setSetter(set); -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r259676 r260722 155 155 156 156 JSValue get = callFrame->argument(1); 157 CallData callData; 158 if (getCallData(vm, get, callData) == CallType::None) 157 if (!get.isFunction(vm)) 159 158 return throwVMTypeError(globalObject, scope, "invalid getter usage"_s); 160 159 … … 183 182 184 183 JSValue set = callFrame->argument(1); 185 CallData callData; 186 if (getCallData(vm, set, callData) == CallType::None) 184 if (!set.isFunction(vm)) 187 185 return throwVMTypeError(globalObject, scope, "invalid setter usage"_s); 188 186 -
trunk/Source/WebCore/ChangeLog
r260719 r260722 1 2020-04-25 Ross Kirsling <ross.kirsling@sony.com> 2 3 [JSC] isCallable is redundant with isFunction 4 https://bugs.webkit.org/show_bug.cgi?id=211037 5 6 Reviewed by Yusuke Suzuki. 7 8 * bindings/js/JSDOMConvertScheduledAction.h: 9 (WebCore::Converter<IDLScheduledAction>::convert): 10 * worklets/PaintWorkletGlobalScope.cpp: 11 (WebCore::PaintWorkletGlobalScope::registerPaint): 12 Don't use getCallData if you don't need CallData. 13 1 14 2020-04-25 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h
r251425 r260722 39 39 auto scope = DECLARE_THROW_SCOPE(vm); 40 40 41 JSC::CallData callData; 42 if (getCallData(vm, value, callData) == JSC::CallType::None) { 41 if (!value.isFunction(vm)) { 43 42 auto code = Converter<IDLDOMString>::convert(lexicalGlobalObject, value); 44 43 RETURN_IF_EXCEPTION(scope, nullptr); -
trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp
r251425 r260722 76 76 77 77 // Validate that paintConstructor is a VoidFunction 78 CallData callData; 79 if (JSC::getCallData(vm, paintConstructor.get(), callData) == JSC::CallType::None) 78 if (!paintConstructor->isFunction(vm)) 80 79 return Exception { TypeError, "paintConstructor must be callable" }; 81 80
Note:
See TracChangeset
for help on using the changeset viewer.