Commit a5fc2106 authored by cwzwarich@webkit.org's avatar cwzwarich@webkit.org

2008-10-18 Cameron Zwarich <zwarich@apple.com>

        Reviewed by Oliver Hunt.

        Bug 21702: Special op_create_activation for the case where there are no named parameters
        <https://bugs.webkit.org/show_bug.cgi?id=21702>

        This is a 2.5% speedup on the V8 Raytrace benchmark and a 1.1% speedup
        on the V8 Earley-Boyer benchmark.

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/Machine.cpp:
        (JSC::Machine::cti_op_create_arguments_no_params):
        * VM/Machine.h:
        * kjs/Arguments.h:
        (JSC::Arguments::):
        (JSC::Arguments::Arguments):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 154f91e8
2008-10-18 Cameron Zwarich <zwarich@apple.com>
Reviewed by Oliver Hunt.
Bug 21702: Special op_create_activation for the case where there are no named parameters
<https://bugs.webkit.org/show_bug.cgi?id=21702>
This is a 2.5% speedup on the V8 Raytrace benchmark and a 1.1% speedup
on the V8 Earley-Boyer benchmark.
* VM/CTI.cpp:
(JSC::CTI::privateCompileMainPass):
* VM/Machine.cpp:
(JSC::Machine::cti_op_create_arguments_no_params):
* VM/Machine.h:
* kjs/Arguments.h:
(JSC::Arguments::):
(JSC::Arguments::Arguments):
2008-10-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by Cameron Zwarich.
......
......@@ -2084,7 +2084,7 @@ void CTI::privateCompileMainPass()
break;
}
case op_create_arguments: {
emitCTICall(i, Machine::cti_op_create_arguments);
emitCTICall(i, (m_codeBlock->numParameters == 1) ? Machine::cti_op_create_arguments_no_params : Machine::cti_op_create_arguments);
i += 1;
break;
}
......
......@@ -4775,6 +4775,13 @@ void Machine::cti_op_create_arguments(CTI_ARGS)
ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments;
}
void Machine::cti_op_create_arguments_no_params(CTI_ARGS)
{
Arguments* arguments = new (ARG_globalData) Arguments(ARG_callFrame, Arguments::ArgumentsNoParameters);
ARG_callFrame->setCalleeArguments(arguments);
ARG_callFrame[RegisterFile::ArgumentsRegister] = arguments;
}
void Machine::cti_op_tear_off_activation(CTI_ARGS)
{
CTI_STACK_HACK();
......
......@@ -186,6 +186,7 @@ namespace JSC {
static VoidPtrPair SFX_CALL cti_op_call_JSFunction(CTI_ARGS);
static JSValue* SFX_CALL cti_op_call_NotJSFunction(CTI_ARGS);
static void SFX_CALL cti_op_create_arguments(CTI_ARGS);
static void SFX_CALL cti_op_create_arguments_no_params(CTI_ARGS);
static void SFX_CALL cti_op_tear_off_activation(CTI_ARGS);
static void SFX_CALL cti_op_tear_off_arguments(CTI_ARGS);
static void SFX_CALL cti_op_ret_scopeChain(CTI_ARGS);
......
......@@ -53,7 +53,12 @@ namespace JSC {
class Arguments : public JSObject {
public:
enum ArgumentsParameters {
ArgumentsNoParameters
};
Arguments(CallFrame*);
Arguments(CallFrame*, enum ArgumentsParameters);
virtual ~Arguments();
static const ClassInfo info;
......@@ -140,6 +145,33 @@ namespace JSC {
d->overrodeCallee = false;
}
inline Arguments::Arguments(CallFrame* callFrame, enum ArgumentsParameters)
: JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
, d(new ArgumentsData)
{
unsigned numArguments = callFrame->argumentCount() - 1;
d->numParameters = 0;
d->numArguments = numArguments;
d->activation = 0;
Register* extraArguments;
if (numArguments > sizeof(d->extraArgumentsFixedBuffer) / sizeof(Register))
extraArguments = new Register[numArguments];
else
extraArguments = d->extraArgumentsFixedBuffer;
Register* argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numArguments - 1;
for (unsigned i = 0; i < numArguments; ++i)
extraArguments[i] = argv[i];
d->extraArguments = extraArguments;
d->callee = callFrame->callee();
d->overrodeLength = false;
d->overrodeCallee = false;
}
inline void Arguments::copyRegisters()
{
ASSERT(!isTornOff());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment