Diff
Modified: trunk/Source/_javascript_Core/API/JSContextRef.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/API/JSContextRef.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/API/JSContextRef.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -262,7 +262,7 @@
JSLockHolder locker(vm);
JSObject* object = toJS(function);
- if (!object->isFunction(vm)) {
+ if (!object->isCallable(vm)) {
*exception = toRef(createTypeError(globalObject));
return;
}
Modified: trunk/Source/_javascript_Core/API/JSObjectRef.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/API/JSObjectRef.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/API/JSObjectRef.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -706,7 +706,7 @@
VM& vm = globalObject->vm();
JSLockHolder locker(vm);
JSCell* cell = toJS(object);
- return cell->isFunction(vm);
+ return cell->isCallable(vm);
}
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
Modified: trunk/Source/_javascript_Core/ChangeLog (260847 => 260848)
--- trunk/Source/_javascript_Core/ChangeLog 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-04-28 21:51:37 UTC (rev 260848)
@@ -1,3 +1,78 @@
+2020-04-28 Ross Kirsling <[email protected]>
+
+ [JSC] Align upon the name isCallable instead of isFunction
+ https://bugs.webkit.org/show_bug.cgi?id=211140
+
+ Reviewed by Darin Adler.
+
+ Follow-up to r260722. Usage is now cleanly separated between isFunction / getCallData,
+ but the name isCallable is still clearer than isFunction so let's flip that after all.
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextSetUnhandledRejectionCallback):
+ * API/JSObjectRef.cpp:
+ (JSObjectIsFunction):
+ * dfg/DFGOperations.cpp:
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis):
+ (JSC::FTL::DFG::LowerDFGToB3::compileCreatePromise):
+ (JSC::FTL::DFG::LowerDFGToB3::compileCreateInternalFieldObject):
+ (JSC::FTL::DFG::LowerDFGToB3::compileIsObjectOrNull):
+ (JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
+ (JSC::FTL::DFG::LowerDFGToB3::buildTypeOf):
+ (JSC::FTL::DFG::LowerDFGToB3::isCallable):
+ (JSC::FTL::DFG::LowerDFGToB3::isFunction): Deleted.
+ * ftl/FTLOperations.cpp:
+ (JSC::FTL::operationTypeOfObjectAsTypeofType):
+ * jsc.cpp:
+ (functionSetUnhandledRejectionCallback):
+ * runtime/CommonSlowPaths.cpp:
+ (JSC::SLOW_PATH_DECL):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::errorDescriptionForValue):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/InternalFunction.cpp:
+ (JSC::getFunctionRealm):
+ * runtime/JSCJSValue.h:
+ * runtime/JSCJSValueInlines.h:
+ (JSC::JSValue::isCallable const):
+ (JSC::JSValue::isFunction const): Deleted.
+ * runtime/JSCell.h:
+ * runtime/JSCellInlines.h:
+ (JSC::JSCell::isCallable):
+ (JSC::JSCell::isFunction): Deleted.
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::toPropertyDescriptor):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ * runtime/Operations.cpp:
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectTypeOrNull):
+ * runtime/ProxyObject.cpp:
+ (JSC::ProxyObject::structureForTarget):
+ (JSC::ProxyObject::finishCreation):
+ * runtime/RuntimeType.cpp:
+ (JSC::runtimeTypeForValue):
+ * tools/JSDollarVM.cpp:
+ (JSC::functionCallWithStackSize):
+ (JSC::functionFindTypeForExpression):
+ (JSC::functionReturnTypeFor):
+ (JSC::functionHasBasicBlockExecuted):
+ (JSC::functionBasicBlockExecutionCount):
+ * wasm/WasmInstance.cpp:
+ (JSC::Wasm::Instance::setFunctionWrapper):
+ * wasm/WasmOperations.cpp:
+ (JSC::Wasm::operationIterateResults):
+ (JSC::Wasm::operationWasmRefFunc):
+ * wasm/js/WebAssemblyModuleRecord.cpp:
+ (JSC::WebAssemblyModuleRecord::link):
+ * wasm/js/WebAssemblyWrapperFunction.cpp:
+ (JSC::WebAssemblyWrapperFunction::finishCreation):
+
2020-04-28 Yusuke Suzuki <[email protected]>
[JSC] NumberConstructor should accept BigInt
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -2143,7 +2143,7 @@
if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return false;
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return false;
return true;
}
@@ -2158,7 +2158,7 @@
if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return false;
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return true;
return false;
}
@@ -2173,7 +2173,7 @@
if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return vm.smallStrings.undefinedString();
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return vm.smallStrings.functionString();
return vm.smallStrings.objectString();
}
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -6972,7 +6972,7 @@
LBasicBlock slowPath = m_out.newBlock();
LBasicBlock continuation = m_out.newBlock();
- m_out.branch(isFunction(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowPath));
+ m_out.branch(isCallable(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowPath));
LBasicBlock lastNext = m_out.appendTo(isFunctionBlock, hasRareData);
LValue rareDataTags = m_out.loadPtr(callee, m_heaps.JSFunction_executableOrRareData);
@@ -7017,7 +7017,7 @@
m_out.branch(m_out.equal(callee, weakPointer(m_node->isInternalPromise() ? globalObject->internalPromiseConstructor() : globalObject->promiseConstructor())), unsure(fastAllocationCase), unsure(derivedCase));
LBasicBlock lastNext = m_out.appendTo(derivedCase, isFunctionBlock);
- m_out.branch(isFunction(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowCase));
+ m_out.branch(isCallable(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowCase));
m_out.appendTo(isFunctionBlock, hasRareData);
LValue rareDataTags = m_out.loadPtr(callee, m_heaps.JSFunction_executableOrRareData);
@@ -7072,7 +7072,7 @@
LBasicBlock slowCase = m_out.newBlock();
LBasicBlock continuation = m_out.newBlock();
- m_out.branch(isFunction(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowCase));
+ m_out.branch(isCallable(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowCase));
LBasicBlock lastNext = m_out.appendTo(isFunctionBlock, hasRareData);
LValue rareDataTags = m_out.loadPtr(callee, m_heaps.JSFunction_executableOrRareData);
@@ -11568,7 +11568,7 @@
LBasicBlock lastNext = m_out.appendTo(cellCase, notFunctionCase);
ValueFromBlock isFunctionResult = m_out.anchor(m_out.booleanFalse);
m_out.branch(
- isFunction(value, provenType(child)),
+ isCallable(value, provenType(child)),
unsure(continuation), unsure(notFunctionCase));
m_out.appendTo(notFunctionCase, objectCase);
@@ -11625,7 +11625,7 @@
LBasicBlock lastNext = m_out.appendTo(cellCase, notFunctionCase);
ValueFromBlock functionResult = m_out.anchor(m_out.booleanTrue);
m_out.branch(
- isFunction(value, provenType(child)),
+ isCallable(value, provenType(child)),
unsure(continuation), unsure(notFunctionCase));
m_out.appendTo(notFunctionCase, slowPath);
@@ -16194,7 +16194,7 @@
m_out.appendTo(objectCase, functionCase);
m_out.branch(
- isFunction(value, provenType(child) & SpecObject),
+ isCallable(value, provenType(child) & SpecObject),
unsure(functionCase), unsure(notFunctionCase));
m_out.appendTo(functionCase, notFunctionCase);
@@ -17899,7 +17899,7 @@
}
}
- LValue isFunction(LValue cell, SpeculatedType type = SpecFullTop)
+ LValue isCallable(LValue cell, SpeculatedType type = SpecFullTop)
{
if (LValue proven = isProvenValue(type & SpecCell, SpecFunction))
return proven;
Modified: trunk/Source/_javascript_Core/ftl/FTLOperations.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/ftl/FTLOperations.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/ftl/FTLOperations.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -721,7 +721,7 @@
if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return static_cast<int32_t>(TypeofType::Undefined);
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return static_cast<int32_t>(TypeofType::Function);
return static_cast<int32_t>(TypeofType::Object);
}
Modified: trunk/Source/_javascript_Core/jsc.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/jsc.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/jsc.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -2485,7 +2485,7 @@
JSObject* object = callFrame->argument(0).getObject();
auto scope = DECLARE_THROW_SCOPE(vm);
- if (!object || !object->isFunction(vm))
+ if (!object || !object->isCallable(vm))
return throwVMTypeError(globalObject, scope);
globalObject->setUnhandledRejectionCallback(vm, object);
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -832,7 +832,7 @@
{
BEGIN();
auto bytecode = pc->as<OpIsFunction>();
- RETURN(jsBoolean(GET_C(bytecode.m_operand).jsValue().isFunction(vm)));
+ RETURN(jsBoolean(GET_C(bytecode.m_operand).jsValue().isCallable(vm)));
}
SLOW_PATH_DECL(slow_path_in_by_val)
Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -95,7 +95,7 @@
if (v.isObject()) {
VM& vm = globalObject->vm();
JSObject* object = asObject(v);
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return vm.smallStrings.functionString()->value(globalObject);
return JSObject::calculatedClassName(object);
}
Modified: trunk/Source/_javascript_Core/runtime/FunctionPrototype.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/FunctionPrototype.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/FunctionPrototype.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -149,7 +149,7 @@
if (thisValue.isObject()) {
JSObject* object = asObject(thisValue);
Integrity::auditStructureID(vm, object->structureID());
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
RELEASE_AND_RETURN(scope, JSValue::encode(jsMakeNontrivialString(globalObject, "function ", object->classInfo(vm)->className, "() {\n [native code]\n}")));
}
Modified: trunk/Source/_javascript_Core/runtime/InternalFunction.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/InternalFunction.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/InternalFunction.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -157,7 +157,7 @@
// https://tc39.es/ecma262/#sec-getfunctionrealm
JSGlobalObject* getFunctionRealm(VM& vm, JSObject* object)
{
- ASSERT(object->isFunction(vm));
+ ASSERT(object->isCallable(vm));
if (object->inherits<JSBoundFunction>(vm))
return getFunctionRealm(vm, jsCast<JSBoundFunction*>(object)->targetFunction());
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.h (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -230,7 +230,7 @@
// Querying the type.
bool isEmpty() const;
- bool isFunction(VM&) const;
+ bool isCallable(VM&) const;
bool isConstructor(VM&) const;
bool isUndefined() const;
bool isNull() const;
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -887,18 +887,14 @@
return isCell() ? asCell()->toObject(globalObject) : toObjectSlowCase(globalObject);
}
-inline bool JSValue::isFunction(VM& vm) const
+inline bool JSValue::isCallable(VM& vm) const
{
- if (!isCell())
- return false;
- return asCell()->isFunction(vm);
+ return isCell() && asCell()->isCallable(vm);
}
inline bool JSValue::isConstructor(VM& vm) const
{
- if (!isCell())
- return false;
- return asCell()->isConstructor(vm);
+ return isCell() && asCell()->isConstructor(vm);
}
// this method is here to be after the inline declaration of JSCell::inherits
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -107,7 +107,7 @@
bool isGetterSetter() const;
bool isCustomGetterSetter() const;
bool isProxy() const;
- bool isFunction(VM&);
+ bool isCallable(VM&);
bool isConstructor(VM&);
bool inherits(VM&, const ClassInfo*) const;
template<typename Target> bool inherits(VM&) const;
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -229,7 +229,7 @@
return m_type == ImpureProxyType || m_type == PureForwardingProxyType || m_type == ProxyObjectType;
}
-ALWAYS_INLINE bool JSCell::isFunction(VM& vm)
+ALWAYS_INLINE bool JSCell::isCallable(VM& vm)
{
if (type() == JSFunctionType)
return true;
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -384,7 +384,7 @@
return StringifyFailed;
JSObject* object = asObject(value);
- if (object->isFunction(vm)) {
+ if (object->isCallable(vm)) {
if (holder.isArray()) {
builder.appendLiteral("null");
return StringifySucceeded;
Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -532,7 +532,7 @@
if (hasProperty) {
JSValue get = description->get(globalObject, vm.propertyNames->get);
RETURN_IF_EXCEPTION(scope, false);
- if (!get.isUndefined() && !get.isFunction(vm)) {
+ if (!get.isUndefined() && !get.isCallable(vm)) {
throwTypeError(globalObject, scope, "Getter must be a function."_s);
return false;
}
@@ -545,7 +545,7 @@
if (hasProperty) {
JSValue set = description->get(globalObject, vm.propertyNames->set);
RETURN_IF_EXCEPTION(scope, false);
- if (!set.isUndefined() && !set.isFunction(vm)) {
+ if (!set.isUndefined() && !set.isCallable(vm)) {
throwTypeError(globalObject, scope, "Setter must be a function."_s);
return false;
}
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -154,7 +154,7 @@
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue get = callFrame->argument(1);
- if (!get.isFunction(vm))
+ if (!get.isCallable(vm))
return throwVMTypeError(globalObject, scope, "invalid getter usage"_s);
auto propertyName = callFrame->argument(0).toPropertyKey(globalObject);
@@ -181,7 +181,7 @@
RETURN_IF_EXCEPTION(scope, encodedJSValue());
JSValue set = callFrame->argument(1);
- if (!set.isFunction(vm))
+ if (!set.isCallable(vm))
return throwVMTypeError(globalObject, scope, "invalid setter usage"_s);
auto propertyName = callFrame->argument(0).toPropertyKey(globalObject);
Modified: trunk/Source/_javascript_Core/runtime/Operations.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/Operations.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/Operations.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -99,7 +99,7 @@
// as null when doing comparisons.
if (object->structure(vm)->masqueradesAsUndefined(globalObject))
return vm.smallStrings.undefinedString();
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return vm.smallStrings.functionString();
}
return vm.smallStrings.objectString();
@@ -123,7 +123,7 @@
if (asObject(v)->structure(vm)->masqueradesAsUndefined(globalObject))
return false;
JSObject* object = asObject(v);
- if (object->isFunction(vm))
+ if (object->isCallable(vm))
return false;
}
return true;
Modified: trunk/Source/_javascript_Core/runtime/ProxyObject.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/ProxyObject.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/ProxyObject.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -72,7 +72,7 @@
Structure* ProxyObject::structureForTarget(JSGlobalObject* globalObject, JSValue target)
{
VM& vm = globalObject->vm();
- return target.isFunction(vm) ? globalObject->callableProxyObjectStructure() : globalObject->proxyObjectStructure();
+ return target.isCallable(vm) ? globalObject->callableProxyObjectStructure() : globalObject->proxyObjectStructure();
}
void ProxyObject::finishCreation(VM& vm, JSGlobalObject* globalObject, JSValue target, JSValue handler)
@@ -91,7 +91,7 @@
JSObject* targetAsObject = jsCast<JSObject*>(target);
- m_isCallable = targetAsObject->isFunction(vm);
+ m_isCallable = targetAsObject->isCallable(vm);
if (m_isCallable) {
TypeInfo info = structure(vm)->typeInfo();
RELEASE_ASSERT(info.implementsHasInstance() && info.implementsDefaultHasInstance());
Modified: trunk/Source/_javascript_Core/runtime/RuntimeType.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/runtime/RuntimeType.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/runtime/RuntimeType.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -51,7 +51,7 @@
return TypeBoolean;
if (value.isObject())
return TypeObject;
- if (value.isFunction(vm))
+ if (value.isCallable(vm))
return TypeFunction;
if (value.isSymbol())
return TypeSymbol;
Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -2178,7 +2178,7 @@
return throwVMError(globalObject, throwScope, "Invalid number of arguments");
JSValue arg0 = callFrame->argument(0);
JSValue arg1 = callFrame->argument(1);
- if (!arg0.isFunction(vm))
+ if (!arg0.isCallable(vm))
return throwVMError(globalObject, throwScope, "arg0 should be a function");
if (!arg1.isNumber())
return throwVMError(globalObject, throwScope, "arg1 should be a number");
@@ -2591,7 +2591,7 @@
vm.typeProfilerLog()->processLogEntries(vm, "jsc Testing API: functionFindTypeForExpression"_s);
JSValue functionValue = callFrame->argument(0);
- RELEASE_ASSERT(functionValue.isFunction(vm));
+ RELEASE_ASSERT(functionValue.isCallable(vm));
FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(vm, functionValue.asCell()->getObject()))->jsExecutable();
RELEASE_ASSERT(callFrame->argument(1).isString());
@@ -2611,7 +2611,7 @@
vm.typeProfilerLog()->processLogEntries(vm, "jsc Testing API: functionReturnTypeFor"_s);
JSValue functionValue = callFrame->argument(0);
- RELEASE_ASSERT(functionValue.isFunction(vm));
+ RELEASE_ASSERT(functionValue.isCallable(vm));
FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(vm, functionValue.asCell()->getObject()))->jsExecutable();
unsigned offset = executable->typeProfilingStartOffset(vm);
@@ -2645,7 +2645,7 @@
RELEASE_ASSERT(vm.controlFlowProfiler());
JSValue functionValue = callFrame->argument(0);
- RELEASE_ASSERT(functionValue.isFunction(vm));
+ RELEASE_ASSERT(functionValue.isCallable(vm));
FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(vm, functionValue.asCell()->getObject()))->jsExecutable();
RELEASE_ASSERT(callFrame->argument(1).isString());
@@ -2665,7 +2665,7 @@
RELEASE_ASSERT(vm.controlFlowProfiler());
JSValue functionValue = callFrame->argument(0);
- RELEASE_ASSERT(functionValue.isFunction(vm));
+ RELEASE_ASSERT(functionValue.isCallable(vm));
FunctionExecutable* executable = (jsDynamicCast<JSFunction*>(vm, functionValue.asCell()->getObject()))->jsExecutable();
RELEASE_ASSERT(callFrame->argument(1).isString());
Modified: trunk/Source/_javascript_Core/wasm/WasmInstance.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/wasm/WasmInstance.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/wasm/WasmInstance.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -108,7 +108,7 @@
void Instance::setFunctionWrapper(unsigned i, JSValue value)
{
ASSERT(m_owner);
- ASSERT(value.isFunction(owner<JSWebAssemblyInstance>()->vm()));
+ ASSERT(value.isCallable(owner<JSWebAssemblyInstance>()->vm()));
ASSERT(!m_functionWrappers.contains(i));
auto locker = holdLock(owner<JSWebAssemblyInstance>()->cellLock());
m_functionWrappers.set(i, WriteBarrier<Unknown>(owner<JSWebAssemblyInstance>()->vm(), owner<JSWebAssemblyInstance>(), value));
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -539,7 +539,7 @@
unboxedValue = bitwise_cast<uint64_t>(value.toNumber(globalObject));
break;
case Funcref:
- if (!value.isFunction(vm)) {
+ if (!value.isCallable(vm)) {
throwTypeError(globalObject, scope, "Funcref value is not a function"_s);
return;
}
@@ -728,7 +728,7 @@
EncodedJSValue JIT_OPERATION operationWasmRefFunc(Instance* instance, uint32_t index)
{
JSValue value = instance->getFunctionWrapper(index);
- ASSERT(value.isFunction(instance->owner<JSObject>()->vm()));
+ ASSERT(value.isCallable(instance->owner<JSObject>()->vm()));
return JSValue::encode(value);
}
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -188,7 +188,7 @@
case Wasm::ExternalKind::Function: {
// 4. If i is a function import:
// i. If IsCallable(v) is false, throw a WebAssembly.LinkError.
- if (!value.isFunction(vm))
+ if (!value.isCallable(vm))
return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "import function", "must be callable")));
Wasm::Instance* calleeInstance = nullptr;
@@ -392,7 +392,7 @@
wrapper = function;
}
- ASSERT(wrapper.isFunction(vm));
+ ASSERT(wrapper.isCallable(vm));
m_instance->instance().setFunctionWrapper(index, wrapper);
return wrapper;
@@ -412,7 +412,7 @@
initialBits = m_instance->instance().loadI64Global(global.initialBitsOrImportNumber);
} else if (global.initializationType == Wasm::GlobalInformation::FromRefFunc) {
ASSERT(global.initialBitsOrImportNumber < moduleInformation.functionIndexSpaceSize());
- ASSERT(makeFunctionWrapper("Global init expr", global.initialBitsOrImportNumber).isFunction(vm));
+ ASSERT(makeFunctionWrapper("Global init expr", global.initialBitsOrImportNumber).isCallable(vm));
initialBits = JSValue::encode(makeFunctionWrapper("Global init expr", global.initialBitsOrImportNumber));
} else
initialBits = global.initialBitsOrImportNumber;
@@ -444,7 +444,7 @@
switch (exp.kind) {
case Wasm::ExternalKind::Function: {
exportedValue = makeFunctionWrapper(String::fromUTF8(exp.field), exp.kindIndex);
- ASSERT(exportedValue.isFunction(vm));
+ ASSERT(exportedValue.isCallable(vm));
ASSERT(makeFunctionWrapper(String::fromUTF8(exp.field), exp.kindIndex) == exportedValue);
break;
}
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.cpp (260847 => 260848)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyWrapperFunction.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -68,7 +68,7 @@
void WebAssemblyWrapperFunction::finishCreation(VM& vm, NativeExecutable* executable, unsigned length, const String& name, JSObject* function, JSWebAssemblyInstance* instance)
{
Base::finishCreation(vm, executable, length, name, instance);
- RELEASE_ASSERT(JSValue(function).isFunction(vm));
+ RELEASE_ASSERT(JSValue(function).isCallable(vm));
m_function.set(vm, this, function);
}
Modified: trunk/Source/WebCore/ChangeLog (260847 => 260848)
--- trunk/Source/WebCore/ChangeLog 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/ChangeLog 2020-04-28 21:51:37 UTC (rev 260848)
@@ -1,3 +1,41 @@
+2020-04-28 Ross Kirsling <[email protected]>
+
+ [JSC] Align upon the name isCallable instead of isFunction
+ https://bugs.webkit.org/show_bug.cgi?id=211140
+
+ Reviewed by Darin Adler.
+
+ * Modules/plugins/QuickTimePluginReplacement.mm:
+ (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
+ * bindings/js/JSCustomElementRegistryCustom.cpp:
+ (WebCore::getCustomElementCallback):
+ * bindings/js/JSDOMConvertCallbacks.h:
+ (WebCore::Converter<IDLCallbackFunction<T>>::convert):
+ * bindings/js/JSDOMConvertScheduledAction.h:
+ (WebCore::Converter<IDLScheduledAction>::convert):
+ * bindings/js/JSDOMPromise.cpp:
+ (WebCore::DOMPromise::whenPromiseIsSettled):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::queueMicrotask):
+ * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+ (WebCore::JSWorkerGlobalScope::queueMicrotask):
+ * bindings/js/ReadableStream.cpp:
+ (WebCore::ReadableStream::pipeTo):
+ (WebCore::ReadableStream::tee):
+ * bindings/js/ReadableStreamDefaultController.cpp:
+ (WebCore::ReadableStreamDefaultController::invoke):
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::callInWorld):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateOverloadDispatcher):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
+ * testing/Internals.cpp:
+ (WebCore::Internals::parserMetaData):
+ (WebCore::Internals::cloneArrayBuffer):
+ * worklets/PaintWorkletGlobalScope.cpp:
+ (WebCore::PaintWorkletGlobalScope::registerPaint):
+
2020-04-28 Simon Fraser <[email protected]>
Rewrite GraphicsLayerCA::updateSublayerList()
Modified: trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm (260847 => 260848)
--- trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm 2020-04-28 21:51:37 UTC (rev 260848)
@@ -153,7 +153,7 @@
JSC::JSGlobalObject* lexicalGlobalObject = globalObject;
JSC::JSValue replacementFunction = globalObject->get(lexicalGlobalObject, JSC::Identifier::fromString(vm, "createPluginReplacement"));
- if (replacementFunction.isFunction(vm))
+ if (replacementFunction.isCallable(vm))
return true;
scriptController.evaluateInWorldIgnoringException(ScriptSourceCode(quickTimePluginReplacementScript()), world);
Modified: trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -49,7 +49,7 @@
RETURN_IF_EXCEPTION(scope, nullptr);
if (callback.isUndefined())
return nullptr;
- if (!callback.isFunction(vm)) {
+ if (!callback.isCallable(vm)) {
throwTypeError(&lexicalGlobalObject, scope, "A custom element callback must be a function"_s);
return nullptr;
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -40,7 +40,7 @@
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
- if (!value.isFunction(vm)) {
+ if (!value.isCallable(vm)) {
exceptionThrower(lexicalGlobalObject, scope);
return nullptr;
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h 2020-04-28 21:51:37 UTC (rev 260848)
@@ -38,7 +38,7 @@
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
- if (!value.isFunction(vm)) {
+ if (!value.isCallable(vm)) {
auto code = Converter<IDLDOMString>::convert(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(scope, nullptr);
return ScheduledAction::create(globalObject.world(), WTFMove(code));
Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -61,7 +61,7 @@
if (scope.exception())
return;
- ASSERT(thenFunction.isFunction(vm));
+ ASSERT(thenFunction.isCallable(vm));
JSC::MarkedArgumentBuffer arguments;
arguments.append(handler);
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -540,7 +540,7 @@
return throwException(&lexicalGlobalObject, scope, createNotEnoughArgumentsError(&lexicalGlobalObject));
JSValue functionValue = callFrame.uncheckedArgument(0);
- if (UNLIKELY(!functionValue.isFunction(vm)))
+ if (UNLIKELY(!functionValue.isCallable(vm)))
return JSValue::decode(throwArgumentMustBeFunctionError(lexicalGlobalObject, scope, 0, "callback", "Window", "queueMicrotask"));
scope.release();
Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -57,7 +57,7 @@
return throwException(&lexicalGlobalObject, scope, createNotEnoughArgumentsError(&lexicalGlobalObject));
JSValue functionValue = callFrame.uncheckedArgument(0);
- if (UNLIKELY(!functionValue.isFunction(vm)))
+ if (UNLIKELY(!functionValue.isCallable(vm)))
return JSValue::decode(throwArgumentMustBeFunctionError(lexicalGlobalObject, scope, 0, "callback", "WorkerGlobalScope", "queueMicrotask"));
scope.release();
Modified: trunk/Source/WebCore/bindings/js/ReadableStream.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/ReadableStream.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/ReadableStream.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -78,7 +78,7 @@
const Identifier& privateName = clientData->builtinFunctions().readableStreamInternalsBuiltins().readableStreamPipeToPrivateName();
auto readableStreamPipeTo = m_globalObject->get(&lexicalGlobalObject, privateName);
- ASSERT(readableStreamPipeTo.isFunction(lexicalGlobalObject.vm()));
+ ASSERT(readableStreamPipeTo.isCallable(lexicalGlobalObject.vm()));
MarkedArgumentBuffer arguments;
arguments.append(readableStream());
@@ -94,7 +94,7 @@
const Identifier& privateName = clientData->builtinFunctions().readableStreamInternalsBuiltins().readableStreamTeePrivateName();
auto readableStreamTee = m_globalObject->get(&lexicalGlobalObject, privateName);
- ASSERT(readableStreamTee.isFunction(lexicalGlobalObject.vm()));
+ ASSERT(readableStreamTee.isCallable(lexicalGlobalObject.vm()));
MarkedArgumentBuffer arguments;
arguments.append(readableStream());
Modified: trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -56,7 +56,7 @@
auto function = object.get(&lexicalGlobalObject, JSC::Identifier::fromString(vm, propertyName));
RETURN_IF_EXCEPTION(scope, JSC::JSValue());
- if (!function.isFunction(vm)) {
+ if (!function.isCallable(vm)) {
if (!function.isUndefined())
throwTypeError(&lexicalGlobalObject, scope, "ReadableStream trying to call a property that is not callable"_s);
return JSC::jsUndefined();
Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (260847 => 260848)
--- trunk/Source/WebCore/bindings/js/ScriptController.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -659,7 +659,7 @@
if (evaluationException)
break;
- if (!functionObject || !functionObject.isFunction(world.vm())) {
+ if (!functionObject || !functionObject.isCallable(world.vm())) {
optionalDetails = { { "Unable to create _javascript_ async function to call"_s } };
break;
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (260847 => 260848)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2020-04-28 21:51:37 UTC (rev 260848)
@@ -3513,7 +3513,7 @@
&$generateOverloadCallIfNecessary($overload, "distinguishingArg.isObject() && asObject(distinguishingArg)->type() == ErrorInstanceType");
$overload = GetOverloadThatMatches($S, $d, \&$isObjectOrCallbackFunctionParameter);
- &$generateOverloadCallIfNecessary($overload, "distinguishingArg.isFunction(vm)");
+ &$generateOverloadCallIfNecessary($overload, "distinguishingArg.isCallable(vm)");
# FIXME: Avoid invoking GetMethod(object, Symbol.iterator) again in convert<IDLSequence<T>>(...).
$overload = GetOverloadThatMatches($S, $d, \&$isSequenceOrFrozenArrayParameter);
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (260847 => 260848)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -7147,7 +7147,7 @@
auto scope = DECLARE_CATCH_SCOPE(vm);
auto functionValue = globalObject.get(&lexicalGlobalObject, JSC::Identifier::fromString(vm, "createControls"));
- if (functionValue.isFunction(vm))
+ if (functionValue.isCallable(vm))
return true;
#ifndef NDEBUG
Modified: trunk/Source/WebCore/testing/Internals.cpp (260847 => 260848)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -2273,7 +2273,7 @@
callFrame->iterate(vm, iter);
CodeBlock* codeBlock = iter.codeBlock();
executable = codeBlock->ownerExecutable();
- } else if (code.isFunction(vm)) {
+ } else if (code.isCallable(vm)) {
JSFunction* funcObj = JSC::jsCast<JSFunction*>(code.toObject(globalObject));
executable = funcObj->jsExecutable();
} else
@@ -4646,7 +4646,7 @@
PropertySlot propertySlot(value, PropertySlot::InternalMethodType::Get);
lexicalGlobalObject.methodTable(vm)->getOwnPropertySlot(&lexicalGlobalObject, &lexicalGlobalObject, privateName, propertySlot);
value = propertySlot.getValue(&lexicalGlobalObject, privateName);
- ASSERT(value.isFunction(vm));
+ ASSERT(value.isCallable(vm));
JSObject* function = value.getObject();
auto callData = JSC::getCallData(vm, function);
Modified: trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp (260847 => 260848)
--- trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebCore/worklets/PaintWorkletGlobalScope.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -75,7 +75,7 @@
auto scope = DECLARE_THROW_SCOPE(vm);
// Validate that paintConstructor is a VoidFunction
- if (!paintConstructor->isFunction(vm))
+ if (!paintConstructor->isCallable(vm))
return Exception { TypeError, "paintConstructor must be callable" };
if (name.isEmpty())
Modified: trunk/Source/WebKit/ChangeLog (260847 => 260848)
--- trunk/Source/WebKit/ChangeLog 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebKit/ChangeLog 2020-04-28 21:51:37 UTC (rev 260848)
@@ -1,3 +1,13 @@
+2020-04-28 Ross Kirsling <[email protected]>
+
+ [JSC] Align upon the name isCallable instead of isFunction
+ https://bugs.webkit.org/show_bug.cgi?id=211140
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Plugins/Netscape/NPJSObject.cpp:
+ (WebKit::NPJSObject::hasMethod):
+
2020-04-28 Devin Rousso <[email protected]>
Web Inspector: find dialog does not populate search string from system find pasteboard
Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NPJSObject.cpp (260847 => 260848)
--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NPJSObject.cpp 2020-04-28 21:43:13 UTC (rev 260847)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NPJSObject.cpp 2020-04-28 21:51:37 UTC (rev 260848)
@@ -109,7 +109,7 @@
JSValue value = m_jsObject->get(lexicalGlobalObject, identifierFromIdentifierRep(lexicalGlobalObject, identifierRep));
scope.clearException();
- return value.isFunction(vm);
+ return value.isCallable(vm);
}
bool NPJSObject::invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)