Unreviewed, rolling out r96996.

http://trac.webkit.org/changeset/96996
https://bugs.webkit.org/show_bug.cgi?id=69697

It broke all tests on the Qt bot (Requested by Ossy_night on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-10-08

Source/JavaScriptCore:

* API/JSCallbackFunction.cpp:
(JSC::JSCallbackFunction::getCallDataVirtual):
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::getCallDataVirtual):
* API/JSObjectRef.cpp:
(JSObjectIsFunction):
(JSObjectCallAsFunction):
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::getCallDataVirtual):
* runtime/ArrayConstructor.h:
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::getCallDataVirtual):
* runtime/BooleanConstructor.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getCallDataVirtual):
* runtime/DateConstructor.h:
* runtime/Error.cpp:
(JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
(JSC::StrictModeTypeErrorFunction::create):
(JSC::StrictModeTypeErrorFunction::constructThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getConstructData):
(JSC::StrictModeTypeErrorFunction::callThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
(JSC::StrictModeTypeErrorFunction::getCallData):
(JSC::StrictModeTypeErrorFunction::createStructure):
(JSC::createTypeErrorFunction):
* runtime/Error.h:
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::getCallDataVirtual):
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::getCallDataVirtual):
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::getCallDataVirtual):
* runtime/FunctionPrototype.h:
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::finishCreation):
* runtime/InternalFunction.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getCallDataVirtual):
* runtime/JSCell.h:
(JSC::getCallData):
* runtime/JSFunction.cpp:
(JSC::JSFunction::getCallDataVirtual):
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
* runtime/JSONObject.cpp:
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::toJSON):
(JSC::Stringifier::appendStringifiedValue):
* runtime/JSObject.cpp:
(JSC::JSObject::put):
* runtime/JSObject.h:
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::getCallDataVirtual):
* runtime/NativeErrorConstructor.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getCallDataVirtual):
* runtime/NumberConstructor.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getCallDataVirtual):
* runtime/ObjectConstructor.h:
* runtime/Operations.cpp:
(JSC::jsTypeStringForValue):
(JSC::jsIsObjectType):
(JSC::jsIsFunctionType):
* runtime/PropertySlot.cpp:
(JSC::PropertySlot::functionGetter):
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getCallDataVirtual):
* runtime/RegExpConstructor.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getCallDataVirtual):
* runtime/StringConstructor.h:
* runtime/Structure.h:

Source/JavaScriptGlue:

* JSValueWrapper.cpp:
(JSValueWrapper::JSObjectCallFunction):
* UserObjectImp.cpp:
(UserObjectImp::getCallDataVirtual):
* UserObjectImp.h:

Source/WebCore:

* WebCore.exp.in:
* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::JSHTMLAllCollection::getCallDataVirtual):
* bindings/js/JSHTMLAppletElementCustom.cpp:
(WebCore::JSHTMLAppletElement::getCallDataVirtual):
* bindings/js/JSHTMLEmbedElementCustom.cpp:
(WebCore::JSHTMLEmbedElement::getCallDataVirtual):
* bindings/js/JSHTMLObjectElementCustom.cpp:
(WebCore::JSHTMLObjectElement::getCallDataVirtual):
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::evaluate):
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::runtimeObjectGetCallData):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
* bridge/objc/objc_runtime.h:
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::getCallDataVirtual):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeMetaMethod::getCallDataVirtual):
(JSC::Bindings::QtRuntimeConnectionMethod::call):
(JSC::Bindings::QtRuntimeConnectionMethod::getCallDataVirtual):
(JSC::Bindings::isJavaScriptFunction):
* bridge/qt/qt_runtime.h:
* bridge/runtime_method.cpp:
(JSC::RuntimeMethod::getCallDataVirtual):
* bridge/runtime_method.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::getCallDataVirtual):
* bridge/runtime_object.h:

Source/WebKit/mac:

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::invokeDefault):

Source/WebKit2:

* WebProcess/Plugins/Netscape/JSNPMethod.cpp:
(WebKit::JSNPMethod::getCallDataVirtual):
* WebProcess/Plugins/Netscape/JSNPMethod.h:
* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getCallDataVirtual):
* WebProcess/Plugins/Netscape/JSNPObject.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec9870f9
......@@ -78,6 +78,11 @@ EncodedJSValue JSCallbackFunction::call(ExecState* exec)
return JSValue::encode(toJS(exec, result));
}
CallType JSCallbackFunction::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType JSCallbackFunction::getCallData(JSCell*, CallData& callData)
{
callData.native.function = call;
......
......@@ -59,6 +59,7 @@ public:
static JSValueRef valueOfCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
private:
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
static EncodedJSValue JSC_HOST_CALL call(ExecState*);
......
......@@ -197,6 +197,7 @@ private:
virtual UString toString(ExecState*) const;
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
static void visitChildren(JSCell* cell, SlotVisitor& visitor)
......
......@@ -391,6 +391,12 @@ bool JSCallbackObject<Parent>::hasInstance(ExecState* exec, JSValue value, JSVal
return false;
}
template <class Parent>
CallType JSCallbackObject<Parent>::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
template <class Parent>
CallType JSCallbackObject<Parent>::getCallData(JSCell* cell, CallData& callData)
{
......
......@@ -416,8 +416,7 @@ bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStrin
bool JSObjectIsFunction(JSContextRef, JSObjectRef object)
{
CallData callData;
JSCell* cell = toJS(object);
return cell->methodTable()->getCallData(cell, callData) != CallTypeNone;
return toJS(object)->getCallDataVirtual(callData) != CallTypeNone;
}
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
......@@ -436,7 +435,7 @@ JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObject
argList.append(toJS(exec, arguments[i]));
CallData callData;
CallType callType = jsObject->methodTable()->getCallData(jsObject, callData);
CallType callType = jsObject->getCallDataVirtual(callData);
if (callType == CallTypeNone)
return 0;
......
2011-10-08 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r96996.
http://trac.webkit.org/changeset/96996
https://bugs.webkit.org/show_bug.cgi?id=69697
It broke all tests on the Qt bot (Requested by Ossy_night on
#webkit).
* API/JSCallbackFunction.cpp:
(JSC::JSCallbackFunction::getCallDataVirtual):
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::getCallDataVirtual):
* API/JSObjectRef.cpp:
(JSObjectIsFunction):
(JSObjectCallAsFunction):
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::getCallDataVirtual):
* runtime/ArrayConstructor.h:
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::getCallDataVirtual):
* runtime/BooleanConstructor.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getCallDataVirtual):
* runtime/DateConstructor.h:
* runtime/Error.cpp:
(JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
(JSC::StrictModeTypeErrorFunction::create):
(JSC::StrictModeTypeErrorFunction::constructThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getConstructData):
(JSC::StrictModeTypeErrorFunction::callThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
(JSC::StrictModeTypeErrorFunction::getCallData):
(JSC::StrictModeTypeErrorFunction::createStructure):
(JSC::createTypeErrorFunction):
* runtime/Error.h:
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::getCallDataVirtual):
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::getCallDataVirtual):
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::getCallDataVirtual):
* runtime/FunctionPrototype.h:
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::finishCreation):
* runtime/InternalFunction.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getCallDataVirtual):
* runtime/JSCell.h:
(JSC::getCallData):
* runtime/JSFunction.cpp:
(JSC::JSFunction::getCallDataVirtual):
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
* runtime/JSONObject.cpp:
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::toJSON):
(JSC::Stringifier::appendStringifiedValue):
* runtime/JSObject.cpp:
(JSC::JSObject::put):
* runtime/JSObject.h:
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::getCallDataVirtual):
* runtime/NativeErrorConstructor.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getCallDataVirtual):
* runtime/NumberConstructor.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getCallDataVirtual):
* runtime/ObjectConstructor.h:
* runtime/Operations.cpp:
(JSC::jsTypeStringForValue):
(JSC::jsIsObjectType):
(JSC::jsIsFunctionType):
* runtime/PropertySlot.cpp:
(JSC::PropertySlot::functionGetter):
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getCallDataVirtual):
* runtime/RegExpConstructor.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getCallDataVirtual):
* runtime/StringConstructor.h:
* runtime/Structure.h:
2011-10-08 Yuqiang Xian <yuqiang.xian@intel.com>
DFG JIT - only Array predictions can result in unboxed cells in register file
......@@ -260,6 +260,7 @@ __ZN3JSC6JSCell11getCallDataEPS0_RNS_8CallDataE
__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateEj
__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
__ZN3JSC6JSCell18getCallDataVirtualERNS_8CallDataE
__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
......
......@@ -190,6 +190,7 @@ EXPORTS
?get@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@AAIAAPAVJSCell@2@@Z
?get@Structure@JSC@@QAEIAAVJSGlobalData@2@PAVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z
?getCallData@JSCell@JSC@@SA?AW4CallType@2@PAV12@AATCallData@2@@Z
?getCallDataVirtual@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z
?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
?getOwnPropertyDescriptor@JSGlobalObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
......
......@@ -2829,7 +2829,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (GetterSetter* getterSetter = asGetterSetter(protoObject->getDirectOffset(offset).asCell())) {
JSObject* getter = getterSetter->getter();
CallData callData;
CallType callType = getter->methodTable()->getCallData(getter, callData);
CallType callType = getter->getCallDataVirtual(callData);
JSValue result = call(callFrame, getter, callType, callData, asObject(baseCell), ArgList());
CHECK_FOR_EXCEPTION();
callFrame->uncheckedR(dst) = result;
......@@ -2964,7 +2964,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
JSObject* getter = getterSetter->getter();
CallData callData;
CallType callType = getter->methodTable()->getCallData(getter, callData);
CallType callType = getter->getCallDataVirtual(callData);
JSValue result = call(callFrame, getter, callType, callData, baseObject, ArgList());
CHECK_FOR_EXCEPTION();
callFrame->uncheckedR(dst) = result;
......@@ -3072,7 +3072,7 @@ skip_id_custom_self:
if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
JSObject* getter = getterSetter->getter();
CallData callData;
CallType callType = getter->methodTable()->getCallData(getter, callData);
CallType callType = getter->getCallDataVirtual(callData);
JSValue result = call(callFrame, getter, callType, callData, baseValue, ArgList());
CHECK_FOR_EXCEPTION();
callFrame->uncheckedR(dst) = result;
......
......@@ -1752,7 +1752,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_getter_stub)
return JSValue::encode(jsUndefined());
JSObject* getter = asObject(getterSetter->getter());
CallData callData;
CallType callType = getter->methodTable()->getCallData(getter, callData);
CallType callType = getter->getCallDataVirtual(callData);
JSValue result = call(callFrame, getter, callType, callData, stackFrame.args[1].jsObject(), ArgList());
if (callFrame->hadException())
returnToThrowTrampoline(&callFrame->globalData(), stackFrame.args[2].returnAddress(), STUB_RETURN_ADDRESS);
......@@ -2153,7 +2153,7 @@ DEFINE_STUB_FUNCTION(void*, op_call_jitCompile)
#if !ASSERT_DISABLED
CallData callData;
ASSERT(stackFrame.callFrame->callee()->methodTable()->getCallData(stackFrame.callFrame->callee(), callData) == CallTypeJS);
ASSERT(stackFrame.callFrame->callee()->getCallDataVirtual(callData) == CallTypeJS);
#endif
return jitCompileFor(stackFrame, CodeForCall);
......
......@@ -109,6 +109,11 @@ static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
}
CallType ArrayConstructor::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType ArrayConstructor::getCallData(JSCell*, CallData& callData)
{
// equivalent to 'new Array(....)'
......
......@@ -55,6 +55,7 @@ namespace JSC {
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -70,6 +70,11 @@ static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec)));
}
CallType BooleanConstructor::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType BooleanConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = callBooleanConstructor;
......
......@@ -51,6 +51,7 @@ namespace JSC {
private:
BooleanConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -176,6 +176,11 @@ static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec)
return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
CallType DateConstructor::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType DateConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = callDate;
......
......@@ -52,6 +52,7 @@ namespace JSC {
private:
DateConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
......
......@@ -26,7 +26,6 @@
#include "ConstructData.h"
#include "ErrorConstructor.h"
#include "FunctionPrototype.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "JSObject.h"
......@@ -166,14 +165,71 @@ JSObject* throwSyntaxError(ExecState* exec)
return throwError(exec, createSyntaxError(exec, "Syntax error"));
}
class StrictModeTypeErrorFunction : public InternalFunction {
private:
StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const UString& message)
: InternalFunction(globalObject, structure)
, m_message(message)
{
}
public:
typedef InternalFunction Base;
static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message)
{
StrictModeTypeErrorFunction* function = new (allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message);
function->finishCreation(exec->globalData(), exec->globalData().propertyNames->emptyIdentifier);
return function;
}
static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec)
{
throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
return JSValue::encode(jsNull());
}
ConstructType getConstructData(ConstructData& constructData)
{
constructData.native.function = constructThrowTypeError;
return ConstructTypeHost;
}
static EncodedJSValue JSC_HOST_CALL callThrowTypeError(ExecState* exec)
{
throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
return JSValue::encode(jsNull());
}
virtual CallType getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
static CallType getCallData(JSCell*, CallData& callData)
{
callData.native.function = callThrowTypeError;
return CallTypeHost;
}
static const ClassInfo s_info;
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
}
private:
UString m_message;
};
ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction);
const ClassInfo StrictModeTypeErrorFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(StrictModeTypeErrorFunction) };
JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
{
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
return StrictModeTypeErrorFunction::create(exec, globalObject, globalObject->strictModeTypeErrorFunctionStructure(), message);
return StrictModeTypeErrorFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message);
}
} // namespace JSC
......@@ -23,7 +23,6 @@
#ifndef Error_h
#define Error_h
#include "InternalFunction.h"
#include "JSObject.h"
#include <stdint.h>
......@@ -74,59 +73,6 @@ namespace JSC {
JSValue createTypeErrorFunction(ExecState* exec, const UString& message);
class StrictModeTypeErrorFunction : public InternalFunction {
private:
StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const UString& message)
: InternalFunction(globalObject, structure)
, m_message(message)
{
}
public:
typedef InternalFunction Base;
static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message)
{
StrictModeTypeErrorFunction* function = new (allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message);
function->finishCreation(exec->globalData(), exec->globalData().propertyNames->emptyIdentifier);
return function;
}
static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec)
{
throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
return JSValue::encode(jsNull());
}
ConstructType getConstructData(ConstructData& constructData)
{
constructData.native.function = constructThrowTypeError;
return ConstructTypeHost;
}
static EncodedJSValue JSC_HOST_CALL callThrowTypeError(ExecState* exec)
{
throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
return JSValue::encode(jsNull());
}
static CallType getCallData(JSCell*, CallData& callData)
{
callData.native.function = callThrowTypeError;
return CallTypeHost;
}
static const ClassInfo s_info;
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
}
private:
UString m_message;
};
} // namespace JSC
#endif // Error_h
......@@ -66,6 +66,11 @@ static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
}
CallType ErrorConstructor::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType ErrorConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = callErrorConstructor;
......
......@@ -52,6 +52,7 @@ namespace JSC {
private:
ErrorConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -71,6 +71,11 @@ static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
return JSValue::encode(constructFunction(exec, asInternalFunction(exec->callee())->globalObject(), args));
}
CallType FunctionConstructor::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
// ECMA 15.3.1 The Function Constructor Called as a Function
CallType FunctionConstructor::getCallData(JSCell*, CallData& callData)
{
......
......@@ -49,6 +49,7 @@ namespace JSC {
FunctionConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, FunctionPrototype*);
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -34,13 +34,13 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype);
const ClassInfo FunctionPrototype::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionPrototype) };
static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
const ClassInfo FunctionPrototype::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionPrototype) };
FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
{
......@@ -72,6 +72,11 @@ static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
return JSValue::encode(jsUndefined());
}
CallType FunctionPrototype::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
// ECMA 15.3.4
CallType FunctionPrototype::getCallData(JSCell*, CallData& callData)
{
......
......@@ -50,6 +50,7 @@ namespace JSC {
private:
FunctionPrototype(JSGlobalObject*, Structure*);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -50,7 +50,6 @@ void InternalFunction::finishCreation(JSGlobalData& globalData, const Identifier
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
ASSERT(methodTable()->getCallData != InternalFunction::s_info.methodTable.getCallData);
putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
}
......@@ -69,12 +68,6 @@ const UString InternalFunction::displayName(ExecState* exec)
return UString();
}
CallType InternalFunction::getCallData(JSCell*, CallData&)
{
ASSERT_NOT_REACHED();
return CallTypeNone;
}
const UString InternalFunction::calculatedDisplayName(ExecState* exec)
{
const UString explicitName = displayName(exec);
......
......@@ -56,9 +56,9 @@ namespace JSC {
void finishCreation(JSGlobalData&, const Identifier& name);
static CallType getCallData(JSCell*, CallData&);
private:
virtual CallType getCallDataVirtual(CallData&) = 0;
virtual void vtableAnchor();
};
......
......@@ -54,6 +54,11 @@ const JSObject* JSCell::getObject() const
return isObject() ? static_cast<const JSObject*>(this) : 0;
}
CallType JSCell::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType JSCell::getCallData(JSCell*, CallData&)
{
return CallTypeNone;
......
......@@ -73,6 +73,7 @@ namespace JSC {
JSObject* getObject(); // NULL if not an object
const JSObject* getObject() const; // NULL if not an object
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
virtual ConstructType getConstructData(ConstructData&);
......@@ -139,7 +140,7 @@ namespace JSC {
WriteBarrier<Structure> m_structure;
};
inline JSCell::JSCell(JSGlobalData& globalData, Structure* structure)
: m_structure(globalData, this, structure)
{
......@@ -232,6 +233,13 @@ namespace JSC {
return isCell() ? asCell()->getObject() : 0;
}
inline CallType getCallData(JSValue value, CallData& callData)
{
CallType result = value.isCell() ? value.asCell()->getCallDataVirtual(callData) : CallTypeNone;
ASSERT(result == CallTypeNone || value.isValidCallee());
return result;
}
inline ConstructType getConstructData(JSValue value, ConstructData& constructData)
{
ConstructType result = value.isCell() ? value.asCell()->getConstructData(constructData) : ConstructTypeNone;
......
......@@ -164,6 +164,11 @@ void JSFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
visitor.append(&thisObject->m_executable);
}
CallType JSFunction::getCallDataVirtual(CallData& callData)
{
return getCallData(this, callData);
}
CallType JSFunction::getCallData(JSCell* cell, CallData& callData)
{
JSFunction* thisObject = static_cast<JSFunction*>(cell);
......
......@@ -109,6 +109,7 @@ namespace JSC {
NativeFunction nativeConstructor();
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
static inline size_t offsetOfScopeChain()
......
......@@ -42,7 +42,6 @@
#include "CodeBlock.h"
#include "DateConstructor.h"
#include "DatePrototype.h"
#include "Error.h"
#include "ErrorConstructor.h"
#include "ErrorPrototype.h"
#include "FunctionConstructor.h"
......@@ -198,7 +197,6 @@ void JSGlobalObject::reset(JSValue prototype)
m_boundFunctionStructure.set(exec->globalData(), this, JSBoundFunction::createStructure(exec->globalData(), this, m_functionPrototype.get()));
m_namedFunctionStructure.set(