Commit 459251ae authored by oliver@apple.com's avatar oliver@apple.com

Improve native call performance

Reviewed by Gavin Barraclough.

Fix the windows build by adding calling convention declarations everywhere,
chose fastcall as that seemed most sensible given we were having to declare
the convention explicitly.  In addition switched to fastcall on mac in the
deluded belief that documented fastcall behavior on windows would match
actual its actual behavior.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent aa4c12d0
......@@ -48,7 +48,7 @@ private:
virtual CallType getCallData(CallData&);
virtual const ClassInfo* classInfo() const { return &info; }
static JSValue call(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL call(ExecState*, JSObject*, JSValue, const ArgList&);
JSObjectCallAsFunctionCallback m_callback;
};
......
......@@ -79,7 +79,7 @@ private:
static JSCallbackObject* asCallbackObject(JSValue);
static JSValue call(ExecState*, JSObject* functionObject, JSValue thisValue, const ArgList&);
static JSValue JSC_HOST_CALL call(ExecState*, JSObject* functionObject, JSValue thisValue, const ArgList&);
static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&);
static JSValue staticValueGetter(ExecState*, const Identifier&, const PropertySlot&);
......
2009-05-07 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
Improve native call performance
Fix the windows build by adding calling convention declarations everywhere,
chose fastcall as that seemed most sensible given we were having to declare
the convention explicitly. In addition switched to fastcall on mac in the
deluded belief that documented fastcall behavior on windows would match
actual its actual behavior.
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
* interpreter/CallFrame.h:
(JSC::ExecState::argumentCount):
* jit/JIT.cpp:
(JSC::JIT::privateCompileCTIMachineTrampolines):
* jsc.cpp:
(functionPrint):
(functionDebug):
(functionGC):
(functionVersion):
(functionRun):
(functionLoad):
(functionSetSamplingFlags):
(functionClearSamplingFlags):
(functionReadline):
(functionQuit):
* runtime/ArrayConstructor.cpp:
(JSC::callArrayConstructor):
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncConcat):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncReverse):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSort):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
(JSC::arrayProtoFuncIndexOf):
(JSC::arrayProtoFuncLastIndexOf):
* runtime/BooleanConstructor.cpp:
(JSC::callBooleanConstructor):
* runtime/BooleanPrototype.cpp:
(JSC::booleanProtoFuncToString):
(JSC::booleanProtoFuncValueOf):
* runtime/CallData.h:
* runtime/DateConstructor.cpp:
(JSC::callDate):
(JSC::dateParse):
(JSC::dateNow):
(JSC::dateUTC):
* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetMilliSeconds):
(JSC::dateProtoFuncGetUTCMilliseconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::dateProtoFuncSetTime):
(JSC::dateProtoFuncSetMilliSeconds):
(JSC::dateProtoFuncSetUTCMilliseconds):
(JSC::dateProtoFuncSetSeconds):
(JSC::dateProtoFuncSetUTCSeconds):
(JSC::dateProtoFuncSetMinutes):
(JSC::dateProtoFuncSetUTCMinutes):
(JSC::dateProtoFuncSetHours):
(JSC::dateProtoFuncSetUTCHours):
(JSC::dateProtoFuncSetDate):
(JSC::dateProtoFuncSetUTCDate):
(JSC::dateProtoFuncSetMonth):
(JSC::dateProtoFuncSetUTCMonth):
(JSC::dateProtoFuncSetFullYear):
(JSC::dateProtoFuncSetUTCFullYear):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear):
* runtime/ErrorConstructor.cpp:
(JSC::callErrorConstructor):
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/FunctionConstructor.cpp:
(JSC::callFunctionConstructor):
* runtime/FunctionPrototype.cpp:
(JSC::callFunctionPrototype):
(JSC::functionProtoFuncToString):
(JSC::functionProtoFuncApply):
(JSC::functionProtoFuncCall):
* runtime/JSFunction.h:
(JSC::JSFunction::nativeFunction):
(JSC::JSFunction::setScopeChain):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
(JSC::globalFuncParseInt):
(JSC::globalFuncParseFloat):
(JSC::globalFuncIsNaN):
(JSC::globalFuncIsFinite):
(JSC::globalFuncDecodeURI):
(JSC::globalFuncDecodeURIComponent):
(JSC::globalFuncEncodeURI):
(JSC::globalFuncEncodeURIComponent):
(JSC::globalFuncEscape):
(JSC::globalFuncUnescape):
(JSC::globalFuncJSCPrint):
* runtime/JSGlobalObjectFunctions.h:
* runtime/MathObject.cpp:
(JSC::mathProtoFuncAbs):
(JSC::mathProtoFuncACos):
(JSC::mathProtoFuncASin):
(JSC::mathProtoFuncATan):
(JSC::mathProtoFuncATan2):
(JSC::mathProtoFuncCeil):
(JSC::mathProtoFuncCos):
(JSC::mathProtoFuncExp):
(JSC::mathProtoFuncFloor):
(JSC::mathProtoFuncLog):
(JSC::mathProtoFuncMax):
(JSC::mathProtoFuncMin):
(JSC::mathProtoFuncPow):
(JSC::mathProtoFuncRandom):
(JSC::mathProtoFuncRound):
(JSC::mathProtoFuncSin):
(JSC::mathProtoFuncSqrt):
(JSC::mathProtoFuncTan):
* runtime/NativeErrorConstructor.cpp:
(JSC::callNativeErrorConstructor):
* runtime/NativeFunctionWrapper.h:
* runtime/NumberConstructor.cpp:
(JSC::callNumberConstructor):
* runtime/NumberPrototype.cpp:
(JSC::numberProtoFuncToString):
(JSC::numberProtoFuncToLocaleString):
(JSC::numberProtoFuncValueOf):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToPrecision):
* runtime/ObjectConstructor.cpp:
(JSC::callObjectConstructor):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncValueOf):
(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncIsPrototypeOf):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable):
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString):
* runtime/ObjectPrototype.h:
* runtime/RegExpConstructor.cpp:
(JSC::callRegExpConstructor):
* runtime/RegExpObject.cpp:
(JSC::callRegExpObject):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncTest):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):
* runtime/StringConstructor.cpp:
(JSC::stringFromCharCode):
(JSC::callStringConstructor):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncToString):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncConcat):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncLastIndexOf):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplit):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncLocaleCompare):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
* wtf/Platform.h:
2009-05-07 Geoffrey Garen <ggaren@apple.com>
Not reviewed.
......@@ -6,8 +6,11 @@ EXPORTS
??0DropAllLocks@JSLock@JSC@@QAE@_N@Z
??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0JSFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0Mutex@WTF@@QAE@XZ
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6A?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
??0StringObject@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@@Z
......@@ -171,7 +174,6 @@ EXPORTS
?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z
?nonInlineNaN@JSImmediate@JSC@@CANXZ
?objectCount@Heap@JSC@@QAEIXZ
?objectProtoFuncToString@JSC@@YA?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z
?primaryHeapBegin@Heap@JSC@@QAE?AV?$CollectorHeapIterator@$0A@@2@XZ
?primaryHeapEnd@Heap@JSC@@QAE?AV?$CollectorHeapIterator@$0A@@2@XZ
......@@ -259,7 +261,6 @@ EXPORTS
WTFReportAssertionFailureWithMessage
WTFReportError
?constructEmptyArray@JSC@@YAPAVJSArray@1@PAVExecState@1@@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6A?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
?substr@UString@JSC@@QBE?AV12@HH@Z
?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVInternalFunction@2@I@Z
......
......@@ -7,8 +7,11 @@ EXPORTS
??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
??0Mutex@WTF@@QAE@XZ
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6A?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V41@ABVArgList@1@@Z@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0JSFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
??0StringObject@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@@Z
??0ThreadCondition@WTF@@QAE@XZ
......@@ -171,7 +174,6 @@ EXPORTS
?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z
?nonInlineNaN@JSImmediate@JSC@@CANXZ
?objectCount@Heap@JSC@@QAEIXZ
?objectProtoFuncToString@JSC@@YA?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z
?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z
?primaryHeapBegin@Heap@JSC@@QAE?AV?$CollectorHeapIterator@$0A@@2@XZ
?primaryHeapEnd@Heap@JSC@@QAE?AV?$CollectorHeapIterator@$0A@@2@XZ
......@@ -259,7 +261,6 @@ EXPORTS
WTFReportAssertionFailureWithMessage
WTFReportError
?constructEmptyArray@JSC@@YAPAVJSArray@1@PAVExecState@1@@Z
??0PrototypeFunction@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6A?AVJSValue@1@0PAVJSObject@1@V61@ABVArgList@1@@Z@Z
?substr@UString@JSC@@QBE?AV12@HH@Z
?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVInternalFunction@2@I@Z
......
......@@ -40,6 +40,7 @@ namespace JSC {
JSFunction* callee() const { return this[RegisterFile::Callee].function(); }
CodeBlock* codeBlock() const { return this[RegisterFile::CodeBlock].Register::codeBlock(); }
ScopeChainNode* scopeChain() const { return this[RegisterFile::ScopeChain].Register::scopeChain(); }
int argumentCount() const { return this[RegisterFile::ArgumentCount].i(); }
JSValue thisValue();
......@@ -107,7 +108,6 @@ namespace JSC {
CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; }
int argumentCount() const { return this[RegisterFile::ArgumentCount].i(); }
CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
Arguments* optionalCalleeArguments() const { return this[RegisterFile::OptionalCalleeArguments].arguments(); }
Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
......
......@@ -1822,14 +1822,42 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
#else
emitGetFromCallFrameHeader(RegisterFile::ArgumentCount, regT0);
struct NativeFunctionSignature {
CallFrame* callFrame;
/* We have two structs that we use to describe the stackframe we set up for our
* call to native code. NativeCallFrameStructure describes the how we set up the stack
* in advance of the call. NativeFunctionCalleeSignature describes the callframe
* as the native code expects it. We do this as we are using the fastcall calling
* convention which results in the callee popping its arguments off the stack, but
* not the rest of the callframe so we need a nice way to ensure we increment the
* stack pointer by the right amount after the call.
*/
#if COMPILER(MSVC)
struct NativeCallFrameStructure {
// CallFrame* callFrame; // passed in EDX
JSObject* callee;
JSValue thisValue;
ArgList* argPointer;
ArgList args;
JSValue result;
};
const int NativeCallFrameSize = (sizeof(NativeFunctionSignature) + 15) & ~15;
struct NativeFunctionCalleeSignature {
JSObject* callee;
JSValue thisValue;
ArgList* argPointer;
};
#else
struct NativeCallFrameStructure {
// CallFrame* callFrame; // passed in ECX
// JSObject* callee; // passed in EDX
JSValue thisValue;
ArgList* argPointer;
ArgList args;
};
struct NativeFunctionCalleeSignature {
JSValue thisValue;
ArgList* argPointer;
};
#endif
const int NativeCallFrameSize = (sizeof(NativeCallFrameStructure) + 15) & ~15;
// Allocate system stack frame
subPtr(Imm32(NativeCallFrameSize), stackPointerRegister);
......@@ -1837,7 +1865,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
subPtr(Imm32(1), regT0); // Don't include 'this' in argcount
// push argcount
storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, args) + FIELD_OFFSET(ArgList, m_argCount)));
storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, args) + FIELD_OFFSET(ArgList, m_argCount)));
// Calculate the start of the callframe header, and store in regT1
addPtr(Imm32(-RegisterFile::CallFrameHeaderSize * (int)sizeof(Register)), callFrameRegister, regT1);
......@@ -1845,26 +1873,44 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable
// Calculate start of arguments as callframe header - sizeof(Register) * argcount (regT0)
mul32(Imm32(sizeof(Register)), regT0, regT0);
subPtr(regT0, regT1);
storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, args) + FIELD_OFFSET(ArgList, m_args)));
storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, args) + FIELD_OFFSET(ArgList, m_args)));
// ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
addPtr(Imm32(FIELD_OFFSET(NativeFunctionSignature, args)), stackPointerRegister, regT0);
storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, argPointer)));
addPtr(Imm32(FIELD_OFFSET(NativeCallFrameStructure, args)), stackPointerRegister, regT0);
storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, argPointer)));
// regT1 currently points to the first argument, regT1 - sizeof(Register) points to 'this'
loadPtr(Address(regT1, -(int)sizeof(Register)), regT1);
poke(regT1, 2);
storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, thisValue)));
storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, thisValue)));
#if COMPILER(MSVC)
// ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register)
addPtr(Imm32(FIELD_OFFSET(NativeCallFrameStructure, result)), stackPointerRegister, X86::ecx);
// Plant callee
emitGetFromCallFrameHeader(RegisterFile::Callee, regT2);
storePtr(regT2, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, callee)));
emitGetFromCallFrameHeader(RegisterFile::Callee, X86::eax);
storePtr(X86::eax, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, callee)));
// Plant callframe
storePtr(callFrameRegister, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, callFrame)));
move(callFrameRegister, X86::edx);
call(Address(X86::eax, FIELD_OFFSET(JSFunction, m_data)));
// JSValue is a non-POD type
loadPtr(Address(X86::eax), X86::eax);
#else
// Plant callee
emitGetFromCallFrameHeader(RegisterFile::Callee, X86::edx);
// Plant callframe
move(callFrameRegister, X86::ecx);
call(Address(X86::edx, FIELD_OFFSET(JSFunction, m_data)));
#endif
// We've put a few temporaries on the stack in addition to the actual arguments
// so pull them off now
addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister);
call(Address(regT2, FIELD_OFFSET(JSFunction, m_data)));
addPtr(Imm32(NativeCallFrameSize), stackPointerRegister);
#endif
// Check for an exception
......
......@@ -69,18 +69,18 @@ using namespace WTF;
static void cleanupGlobalData(JSGlobalData*);
static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer);
static JSValue functionPrint(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionDebug(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionGC(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionVersion(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionRun(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionLoad(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionReadline(ExecState*, JSObject*, JSValue, const ArgList&);
static NO_RETURN JSValue functionQuit(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionPrint(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionDebug(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionGC(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionVersion(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionRun(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionLoad(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionReadline(ExecState*, JSObject*, JSValue, const ArgList&);
static NO_RETURN JSValue JSC_HOST_CALL functionQuit(ExecState*, JSObject*, JSValue, const ArgList&);
#if ENABLE(SAMPLING_FLAGS)
static JSValue functionSetSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionClearSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
#endif
struct Script {
......@@ -197,7 +197,7 @@ GlobalObject::GlobalObject(const Vector<UString>& arguments)
putDirect(Identifier(globalExec(), "arguments"), array);
}
JSValue functionPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
for (unsigned i = 0; i < args.size(); ++i) {
if (i != 0)
......@@ -211,27 +211,27 @@ JSValue functionPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args)
return jsUndefined();
}
JSValue functionDebug(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionDebug(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
fprintf(stderr, "--> %s\n", args.at(0).toString(exec).UTF8String().c_str());
return jsUndefined();
}
JSValue functionGC(ExecState* exec, JSObject*, JSValue, const ArgList&)
JSValue JSC_HOST_CALL functionGC(ExecState* exec, JSObject*, JSValue, const ArgList&)
{
JSLock lock(false);
exec->heap()->collect();
return jsUndefined();
}
JSValue functionVersion(ExecState*, JSObject*, JSValue, const ArgList&)
JSValue JSC_HOST_CALL functionVersion(ExecState*, JSObject*, JSValue, const ArgList&)
{
// We need this function for compatibility with the Mozilla JS tests but for now
// we don't actually do any version-specific handling
return jsUndefined();
}
JSValue functionRun(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionRun(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
StopWatch stopWatch;
UString fileName = args.at(0).toString(exec);
......@@ -248,8 +248,10 @@ JSValue functionRun(ExecState* exec, JSObject*, JSValue, const ArgList& args)
return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
}
JSValue functionLoad(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionLoad(ExecState* exec, JSObject* o, JSValue v, const ArgList& args)
{
UNUSED_PARAM(o);
UNUSED_PARAM(v);
UString fileName = args.at(0).toString(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
......@@ -263,7 +265,7 @@ JSValue functionLoad(ExecState* exec, JSObject*, JSValue, const ArgList& args)
}
#if ENABLE(SAMPLING_FLAGS)
JSValue functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
for (unsigned i = 0; i < args.size(); ++i) {
unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
......@@ -273,7 +275,7 @@ JSValue functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgL
return jsNull();
}
JSValue functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
for (unsigned i = 0; i < args.size(); ++i) {
unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
......@@ -284,7 +286,7 @@ JSValue functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const Ar
}
#endif
JSValue functionReadline(ExecState* exec, JSObject*, JSValue, const ArgList&)
JSValue JSC_HOST_CALL functionReadline(ExecState* exec, JSObject*, JSValue, const ArgList&)
{
Vector<char, 256> line;
int c;
......@@ -298,7 +300,7 @@ JSValue functionReadline(ExecState* exec, JSObject*, JSValue, const ArgList&)
return jsString(exec, line.data());
}
JSValue functionQuit(ExecState* exec, JSObject*, JSValue, const ArgList&)
JSValue JSC_HOST_CALL functionQuit(ExecState* exec, JSObject*, JSValue, const ArgList&)
{
cleanupGlobalData(&exec->globalData());
exit(EXIT_SUCCESS);
......
......@@ -69,7 +69,7 @@ ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
static JSValue callArrayConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
return constructArrayWithSizeQuirk(exec, args);
}
......
This diff is collapsed.
......@@ -57,7 +57,7 @@ ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.6.1
static JSValue callBooleanConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
static JSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
return jsBoolean(args.at(0).toBoolean(exec));
}
......
......@@ -32,8 +32,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
// Functions
static JSValue booleanProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue booleanProtoFuncValueOf(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*, JSObject*, JSValue, const ArgList&);
// ECMA 15.6.4
......@@ -51,7 +51,7 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, PassRefPtr<Structure> struct
// ECMA 15.6.4.2 + 15.6.4.3
JSValue booleanProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
if (thisValue == jsBoolean(false))
return jsNontrivialString(exec, "false");
......@@ -69,7 +69,7 @@ JSValue booleanProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue,
return jsNontrivialString(exec, "true");
}
JSValue booleanProtoFuncValueOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
{
if (thisValue.isBoolean())
return thisValue;
......
......@@ -46,7 +46,7 @@ namespace JSC {
CallTypeJS
};
typedef JSValue (*NativeFunction)(ExecState*, JSObject*, JSValue thisValue, const ArgList&);
typedef JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*, JSObject*, JSValue thisValue, const ArgList&);
union CallData {
struct {
......
......@@ -48,9 +48,9 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
static JSValue dateParse(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue dateNow(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue dateUTC(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL dateParse(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL dateNow(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue JSC_HOST_CALL dateUTC(ExecState*, JSObject*, JSValue, const ArgList&);
DateConstructor::DateConstructor(ExecState* exec, PassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
: InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className))
......@@ -124,7 +124,7 @@ ConstructType DateConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.9.2
static JSValue callDate(ExecState* exec, JSObject*, JSValue, const ArgList&)
static JSValue JSC_HOST_CALL callDate(ExecState* exec, JSObject*, JSValue, const ArgList&)
{
time_t localTime = time(0);
tm localTM;
......@@ -139,17 +139,17 @@ CallType DateConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
static JSValue dateParse(ExecState* exec, JSObject*, JSValue, const ArgList& args)
static JSValue JSC_HOST_CALL dateParse(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
return jsNumber(exec, parseDate(args.at(0).toString(exec)));
}
static JSValue dateNow(ExecState* exec, JSObject*, JSValue, const ArgList&)
static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const ArgList&)
{
return jsNumber(exec, getCurrentUTCTime());
}
static JSValue dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args)
static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
int n = args.size();
if (isnan(args.at(0).toNumber(exec))
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.9.2
static JSValue callErrorConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)