+}
+
+void JSFunction::finishCreation(VM& vm, NativeExecutable* executable, int length, const String& name)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ m_executable.set(vm, this, executable);
+ putDirect(vm, vm.propertyNames->name, jsString(&vm, name), DontDelete | ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+
+JSFunction* JSFunction::createBuiltinFunction(VM& vm, FunctionExecutable* executable, JSGlobalObject* globalObject)
+{
+ JSFunction* function = create(vm, executable, globalObject);
+ function->putDirect(vm, vm.propertyNames->name, jsString(&vm, executable->name().string()), DontDelete | ReadOnly | DontEnum);
+ function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->parameterCount()), DontDelete | ReadOnly | DontEnum);
+ return function;
+}
+
+JSFunction* JSFunction::createBuiltinFunction(VM& vm, FunctionExecutable* executable, JSGlobalObject* globalObject, const String& name)
+{
+ JSFunction* function = create(vm, executable, globalObject);
+ function->putDirect(vm, vm.propertyNames->name, jsString(&vm, name), DontDelete | ReadOnly | DontEnum);
+ function->putDirect(vm, vm.propertyNames->length, jsNumber(executable->parameterCount()), DontDelete | ReadOnly | DontEnum);
+ return function;
+}
+
+FunctionRareData* JSFunction::allocateAndInitializeRareData(ExecState* exec, size_t inlineCapacity)
+{
+ ASSERT(!m_rareData);
+ VM& vm = exec->vm();
+ JSObject* prototype = jsDynamicCast<JSObject*>(get(exec, vm.propertyNames->prototype));
+ if (!prototype)
+ prototype = globalObject()->objectPrototype();
+ FunctionRareData* rareData = FunctionRareData::create(vm, prototype, inlineCapacity);
+
+ // A DFG compilation thread may be trying to read the rare data
+ // We want to ensure that it sees it properly allocated
+ WTF::storeStoreFence();
+
+ m_rareData.set(vm, this, rareData);
+ return m_rareData.get();
+}
+
+FunctionRareData* JSFunction::initializeRareData(ExecState* exec, size_t inlineCapacity)
+{
+ ASSERT(!!m_rareData);
+ VM& vm = exec->vm();
+ JSObject* prototype = jsDynamicCast<JSObject*>(get(exec, vm.propertyNames->prototype));
+ if (!prototype)
+ prototype = globalObject()->objectPrototype();
+ m_rareData->initialize(globalObject()->vm(), prototype, inlineCapacity);
+ return m_rareData.get();
+}
+
+String JSFunction::name(ExecState* exec)
+{
+ return get(exec, exec->vm().propertyNames->name).toWTFString(exec);
+}
+
+String JSFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->vm(), exec->vm().propertyNames->displayName);
+
+ if (displayName && isJSString(displayName))
+ return asString(displayName)->tryGetValue();
+
+ return String();
+}
+
+const String JSFunction::calculatedDisplayName(ExecState* exec)
+{
+ const String explicitName = displayName(exec);
+
+ if (!explicitName.isEmpty())
+ return explicitName;
+
+ const String actualName = name(exec);
+ if (!actualName.isEmpty() || isHostOrBuiltinFunction())
+ return actualName;
+
+ return jsExecutable()->inferredName().string();
+}
+
+const SourceCode* JSFunction::sourceCode() const
+{
+ if (isHostOrBuiltinFunction())
+ return 0;
+ return &jsExecutable()->source();
+}
+
+void JSFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ JSFunction* thisObject = jsCast<JSFunction*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ Base::visitChildren(thisObject, visitor);
+
+ visitor.append(&thisObject->m_executable);
+ if (thisObject->m_rareData)
+ visitor.append(&thisObject->m_rareData);
+}
+
+CallType JSFunction::getCallData(JSCell* cell, CallData& callData)
+{
+ JSFunction* thisObject = jsCast<JSFunction*>(cell);
+ if (thisObject->isHostFunction()) {
+ callData.native.function = thisObject->nativeFunction();