Source/JavaScriptCore/API/JSCallbackFunction.cpp

@@EncodedJSValue JSCallbackFunction::call(ExecState* exec)
7777 return JSValue::encode(toJS(exec, result));
7878}
7979
80 CallType JSCallbackFunction::getCallData(CallData& callData)
 80CallType JSCallbackFunction::getCallDataVirtual(CallData& callData)
 81{
 82 return getCallData(this, callData);
 83}
 84
 85CallType JSCallbackFunction::getCallData(JSCell*, CallData& callData)
8186{
8287 callData.native.function = call;
8388 return CallTypeHost;

Source/JavaScriptCore/API/JSCallbackFunction.h

@@public:
5656 }
5757
5858private:
59  virtual CallType getCallData(CallData&);
 59 virtual CallType getCallDataVirtual(CallData&);
 60 static CallType getCallData(JSCell*, CallData&);
6061
6162 static EncodedJSValue JSC_HOST_CALL call(ExecState*);
6263

Source/JavaScriptCore/API/JSCallbackObject.h

@@private:
194194 virtual UString toString(ExecState*) const;
195195
196196 virtual ConstructType getConstructData(ConstructData&);
197  virtual CallType getCallData(CallData&);
 197 virtual CallType getCallDataVirtual(CallData&);
 198 static CallType getCallData(JSCell*, CallData&);
198199
199200 virtual void visitChildrenVirtual(SlotVisitor& visitor)
200201 {

Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

@@bool JSCallbackObject<Parent>::hasInstance(ExecState* exec, JSValue value, JSVal
372372}
373373
374374template <class Parent>
375 CallType JSCallbackObject<Parent>::getCallData(CallData& callData)
 375CallType JSCallbackObject<Parent>::getCallDataVirtual(CallData& callData)
376376{
377  for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
 377 return getCallData(this, callData);
 378}
 379
 380template <class Parent>
 381CallType JSCallbackObject<Parent>::getCallData(JSCell* cell, CallData& callData)
 382{
 383 JSCallbackObject* thisObject = static_cast<JSCallbackObject*>(cell);
 384 for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
378385 if (jsClass->callAsFunction) {
379386 callData.native.function = call;
380387 return CallTypeHost;

Source/JavaScriptCore/API/JSObjectRef.cpp

@@bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStrin
416416bool JSObjectIsFunction(JSContextRef, JSObjectRef object)
417417{
418418 CallData callData;
419  return toJS(object)->getCallData(callData) != CallTypeNone;
 419 return toJS(object)->getCallDataVirtual(callData) != CallTypeNone;
420420}
421421
422422JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)

@@JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObject
435435 argList.append(toJS(exec, arguments[i]));
436436
437437 CallData callData;
438  CallType callType = jsObject->getCallData(callData);
 438 CallType callType = jsObject->getCallDataVirtual(callData);
439439 if (callType == CallTypeNone)
440440 return 0;
441441

Source/JavaScriptCore/ChangeLog

 12011-09-25 Mark Hahnenberg <mhahnenberg@apple.com>
 2
 3 Add static version of JSCell::getCallData
 4 https://bugs.webkit.org/show_bug.cgi?id=68741
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 In this patch we just extract the bodies of the virtual getCallData methods
 9 throughout the JSCell inheritance hierarchy out into static methods, which are
 10 now called from the virtual methods. This is an intermediate step in trying to
 11 move the virtual-ness of getCallData into our own method table stored in
 12 ClassInfo. We need to convert the methods to static methods because static methods
 13 can be represented as function pointers rather than pointers to member methods, and
 14 function pointers are smaller and faster to call than pointers to member methods.
 15
 16 * API/JSCallbackFunction.cpp:
 17 (JSC::JSCallbackFunction::getCallDataVirtual):
 18 (JSC::JSCallbackFunction::getCallData):
 19 * API/JSCallbackFunction.h:
 20 * API/JSCallbackObject.h:
 21 * API/JSCallbackObjectFunctions.h:
 22 (JSC::::getCallDataVirtual):
 23 (JSC::::getCallData):
 24 * API/JSObjectRef.cpp:
 25 (JSObjectIsFunction):
 26 (JSObjectCallAsFunction):
 27 * JavaScriptCore.exp:
 28 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
 29 * interpreter/Interpreter.cpp:
 30 (JSC::Interpreter::privateExecute):
 31 * jit/JITStubs.cpp:
 32 (JSC::DEFINE_STUB_FUNCTION):
 33 * runtime/ArrayConstructor.cpp:
 34 (JSC::ArrayConstructor::getCallDataVirtual):
 35 (JSC::ArrayConstructor::getCallData):
 36 * runtime/ArrayConstructor.h:
 37 * runtime/BooleanConstructor.cpp:
 38 (JSC::BooleanConstructor::getCallDataVirtual):
 39 (JSC::BooleanConstructor::getCallData):
 40 * runtime/BooleanConstructor.h:
 41 * runtime/DateConstructor.cpp:
 42 (JSC::DateConstructor::getCallDataVirtual):
 43 (JSC::DateConstructor::getCallData):
 44 * runtime/DateConstructor.h:
 45 * runtime/Error.cpp:
 46 (JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
 47 (JSC::StrictModeTypeErrorFunction::getCallData):
 48 * runtime/ErrorConstructor.cpp:
 49 (JSC::ErrorConstructor::getCallDataVirtual):
 50 (JSC::ErrorConstructor::getCallData):
 51 * runtime/ErrorConstructor.h:
 52 * runtime/FunctionConstructor.cpp:
 53 (JSC::FunctionConstructor::getCallDataVirtual):
 54 (JSC::FunctionConstructor::getCallData):
 55 * runtime/FunctionConstructor.h:
 56 * runtime/FunctionPrototype.cpp:
 57 (JSC::FunctionPrototype::getCallDataVirtual):
 58 (JSC::FunctionPrototype::getCallData):
 59 * runtime/FunctionPrototype.h:
 60 * runtime/InternalFunction.h:
 61 * runtime/JSCell.cpp:
 62 (JSC::JSCell::getCallDataVirtual):
 63 (JSC::JSCell::getCallData):
 64 * runtime/JSCell.h:
 65 (JSC::getCallData):
 66 * runtime/JSFunction.cpp:
 67 (JSC::JSFunction::getCallDataVirtual):
 68 (JSC::JSFunction::getCallData):
 69 * runtime/JSFunction.h:
 70 * runtime/JSONObject.cpp:
 71 (JSC::Stringifier::Stringifier):
 72 (JSC::Stringifier::toJSON):
 73 (JSC::Stringifier::appendStringifiedValue):
 74 * runtime/JSObject.cpp:
 75 (JSC::JSObject::put):
 76 * runtime/NativeErrorConstructor.cpp:
 77 (JSC::NativeErrorConstructor::getCallDataVirtual):
 78 (JSC::NativeErrorConstructor::getCallData):
 79 * runtime/NativeErrorConstructor.h:
 80 * runtime/NumberConstructor.cpp:
 81 (JSC::NumberConstructor::getCallDataVirtual):
 82 (JSC::NumberConstructor::getCallData):
 83 * runtime/NumberConstructor.h:
 84 * runtime/ObjectConstructor.cpp:
 85 (JSC::ObjectConstructor::getCallDataVirtual):
 86 (JSC::ObjectConstructor::getCallData):
 87 * runtime/ObjectConstructor.h:
 88 * runtime/Operations.cpp:
 89 (JSC::jsTypeStringForValue):
 90 (JSC::jsIsObjectType):
 91 (JSC::jsIsFunctionType):
 92 * runtime/PropertySlot.cpp:
 93 (JSC::PropertySlot::functionGetter):
 94 * runtime/RegExpConstructor.cpp:
 95 (JSC::RegExpConstructor::getCallDataVirtual):
 96 (JSC::RegExpConstructor::getCallData):
 97 * runtime/RegExpConstructor.h:
 98 * runtime/StringConstructor.cpp:
 99 (JSC::StringConstructor::getCallDataVirtual):
 100 (JSC::StringConstructor::getCallData):
 101 * runtime/StringConstructor.h:
 102
11032011-09-24 Adam Barth <abarth@webkit.org>
2104
3105 Always enable ENABLE(OFFLINE_WEB_APPLICATIONS)

Source/JavaScriptCore/JavaScriptCore.exp

@@__ZN3JSC4Yarr11YarrPatternC1ERKNS_7UStringEbbPPKc
252252__ZN3JSC4Yarr11byteCompileERNS0_11YarrPatternEPN3WTF20BumpPointerAllocatorE
253253__ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi
254254__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
255 __ZN3JSC6JSCell11getCallDataERNS_8CallDataE
256255__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
257256__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateEj
258257__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
 258__ZN3JSC6JSCell18getCallDataVirtualERNS_8CallDataE
259259__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
260260__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
261261__ZN3JSC6JSCell18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE

Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

@@EXPORTS
186186 ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ
187187 ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@ABVIdentifier@2@AAIAAPAVJSCell@2@@Z
188188 ?get@Structure@JSC@@QAEIAAVJSGlobalData@2@PAVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z
189  ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
 189 ?getCallDataVirtual@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
190190 ?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z
191191 ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
192192 ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z

Source/JavaScriptCore/interpreter/Interpreter.cpp

@@JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
28292829 if (GetterSetter* getterSetter = asGetterSetter(protoObject->getDirectOffset(offset).asCell())) {
28302830 JSObject* getter = getterSetter->getter();
28312831 CallData callData;
2832  CallType callType = getter->getCallData(callData);
 2832 CallType callType = getter->getCallDataVirtual(callData);
28332833 JSValue result = call(callFrame, getter, callType, callData, asObject(baseCell), ArgList());
28342834 CHECK_FOR_EXCEPTION();
28352835 callFrame->uncheckedR(dst) = result;

@@JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
29642964 if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
29652965 JSObject* getter = getterSetter->getter();
29662966 CallData callData;
2967  CallType callType = getter->getCallData(callData);
 2967 CallType callType = getter->getCallDataVirtual(callData);
29682968 JSValue result = call(callFrame, getter, callType, callData, baseObject, ArgList());
29692969 CHECK_FOR_EXCEPTION();
29702970 callFrame->uncheckedR(dst) = result;

@@skip_id_custom_self:
30723072 if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
30733073 JSObject* getter = getterSetter->getter();
30743074 CallData callData;
3075  CallType callType = getter->getCallData(callData);
 3075 CallType callType = getter->getCallDataVirtual(callData);
30763076 JSValue result = call(callFrame, getter, callType, callData, baseValue, ArgList());
30773077 CHECK_FOR_EXCEPTION();
30783078 callFrame->uncheckedR(dst) = result;

Source/JavaScriptCore/jit/JITStubs.cpp

@@DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_getter_stub)
17551755 return JSValue::encode(jsUndefined());
17561756 JSObject* getter = asObject(getterSetter->getter());
17571757 CallData callData;
1758  CallType callType = getter->getCallData(callData);
 1758 CallType callType = getter->getCallDataVirtual(callData);
17591759 JSValue result = call(callFrame, getter, callType, callData, stackFrame.args[1].jsObject(), ArgList());
17601760 if (callFrame->hadException())
17611761 returnToThrowTrampoline(&callFrame->globalData(), stackFrame.args[2].returnAddress(), STUB_RETURN_ADDRESS);

@@DEFINE_STUB_FUNCTION(void*, op_call_jitCompile)
21582158
21592159#if !ASSERT_DISABLED
21602160 CallData callData;
2161  ASSERT(stackFrame.callFrame->callee()->getCallData(callData) == CallTypeJS);
 2161 ASSERT(stackFrame.callFrame->callee()->getCallDataVirtual(callData) == CallTypeJS);
21622162#endif
21632163
21642164 return jitCompileFor(stackFrame, CodeForCall);

Source/JavaScriptCore/runtime/ArrayConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
109109 return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
110110}
111111
112 CallType ArrayConstructor::getCallData(CallData& callData)
 112CallType ArrayConstructor::getCallDataVirtual(CallData& callData)
 113{
 114 return getCallData(this, callData);
 115}
 116
 117CallType ArrayConstructor::getCallData(JSCell*, CallData& callData)
113118{
114119 // equivalent to 'new Array(....)'
115120 callData.native.function = callArrayConstructor;

Source/JavaScriptCore/runtime/ArrayConstructor.h

@@namespace JSC {
5555 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
5656
5757 virtual ConstructType getConstructData(ConstructData&);
58  virtual CallType getCallData(CallData&);
 58 virtual CallType getCallDataVirtual(CallData&);
 59 static CallType getCallData(JSCell*, CallData&);
5960 };
6061
6162} // namespace JSC

Source/JavaScriptCore/runtime/BooleanConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
6868 return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec)));
6969}
7070
71 CallType BooleanConstructor::getCallData(CallData& callData)
 71CallType BooleanConstructor::getCallDataVirtual(CallData& callData)
 72{
 73 return getCallData(this, callData);
 74}
 75
 76CallType BooleanConstructor::getCallData(JSCell*, CallData& callData)
7277{
7378 callData.native.function = callBooleanConstructor;
7479 return CallTypeHost;

Source/JavaScriptCore/runtime/BooleanConstructor.h

@@namespace JSC {
4444 private:
4545 BooleanConstructor(JSGlobalObject*, Structure*);
4646 virtual ConstructType getConstructData(ConstructData&);
47  virtual CallType getCallData(CallData&);
 47 virtual CallType getCallDataVirtual(CallData&);
 48 static CallType getCallData(JSCell*, CallData&);
4849 };
4950
5051 JSObject* constructBooleanFromImmediateBoolean(ExecState*, JSGlobalObject*, JSValue);

Source/JavaScriptCore/runtime/DateConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec)
176176 return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
177177}
178178
179 CallType DateConstructor::getCallData(CallData& callData)
 179CallType DateConstructor::getCallDataVirtual(CallData& callData)
 180{
 181 return getCallData(this, callData);
 182}
 183
 184CallType DateConstructor::getCallData(JSCell*, CallData& callData)
180185{
181186 callData.native.function = callDate;
182187 return CallTypeHost;

Source/JavaScriptCore/runtime/DateConstructor.h

@@namespace JSC {
5252 private:
5353 DateConstructor(JSGlobalObject*, Structure*);
5454 virtual ConstructType getConstructData(ConstructData&);
55  virtual CallType getCallData(CallData&);
 55 virtual CallType getCallDataVirtual(CallData&);
 56 static CallType getCallData(JSCell*, CallData&);
5657
5758 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
5859 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);

Source/JavaScriptCore/runtime/Error.cpp

@@public:
201201 return JSValue::encode(jsNull());
202202 }
203203
204  CallType getCallData(CallData& callData)
 204 CallType getCallDataVirtual(CallData& callData)
 205 {
 206 return getCallData(this, callData);
 207 }
 208
 209 CallType getCallData(JSCell*, CallData& callData)
205210 {
206211 callData.native.function = callThrowTypeError;
207212 return CallTypeHost;

Source/JavaScriptCore/runtime/ErrorConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
6464 return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
6565}
6666
67 CallType ErrorConstructor::getCallData(CallData& callData)
 67CallType ErrorConstructor::getCallDataVirtual(CallData& callData)
 68{
 69 return getCallData(this, callData);
 70}
 71
 72CallType ErrorConstructor::getCallData(JSCell*, CallData& callData)
6873{
6974 callData.native.function = callErrorConstructor;
7075 return CallTypeHost;

Source/JavaScriptCore/runtime/ErrorConstructor.h

@@namespace JSC {
4545 private:
4646 ErrorConstructor(JSGlobalObject*, Structure*);
4747 virtual ConstructType getConstructData(ConstructData&);
48  virtual CallType getCallData(CallData&);
 48 virtual CallType getCallDataVirtual(CallData&);
 49 static CallType getCallData(JSCell*, CallData&);
4950 };
5051
5152} // namespace JSC

Source/JavaScriptCore/runtime/FunctionConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
6969 return JSValue::encode(constructFunction(exec, asInternalFunction(exec->callee())->globalObject(), args));
7070}
7171
 72CallType FunctionConstructor::getCallDataVirtual(CallData& callData)
 73{
 74 return getCallData(this, callData);
 75}
 76
7277// ECMA 15.3.1 The Function Constructor Called as a Function
73 CallType FunctionConstructor::getCallData(CallData& callData)
 78CallType FunctionConstructor::getCallData(JSCell*, CallData& callData)
7479{
7580 callData.native.function = callFunctionConstructor;
7681 return CallTypeHost;

Source/JavaScriptCore/runtime/FunctionConstructor.h

@@namespace JSC {
4242 FunctionConstructor(JSGlobalObject*, Structure*);
4343 void finishCreation(ExecState*, FunctionPrototype*);
4444 virtual ConstructType getConstructData(ConstructData&);
45  virtual CallType getCallData(CallData&);
 45 virtual CallType getCallDataVirtual(CallData&);
 46 static CallType getCallData(JSCell*, CallData&);
4647 };
4748
4849 JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const UString& sourceURL, int lineNumber);

Source/JavaScriptCore/runtime/FunctionPrototype.cpp

@@static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
7070 return JSValue::encode(jsUndefined());
7171}
7272
 73CallType FunctionPrototype::getCallDataVirtual(CallData& callData)
 74{
 75 return getCallData(this, callData);
 76}
 77
7378// ECMA 15.3.4
74 CallType FunctionPrototype::getCallData(CallData& callData)
 79CallType FunctionPrototype::getCallData(JSCell*, CallData& callData)
7580{
7681 callData.native.function = callFunctionPrototype;
7782 return CallTypeHost;

Source/JavaScriptCore/runtime/FunctionPrototype.h

@@namespace JSC {
4848
4949 private:
5050 FunctionPrototype(JSGlobalObject*, Structure*);
51  virtual CallType getCallData(CallData&);
 51 virtual CallType getCallDataVirtual(CallData&);
 52 static CallType getCallData(JSCell*, CallData&);
5253 };
5354
5455} // namespace JSC

Source/JavaScriptCore/runtime/InternalFunction.h

@@namespace JSC {
5757 void finishCreation(JSGlobalData&, const Identifier& name);
5858
5959 private:
60  virtual CallType getCallData(CallData&) = 0;
 60 virtual CallType getCallDataVirtual(CallData&) = 0;
6161
6262 virtual void vtableAnchor();
6363 };

Source/JavaScriptCore/runtime/JSCell.cpp

@@const JSObject* JSCell::getObject() const
5454 return isObject() ? static_cast<const JSObject*>(this) : 0;
5555}
5656
57 CallType JSCell::getCallData(CallData&)
 57CallType JSCell::getCallDataVirtual(CallData& callData)
 58{
 59 return getCallData(this, callData);
 60}
 61
 62CallType JSCell::getCallData(JSCell*, CallData&)
5863{
5964 return CallTypeNone;
6065}

Source/JavaScriptCore/runtime/JSCell.h

@@namespace JSC {
7373 JSObject* getObject(); // NULL if not an object
7474 const JSObject* getObject() const; // NULL if not an object
7575
76  virtual CallType getCallData(CallData&);
 76 virtual CallType getCallDataVirtual(CallData&);
 77 static CallType getCallData(JSCell*, CallData&);
7778 virtual ConstructType getConstructData(ConstructData&);
7879
7980 // Basic conversions.

@@namespace JSC {
235236
236237 inline CallType getCallData(JSValue value, CallData& callData)
237238 {
238  CallType result = value.isCell() ? value.asCell()->getCallData(callData) : CallTypeNone;
 239 CallType result = value.isCell() ? value.asCell()->getCallDataVirtual(callData) : CallTypeNone;
239240 ASSERT(result == CallTypeNone || value.isValidCallee());
240241 return result;
241242 }

Source/JavaScriptCore/runtime/JSFunction.cpp

@@void JSFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
169169 visitor.append(&thisObject->m_executable);
170170}
171171
172 CallType JSFunction::getCallData(CallData& callData)
 172CallType JSFunction::getCallDataVirtual(CallData& callData)
173173{
174  if (isHostFunction()) {
175  callData.native.function = nativeFunction();
 174 return getCallData(this, callData);
 175}
 176
 177CallType JSFunction::getCallData(JSCell* cell, CallData& callData)
 178{
 179 JSFunction* thisObject = static_cast<JSFunction*>(cell);
 180 if (thisObject->isHostFunction()) {
 181 callData.native.function = thisObject->nativeFunction();
176182 return CallTypeHost;
177183 }
178  callData.js.functionExecutable = jsExecutable();
179  callData.js.scopeChain = scope();
 184 callData.js.functionExecutable = thisObject->jsExecutable();
 185 callData.js.scopeChain = thisObject->scope();
180186 return CallTypeJS;
181187}
182188

Source/JavaScriptCore/runtime/JSFunction.h

@@namespace JSC {
109109 NativeFunction nativeConstructor();
110110
111111 virtual ConstructType getConstructData(ConstructData&);
112  virtual CallType getCallData(CallData&);
 112 virtual CallType getCallDataVirtual(CallData&);
 113 static CallType getCallData(JSCell*, CallData&);
113114
114115 static inline size_t offsetOfScopeChain()
115116 {

Source/JavaScriptCore/runtime/JSONObject.cpp

@@Stringifier::Stringifier(ExecState* exec, const Local<Unknown>& replacer, const
246246 return;
247247 }
248248
249  m_replacerCallType = m_replacer.asObject()->getCallData(m_replacerCallData);
 249 m_replacerCallType = m_replacer.asObject()->getCallDataVirtual(m_replacerCallData);
250250}
251251
252252Local<Unknown> Stringifier::stringify(Handle<Unknown> value)

@@inline JSValue Stringifier::toJSON(JSValue value, const PropertyNameForFunctionC
337337
338338 JSObject* object = asObject(toJSONFunction);
339339 CallData callData;
340  CallType callType = object->getCallData(callData);
 340 CallType callType = object->getCallDataVirtual(callData);
341341 if (callType == CallTypeNone)
342342 return value;
343343

@@Stringifier::StringifyResult Stringifier::appendStringifiedValue(UStringBuilder&
401401 JSObject* object = asObject(value);
402402
403403 CallData callData;
404  if (object->getCallData(callData) != CallTypeNone) {
 404 if (object->getCallDataVirtual(callData) != CallTypeNone) {
405405 if (holder->inherits(&JSArray::s_info)) {
406406 builder.append("null");
407407 return StringifySucceeded;

Source/JavaScriptCore/runtime/JSObject.cpp

@@void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu
158158 }
159159
160160 CallData callData;
161  CallType callType = setterFunc->getCallData(callData);
 161 CallType callType = setterFunc->getCallDataVirtual(callData);
162162 MarkedArgumentBuffer args;
163163 args.append(value);
164164

Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
7474 return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
7575}
7676
77 CallType NativeErrorConstructor::getCallData(CallData& callData)
 77CallType NativeErrorConstructor::getCallDataVirtual(CallData& callData)
 78{
 79 return getCallData(this, callData);
 80}
 81
 82CallType NativeErrorConstructor::getCallData(JSCell*, CallData& callData)
7883{
7984 callData.native.function = callNativeErrorConstructor;
8085 return CallTypeHost;

Source/JavaScriptCore/runtime/NativeErrorConstructor.h

@@namespace JSC {
6969 NativeErrorConstructor(JSGlobalObject*, Structure*);
7070 static const unsigned StructureFlags = OverridesVisitChildren | InternalFunction::StructureFlags;
7171 virtual ConstructType getConstructData(ConstructData&);
72  virtual CallType getCallData(CallData&);
 72 virtual CallType getCallDataVirtual(CallData&);
 73 static CallType getCallData(JSCell*, CallData&);
7374 virtual void visitChildrenVirtual(SlotVisitor&);
7475 static void visitChildren(JSCell*, SlotVisitor&);
7576

Source/JavaScriptCore/runtime/NumberConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
127127 return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)));
128128}
129129
130 CallType NumberConstructor::getCallData(CallData& callData)
 130CallType NumberConstructor::getCallDataVirtual(CallData& callData)
 131{
 132 return getCallData(this, callData);
 133}
 134
 135CallType NumberConstructor::getCallData(JSCell*, CallData& callData)
131136{
132137 callData.native.function = callNumberConstructor;
133138 return CallTypeHost;

Source/JavaScriptCore/runtime/NumberConstructor.h

@@namespace JSC {
5858 private:
5959 NumberConstructor(JSGlobalObject*, Structure*);
6060 virtual ConstructType getConstructData(ConstructData&);
61  virtual CallType getCallData(CallData&);
 61 virtual CallType getCallDataVirtual(CallData&);
 62 static CallType getCallData(JSCell*, CallData&);
6263 };
6364
6465} // namespace JSC

Source/JavaScriptCore/runtime/ObjectConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
126126 return JSValue::encode(constructObject(exec, asInternalFunction(exec->callee())->globalObject(), args));
127127}
128128
129 CallType ObjectConstructor::getCallData(CallData& callData)
 129CallType ObjectConstructor::getCallDataVirtual(CallData& callData)
 130{
 131 return getCallData(this, callData);
 132}
 133
 134CallType ObjectConstructor::getCallData(JSCell*, CallData& callData)
130135{
131136 callData.native.function = callObjectConstructor;
132137 return CallTypeHost;

Source/JavaScriptCore/runtime/ObjectConstructor.h

@@namespace JSC {
5555 private:
5656 ObjectConstructor(JSGlobalObject*, Structure*);
5757 virtual ConstructType getConstructData(ConstructData&);
58  virtual CallType getCallData(CallData&);
 58 virtual CallType getCallDataVirtual(CallData&);
 59 static CallType getCallData(JSCell*, CallData&);
5960 };
6061
6162} // namespace JSC

Source/JavaScriptCore/runtime/Operations.cpp

@@JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v)
7474 if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
7575 return jsNontrivialString(callFrame, "undefined");
7676 CallData callData;
77  if (asObject(v)->getCallData(callData) != CallTypeNone)
 77 if (asObject(v)->getCallDataVirtual(callData) != CallTypeNone)
7878 return jsNontrivialString(callFrame, "function");
7979 }
8080 return jsNontrivialString(callFrame, "object");

@@bool jsIsObjectType(JSValue v)
9292 if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
9393 return false;
9494 CallData callData;
95  if (asObject(v)->getCallData(callData) != CallTypeNone)
 95 if (asObject(v)->getCallDataVirtual(callData) != CallTypeNone)
9696 return false;
9797 }
9898 return true;

@@bool jsIsFunctionType(JSValue v)
102102{
103103 if (v.isObject()) {
104104 CallData callData;
105  if (asObject(v)->getCallData(callData) != CallTypeNone)
 105 if (asObject(v)->getCallDataVirtual(callData) != CallTypeNone)
106106 return true;
107107 }
108108 return false;

Source/JavaScriptCore/runtime/PropertySlot.cpp

@@JSValue PropertySlot::functionGetter(ExecState* exec) const
3333 return exec->exception();
3434
3535 CallData callData;
36  CallType callType = m_data.getterFunc->getCallData(callData);
 36 CallType callType = m_data.getterFunc->getCallDataVirtual(callData);
3737
3838 // Only objects can have accessor properties.
3939 // If the base is WebCore's global object then we need to substitute the shell.

Source/JavaScriptCore/runtime/RegExpConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
357357 return JSValue::encode(constructRegExp(exec, asInternalFunction(exec->callee())->globalObject(), args));
358358}
359359
360 CallType RegExpConstructor::getCallData(CallData& callData)
 360CallType RegExpConstructor::getCallDataVirtual(CallData& callData)
 361{
 362 return getCallData(this, callData);
 363}
 364
 365CallType RegExpConstructor::getCallData(JSCell*, CallData& callData)
361366{
362367 callData.native.function = callRegExpConstructor;
363368 return CallTypeHost;

Source/JavaScriptCore/runtime/RegExpConstructor.h

@@namespace JSC {
9898 private:
9999 RegExpConstructor(JSGlobalObject*, Structure*);
100100 virtual ConstructType getConstructData(ConstructData&);
101  virtual CallType getCallData(CallData&);
 101 virtual CallType getCallDataVirtual(CallData&);
 102 static CallType getCallData(JSCell*, CallData&);
102103
103104 OwnPtr<RegExpConstructorPrivate> d;
104105 };

Source/JavaScriptCore/runtime/StringConstructor.cpp

@@static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
109109 return JSValue::encode(jsString(exec, exec->argument(0).toString(exec)));
110110}
111111
112 CallType StringConstructor::getCallData(CallData& callData)
 112CallType StringConstructor::getCallDataVirtual(CallData& callData)
 113{
 114 return getCallData(this, callData);
 115}
 116
 117CallType StringConstructor::getCallData(JSCell*, CallData& callData)
113118{
114119 callData.native.function = callStringConstructor;
115120 return CallTypeHost;

Source/JavaScriptCore/runtime/StringConstructor.h

@@namespace JSC {
5252 StringConstructor(JSGlobalObject*, Structure*);
5353 void finishCreation(ExecState*, StringPrototype*);
5454 virtual ConstructType getConstructData(ConstructData&);
55  virtual CallType getCallData(CallData&);
 55 virtual CallType getCallDataVirtual(CallData&);
 56 static CallType getCallData(JSCell*, CallData&);
5657
5758 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
5859 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);

Source/JavaScriptGlue/ChangeLog

 12011-09-25 Mark Hahnenberg <mhahnenberg@apple.com>
 2
 3 Add static version of JSCell::getCallData
 4 https://bugs.webkit.org/show_bug.cgi?id=68741
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 In this patch we just extract the bodies of the virtual getCallData methods
 9 throughout the JSCell inheritance hierarchy out into static methods, which are
 10 now called from the virtual methods. This is an intermediate step in trying to
 11 move the virtual-ness of getCallData into our own method table stored in
 12 ClassInfo. We need to convert the methods to static methods because static methods
 13 can be represented as function pointers rather than pointers to member methods, and
 14 function pointers are smaller and faster to call than pointers to member methods.
 15
 16 * JSValueWrapper.cpp:
 17 (JSValueWrapper::JSObjectCallFunction):
 18 * UserObjectImp.cpp:
 19 (UserObjectImp::getCallDataVirtual):
 20 (UserObjectImp::getCallData):
 21 * UserObjectImp.h:
 22
1232011-09-23 Mark Hahnenberg <mhahnenberg@apple.com>
224
325 Add static version of JSCell::visitChildren

Source/JavaScriptGlue/JSValueWrapper.cpp

@@JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj
163163 }
164164
165165 CallData callData;
166  CallType callType = objValue->getCallData(callData);
 166 CallType callType = objValue->getCallDataVirtual(callData);
167167 if (callType == CallTypeNone)
168168 return 0;
169169 JSValue resultValue = call(exec, objValue, callType, callData, ksjThisObj, listArgs);

Source/JavaScriptGlue/UserObjectImp.cpp

@@UserObjectImp::~UserObjectImp()
4646 fJSUserObject->Release();
4747}
4848
49 CallType UserObjectImp::getCallData(CallData& callData)
 49CallType UserObjectImp::getCallDataVirtual(CallData& callData)
5050{
51  return fJSUserObject ? fJSUserObject->getCallData(callData) : CallTypeNone;
 51 return getCallData(this, callData);
 52}
 53
 54CallType UserObjectImp::getCallData(JSCell* cell, CallData& callData)
 55{
 56 UserObjectImp* thisObject = static_cast<UserObjectImp*>(cell);
 57 return thisObject->fJSUserObject ? thisObject->fJSUserObject->getCallData(callData) : CallTypeNone;
5258}
5359
5460JSValue UserObjectImp::callAsFunction(ExecState *exec)

Source/JavaScriptGlue/UserObjectImp.h

@@public:
4949
5050 static const ClassInfo s_info;
5151
52  virtual CallType getCallData(CallData&);
 52 virtual CallType getCallDataVirtual(CallData&);
 53 static CallType getCallData(JSCell*, CallData&);
5354
5455 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
5556

Source/WebCore/ChangeLog

 12011-09-25 Mark Hahnenberg <mhahnenberg@apple.com>
 2
 3 Add static version of JSCell::getCallData
 4 https://bugs.webkit.org/show_bug.cgi?id=68741
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 No new tests.
 9
 10 In this patch we just extract the bodies of the virtual getCallData methods
 11 throughout the JSCell inheritance hierarchy out into static methods, which are
 12 now called from the virtual methods. This is an intermediate step in trying to
 13 move the virtual-ness of getCallData into our own method table stored in
 14 ClassInfo. We need to convert the methods to static methods because static methods
 15 can be represented as function pointers rather than pointers to member methods, and
 16 function pointers are smaller and faster to call than pointers to member methods.
 17
 18 * WebCore.exp.in:
 19 * bindings/js/JSCallbackData.cpp:
 20 (WebCore::JSCallbackData::invokeCallback):
 21 * bindings/js/JSCustomXPathNSResolver.cpp:
 22 (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
 23 * bindings/js/JSErrorHandler.cpp:
 24 (WebCore::JSErrorHandler::handleEvent):
 25 * bindings/js/JSEventListener.cpp:
 26 (WebCore::JSEventListener::handleEvent):
 27 * bindings/js/JSHTMLAllCollectionCustom.cpp:
 28 (WebCore::JSHTMLAllCollection::getCallDataVirtual):
 29 (WebCore::JSHTMLAllCollection::getCallData):
 30 * bindings/js/JSHTMLAppletElementCustom.cpp:
 31 (WebCore::JSHTMLAppletElement::getCallDataVirtual):
 32 (WebCore::JSHTMLAppletElement::getCallData):
 33 * bindings/js/JSHTMLEmbedElementCustom.cpp:
 34 (WebCore::JSHTMLEmbedElement::getCallDataVirtual):
 35 (WebCore::JSHTMLEmbedElement::getCallData):
 36 * bindings/js/JSHTMLObjectElementCustom.cpp:
 37 (WebCore::JSHTMLObjectElement::getCallDataVirtual):
 38 (WebCore::JSHTMLObjectElement::getCallData):
 39 * bindings/js/JSInjectedScriptHostCustom.cpp:
 40 (WebCore::JSInjectedScriptHost::evaluate):
 41 * bindings/js/JSPluginElementFunctions.cpp:
 42 (WebCore::runtimeObjectGetCallData):
 43 * bindings/scripts/CodeGeneratorJS.pm:
 44 (GenerateHeader):
 45 * bridge/objc/objc_runtime.h:
 46 * bridge/objc/objc_runtime.mm:
 47 (JSC::Bindings::ObjcFallbackObjectImp::getCallDataVirtual):
 48 (JSC::Bindings::ObjcFallbackObjectImp::getCallData):
 49 * bridge/qt/qt_runtime.cpp:
 50 (JSC::Bindings::QtRuntimeMetaMethod::getCallDataVirtual):
 51 (JSC::Bindings::QtRuntimeMetaMethod::getCallData):
 52 (JSC::Bindings::QtRuntimeConnectionMethod::call):
 53 (JSC::Bindings::isJavaScriptFunction):
 54 * bridge/qt/qt_runtime.h:
 55 * bridge/runtime_method.cpp:
 56 (JSC::RuntimeMethod::getCallDataVirtual):
 57 (JSC::RuntimeMethod::getCallData):
 58 * bridge/runtime_method.h:
 59 * bridge/runtime_object.cpp:
 60 (JSC::Bindings::RuntimeObject::getCallDataVirtual):
 61 (JSC::Bindings::RuntimeObject::getCallData):
 62 * bridge/runtime_object.h:
 63
1642011-09-25 Adam Barth <abarth@webkit.org>
265
366 Attempted build fixes for GTK and Qt.

Source/WebCore/WebCore.exp.in

@@__ZN7WebCore5Frame26sendOrientationChangeEventEi
16461646#endif
16471647
16481648#if USE(PLUGIN_HOST_PROCESS)
1649 __ZN3JSC13RuntimeMethod11getCallDataERNS_8CallDataE
16501649__ZN3JSC13RuntimeMethod14finishCreationERNS_12JSGlobalDataERKNS_10IdentifierE
 1650__ZN3JSC13RuntimeMethod18getCallDataVirtualERNS_8CallDataE
16511651__ZN3JSC13RuntimeMethod18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
16521652__ZN3JSC13RuntimeMethod24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
16531653__ZN3JSC13RuntimeMethod6s_infoE
16541654__ZN3JSC13RuntimeMethodC2EPNS_14JSGlobalObjectEPNS_9StructureERN3WTF6VectorIPNS_8Bindings6MethodELm0EEE
16551655__ZN3JSC8Bindings10RootObjectD1Ev
1656 __ZN3JSC8Bindings13RuntimeObject11getCallDataERNS_8CallDataE
16571656__ZN3JSC8Bindings13RuntimeObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
16581657__ZN3JSC8Bindings13RuntimeObject14finishCreationEPNS_14JSGlobalObjectE
16591658__ZN3JSC8Bindings13RuntimeObject16getConstructDataERNS_13ConstructDataE
 1659__ZN3JSC8Bindings13RuntimeObject18getCallDataVirtualERNS_8CallDataE
16601660__ZN3JSC8Bindings13RuntimeObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
16611661__ZN3JSC8Bindings13RuntimeObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
16621662__ZN3JSC8Bindings13RuntimeObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE

Source/WebCore/bindings/js/JSCallbackData.cpp

@@JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE
5353 CallData callData;
5454 CallType callType = getCallData(function, callData);
5555 if (callType == CallTypeNone) {
56  callType = callback()->getCallData(callData);
 56 callType = callback()->getCallDataVirtual(callData);
5757 if (callType == CallTypeNone)
5858 return JSValue();
5959 function = callback();

Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp

@@String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
7777 CallData callData;
7878 CallType callType = getCallData(function, callData);
7979 if (callType == CallTypeNone) {
80  callType = m_customResolver->getCallData(callData);
 80 callType = m_customResolver->getCallDataVirtual(callData);
8181 if (callType == CallTypeNone) {
8282 // FIXME: Pass actual line number and source URL.
8383 m_globalObject->impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());

Source/WebCore/bindings/js/JSErrorHandler.cpp

@@void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext,
7474 ExecState* exec = globalObject->globalExec();
7575
7676 CallData callData;
77  CallType callType = jsFunction->getCallData(callData);
 77 CallType callType = jsFunction->getCallDataVirtual(callData);
7878
7979 if (callType != CallTypeNone) {
8080 RefPtr<JSErrorHandler> protectedctor(this);

Source/WebCore/bindings/js/JSEventListener.cpp

@@void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
101101 CallType callType = getCallData(handleEventFunction, callData);
102102 if (callType == CallTypeNone) {
103103 handleEventFunction = JSValue();
104  callType = jsFunction->getCallData(callData);
 104 callType = jsFunction->getCallDataVirtual(callData);
105105 }
106106
107107 if (callType != CallTypeNone) {

Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp

@@static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
9999 return JSValue::encode(jsUndefined());
100100}
101101
102 CallType JSHTMLAllCollection::getCallData(CallData& callData)
 102CallType JSHTMLAllCollection::getCallDataVirtual(CallData& callData)
 103{
 104 return getCallData(this, callData);
 105}
 106
 107CallType JSHTMLAllCollection::getCallData(JSCell*, CallData& callData)
103108{
104109 callData.native.function = callHTMLAllCollection;
105110 return CallTypeHost;

Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp

@@bool JSHTMLAppletElement::putDelegate(ExecState* exec, const Identifier& propert
4848 return runtimeObjectCustomPut(exec, propertyName, value, this, slot);
4949}
5050
51 CallType JSHTMLAppletElement::getCallData(CallData& callData)
 51CallType JSHTMLAppletElement::getCallDataVirtual(CallData& callData)
5252{
53  return runtimeObjectGetCallData(this, callData);
 53 return getCallData(this, callData);
 54}
 55
 56CallType JSHTMLAppletElement::getCallData(JSCell* cell, CallData& callData)
 57{
 58 return runtimeObjectGetCallData(static_cast<JSHTMLAppletElement*>(cell), callData);
5459}
5560
5661} // namespace WebCore

Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp

@@bool JSHTMLEmbedElement::putDelegate(ExecState* exec, const Identifier& property
4848 return runtimeObjectCustomPut(exec, propertyName, value, this, slot);
4949}
5050
51 CallType JSHTMLEmbedElement::getCallData(CallData& callData)
 51CallType JSHTMLEmbedElement::getCallDataVirtual(CallData& callData)
5252{
53  return runtimeObjectGetCallData(this, callData);
 53 return getCallData(this, callData);
 54}
 55
 56CallType JSHTMLEmbedElement::getCallData(JSCell* cell, CallData& callData)
 57{
 58 return runtimeObjectGetCallData(static_cast<JSHTMLEmbedElement*>(cell), callData);
5459}
5560
5661} // namespace WebCore

Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp

@@bool JSHTMLObjectElement::putDelegate(ExecState* exec, const Identifier& propert
4848 return runtimeObjectCustomPut(exec, propertyName, value, this, slot);
4949}
5050
51 CallType JSHTMLObjectElement::getCallData(CallData& callData)
 51CallType JSHTMLObjectElement::getCallDataVirtual(CallData& callData)
5252{
53  return runtimeObjectGetCallData(this, callData);
 53 return getCallData(this, callData);
 54}
 55
 56CallType JSHTMLObjectElement::getCallData(JSCell* cell, CallData& callData)
 57{
 58 return runtimeObjectGetCallData(static_cast<JSHTMLObjectElement*>(cell), callData);
5459}
5560
5661} // namespace WebCore

Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp

@@JSValue JSInjectedScriptHost::evaluate(ExecState* exec)
8585 JSGlobalObject* globalObject = exec->lexicalGlobalObject();
8686 JSFunction* evalFunction = globalObject->evalFunction();
8787 CallData callData;
88  CallType callType = evalFunction->getCallData(callData);
 88 CallType callType = evalFunction->getCallDataVirtual(callData);
8989 if (callType == CallTypeNone)
9090 return jsUndefined();
9191 MarkedArgumentBuffer args;

Source/WebCore/bindings/js/JSPluginElementFunctions.cpp

@@CallType runtimeObjectGetCallData(JSHTMLElement* element, CallData& callData)
177177 if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) {
178178 CallData scriptObjectCallData;
179179
180  if (scriptObject->getCallData(scriptObjectCallData) == CallTypeNone)
 180 if (scriptObject->getCallDataVirtual(scriptObjectCallData) == CallTypeNone)
181181 return CallTypeNone;
182182
183183 callData.native.function = callPlugin;

Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

@@sub GenerateHeader
816816 push(@headerContent, " virtual JSC::ScopeChainNode* pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChainNode*) const;\n\n") if $dataNode->extendedAttributes->{"CustomPushEventHandlerScope"};
817817
818818 # Custom call functions
819  push(@headerContent, " virtual JSC::CallType getCallData(JSC::CallData&);\n\n") if $dataNode->extendedAttributes->{"CustomCall"};
 819 push(@headerContent, " virtual JSC::CallType getCallDataVirtual(JSC::CallData&);\n\n") if $dataNode->extendedAttributes->{"CustomCall"};
 820 push(@headerContent, " static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n") if $dataNode->extendedAttributes->{"CustomCall"};
820821
821822 # Custom deleteProperty function
822823 push(@headerContent, " virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&);\n") if $dataNode->extendedAttributes->{"CustomDeleteProperty"};

Source/WebCore/bridge/objc/objc_runtime.h

@@private:
126126 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
127127 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
128128 virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
129  virtual CallType getCallData(CallData&);
 129 virtual CallType getCallDataVirtual(CallData&);
 130 static CallType getCallData(JSCell*, CallData&);
130131 virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
131132 virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
132133

Source/WebCore/bridge/objc/objc_runtime.mm

@@static EncodedJSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec)
255255 return JSValue::encode(result);
256256}
257257
258 CallType ObjcFallbackObjectImp::getCallData(CallData& callData)
 258CallType ObjcFallbackObjectImp::getCallDataVirtual(CallData& callData)
259259{
260  id targetObject = _instance->getObject();
 260 return getCallData(this, callData);
 261}
 262
 263CallType ObjcFallbackObjectImp::getCallData(JSCell* cell, CallData& callData)
 264{
 265 ObjcFallbackObjectImp* thisObject = static_cast<ObjcFallbackObjectImp*>(cell);
 266 id targetObject = thisObject->_instance->getObject();
261267 if (![targetObject respondsToSelector:@selector(invokeUndefinedMethodFromWebScript:withArguments:)])
262268 return CallTypeNone;
263269 callData.native.function = callObjCFallbackObject;

Source/WebCore/bridge/qt/qt_runtime.cpp

@@EncodedJSValue QtRuntimeMetaMethod::call(ExecState* exec)
14911491 return JSValue::encode(jsUndefined());
14921492}
14931493
1494 CallType QtRuntimeMetaMethod::getCallData(CallData& callData)
 1494CallType QtRuntimeMetaMethod::getCallDataVirtual(CallData& callData)
 1495{
 1496 return getCallData(this, callData);
 1497}
 1498
 1499CallType QtRuntimeMetaMethod::getCallData(JSCell*, CallData& callData)
14951500{
14961501 callData.native.function = call;
14971502 return CallTypeHost;

@@EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
16201625 if (exec->argumentCount() == 1) {
16211626 funcObject = exec->argument(0).toObject(exec);
16221627 CallData callData;
1623  if (funcObject->getCallData(callData) == CallTypeNone) {
 1628 if (funcObject->getCallDataVirtual(callData) == CallTypeNone) {
16241629 if (d->m_isConnect)
16251630 return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function"));
16261631 else

@@EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
16331638 // Get the actual function to call
16341639 JSObject *asObj = exec->argument(1).toObject(exec);
16351640 CallData callData;
1636  if (asObj->getCallData(callData) != CallTypeNone) {
 1641 if (asObj->getCallDataVirtual(callData) != CallTypeNone) {
16371642 // Function version
16381643 funcObject = asObj;
16391644 } else {

@@EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
16461651 JSValue val = thisObject->get(exec, funcIdent);
16471652 JSObject* asFuncObj = val.toObject(exec);
16481653
1649  if (asFuncObj->getCallData(callData) != CallTypeNone) {
 1654 if (asFuncObj->getCallDataVirtual(callData) != CallTypeNone) {
16501655 funcObject = asFuncObj;
16511656 } else {
16521657 if (d->m_isConnect)

@@EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
17301735 return JSValue::encode(jsUndefined());
17311736}
17321737
1733 CallType QtRuntimeConnectionMethod::getCallData(CallData& callData)
 1738CallType QtRuntimeConnectionMethod::getCallDataVirtual(CallData& callData)
 1739{
 1740 return getCallData(this, callData);
 1741}
 1742
 1743CallType QtRuntimeConnectionMethod::getCallData(JSCell*, CallData& callData)
17341744{
17351745 callData.native.function = call;
17361746 return CallTypeHost;

@@int QtConnectionObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
18531863static bool isJavaScriptFunction(JSObjectRef object)
18541864{
18551865 CallData callData;
1856  return toJS(object)->getCallData(callData) == CallTypeJS;
 1866 return toJS(object)->getCallDataVirtual(callData) == CallTypeJS;
18571867}
18581868
18591869void QtConnectionObject::execute(void** argv)

Source/WebCore/bridge/qt/qt_runtime.h

@@private:
178178 QtRuntimeMetaMethod(ExecState*, Structure*, const Identifier&);
179179 void finishCreation(ExecState*, const Identifier&, PassRefPtr<QtInstance>, int index, const QByteArray& signature, bool allowPrivate);
180180
181  virtual CallType getCallData(CallData&);
 181 virtual CallType getCallDataVirtual(CallData&);
 182 static CallType getCallData(JSCell*, CallData&);
182183 static EncodedJSValue JSC_HOST_CALL call(ExecState* exec);
183184 static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
184185 static JSValue connectGetter(ExecState*, JSValue, const Identifier&);

@@private:
209210 QtRuntimeConnectionMethod(ExecState*, Structure*, const Identifier&);
210211 void finishCreation(ExecState*, const Identifier&, bool isConnect, PassRefPtr<QtInstance>, int index, const QByteArray& signature);
211212
212  virtual CallType getCallData(CallData&);
 213 virtual CallType getCallDataVirtual(CallData&);
 214 static CallType getCallData(JSCell*, CallData&);
213215 static EncodedJSValue JSC_HOST_CALL call(ExecState* exec);
214216 static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
215217 static QMultiMap<QObject *, QtConnectionObject *> connections;

Source/WebCore/bridge/runtime_method.cpp

@@static EncodedJSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec)
123123 return JSValue::encode(result);
124124}
125125
126 CallType RuntimeMethod::getCallData(CallData& callData)
 126CallType RuntimeMethod::getCallDataVirtual(CallData& callData)
 127{
 128 return getCallData(this, callData);
 129}
 130
 131CallType RuntimeMethod::getCallData(JSCell*, CallData& callData)
127132{
128133 callData.native.function = callRuntimeMethod;
129134 return CallTypeHost;

Source/WebCore/bridge/runtime_method.h

@@private:
6767 static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
6868 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
6969 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
70  virtual CallType getCallData(CallData&);
 70 virtual CallType getCallDataVirtual(CallData&);
 71 static CallType getCallData(JSCell*, CallData&);
7172
7273 OwnPtr<Bindings::MethodList> _methodList;
7374};

Source/WebCore/bridge/runtime_object.cpp

@@static EncodedJSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec)
259259 return JSValue::encode(result);
260260}
261261
262 CallType RuntimeObject::getCallData(CallData& callData)
 262CallType RuntimeObject::getCallDataVirtual(CallData& callData)
263263{
264  if (!m_instance)
 264 return getCallData(this, callData);
 265}
 266
 267CallType RuntimeObject::getCallData(JSCell* cell, CallData& callData)
 268{
 269 RuntimeObject* thisObject = static_cast<RuntimeObject*>(cell);
 270 if (!thisObject->m_instance)
265271 return CallTypeNone;
266272
267  RefPtr<Instance> instance = m_instance;
 273 RefPtr<Instance> instance = thisObject->m_instance;
268274 if (!instance->supportsInvokeDefaultMethod())
269275 return CallTypeNone;
270276

Source/WebCore/bridge/runtime_object.h

@@public:
5050 virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
5151 virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
5252 virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
53  virtual CallType getCallData(CallData&);
 53 virtual CallType getCallDataVirtual(CallData&);
 54 static CallType getCallData(JSCell*, CallData&);
5455 virtual ConstructType getConstructData(ConstructData&);
5556
5657 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);

Source/WebKit/mac/ChangeLog

 12011-09-25 Mark Hahnenberg <mhahnenberg@apple.com>
 2
 3 Add static version of JSCell::getCallData
 4 https://bugs.webkit.org/show_bug.cgi?id=68741
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 In this patch we just extract the bodies of the virtual getCallData methods
 9 throughout the JSCell inheritance hierarchy out into static methods, which are
 10 now called from the virtual methods. This is an intermediate step in trying to
 11 move the virtual-ness of getCallData into our own method table stored in
 12 ClassInfo. We need to convert the methods to static methods because static methods
 13 can be represented as function pointers rather than pointers to member methods, and
 14 function pointers are smaller and faster to call than pointers to member methods.
 15
 16 * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
 17 (WebKit::NetscapePluginInstanceProxy::invokeDefault):
 18
1192011-09-24 Adam Barth <abarth@webkit.org>
220
321 Always enable ENABLE(OFFLINE_WEB_APPLICATIONS)

Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm

@@bool NetscapePluginInstanceProxy::invokeDefault(uint32_t objectID, data_t argume
943943 ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
944944 JSLock lock(SilenceAssertionsOnly);
945945 CallData callData;
946  CallType callType = object->getCallData(callData);
 946 CallType callType = object->getCallDataVirtual(callData);
947947 if (callType == CallTypeNone)
948948 return false;
949949

Source/WebKit2/ChangeLog

 12011-09-25 Mark Hahnenberg <mhahnenberg@apple.com>
 2
 3 Add static version of JSCell::getCallData
 4 https://bugs.webkit.org/show_bug.cgi?id=68741
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 In this patch we just extract the bodies of the virtual getCallData methods
 9 throughout the JSCell inheritance hierarchy out into static methods, which are
 10 now called from the virtual methods. This is an intermediate step in trying to
 11 move the virtual-ness of getCallData into our own method table stored in
 12 ClassInfo. We need to convert the methods to static methods because static methods
 13 can be represented as function pointers rather than pointers to member methods, and
 14 function pointers are smaller and faster to call than pointers to member methods.
 15
 16 * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
 17 (WebKit::JSNPMethod::getCallDataVirtual):
 18 (WebKit::JSNPMethod::getCallData):
 19 * WebProcess/Plugins/Netscape/JSNPMethod.h:
 20 * WebProcess/Plugins/Netscape/JSNPObject.cpp:
 21 (WebKit::JSNPObject::getCallDataVirtual):
 22 (WebKit::JSNPObject::getCallData):
 23 * WebProcess/Plugins/Netscape/JSNPObject.h:
 24
1252011-09-24 Adam Barth <abarth@webkit.org>
226
327 Always enable ENABLE(OFFLINE_WEB_APPLICATIONS)

Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp

@@static EncodedJSValue JSC_HOST_CALL callMethod(ExecState* exec)
7777 return throwVMTypeError(exec);
7878}
7979
80 CallType JSNPMethod::getCallData(CallData& callData)
 80CallType JSNPMethod::getCallDataVirtual(CallData& callData)
 81{
 82 return getCallData(this, callData);
 83}
 84
 85CallType JSNPMethod::getCallData(JSCell*, CallData& callData)
8186{
8287 callData.native.function = callMethod;
8388 return CallTypeHost;

Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h

@@private:
6262 return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);
6363 }
6464
65  virtual JSC::CallType getCallData(JSC::CallData&);
 65 virtual JSC::CallType getCallDataVirtual(JSC::CallData&);
 66 static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
6667
6768 NPIdentifier m_npIdentifier;
6869};

Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp

@@static EncodedJSValue JSC_HOST_CALL callNPJSObject(ExecState* exec)
217217 return JSValue::encode(static_cast<JSNPObject*>(object)->callObject(exec));
218218}
219219
220 JSC::CallType JSNPObject::getCallData(JSC::CallData& callData)
 220CallType JSNPObject::getCallDataVirtual(CallData& callData)
221221{
222  ASSERT_GC_OBJECT_INHERITS(this, &s_info);
223  if (!m_npObject || !m_npObject->_class->invokeDefault)
 222 return getCallData(this, callData);
 223}
 224
 225JSC::CallType JSNPObject::getCallData(JSC::JSCell* cell, JSC::CallData& callData)
 226{
 227 JSNPObject* thisObject = static_cast<JSNPObject*>(cell);
 228 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
 229 if (!thisObject->m_npObject || !thisObject->m_npObject->_class->invokeDefault)
224230 return CallTypeNone;
225231
226232 callData.native.function = callNPJSObject;

Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h

@@private:
7979 return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);
8080 }
8181
82  virtual JSC::CallType getCallData(JSC::CallData&);
 82 virtual JSC::CallType getCallDataVirtual(JSC::CallData&);
 83 static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
8384 virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
8485
8586 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);