summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/runtime/JSBoundFunction.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSBoundFunction.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/JSBoundFunction.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
index febe9897d..f22827a37 100644
--- a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
+++ b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
@@ -28,11 +28,11 @@
#include "GetterSetter.h"
#include "JSGlobalObject.h"
-#include "JSCInlines.h"
+#include "Operations.h"
namespace JSC {
-const ClassInfo JSBoundFunction::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(JSBoundFunction) };
+const ClassInfo JSBoundFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSBoundFunction) };
EncodedJSValue JSC_HOST_CALL boundFunctionCall(ExecState* exec)
{
@@ -74,31 +74,23 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
return JSValue::encode(construct(exec, targetFunction, constructType, constructData, args));
}
-EncodedJSValue JSC_HOST_CALL isBoundFunction(ExecState* exec)
-{
- return JSValue::encode(JSValue(static_cast<bool>(jsDynamicCast<JSBoundFunction*>(exec->uncheckedArgument(0)))));
-}
-
-EncodedJSValue JSC_HOST_CALL hasInstanceBoundFunction(ExecState* exec)
-{
- JSBoundFunction* boundObject = jsCast<JSBoundFunction*>(exec->uncheckedArgument(0));
- JSValue value = exec->uncheckedArgument(1);
-
- return JSValue::encode(jsBoolean(boundObject->targetFunction()->hasInstance(exec, value)));
-}
-
JSBoundFunction* JSBoundFunction::create(VM& vm, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
{
ConstructData constructData;
ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
bool canConstruct = constructType != ConstructTypeNone;
- NativeExecutable* executable = vm.getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor, ASCIILiteral("Function.prototype.bind result"));
+ NativeExecutable* executable = vm.getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
- function->finishCreation(vm, executable, length, makeString("bound ", name));
+ function->finishCreation(vm, executable, length, name);
return function;
}
+void JSBoundFunction::destroy(JSCell* cell)
+{
+ static_cast<JSBoundFunction*>(cell)->JSBoundFunction::~JSBoundFunction();
+}
+
bool JSBoundFunction::customHasInstance(JSObject* object, ExecState* exec, JSValue value)
{
return jsCast<JSBoundFunction*>(object)->m_targetFunction->hasInstance(exec, value);
@@ -125,6 +117,8 @@ void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSBoundFunction* thisObject = jsCast<JSBoundFunction*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(thisObject, visitor);
visitor.append(&thisObject->m_targetFunction);
@@ -132,9 +126,4 @@ void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
visitor.append(&thisObject->m_boundArgs);
}
-String JSBoundFunction::toStringName(ExecState* exec)
-{
- return m_targetFunction->get(exec, exec->vm().propertyNames->name).toWTFString(exec);
-}
-
} // namespace JSC