Ignore:
Timestamp:
Dec 18, 2009, 2:18:11 PM (15 years ago)
Author:
[email protected]
Message:

Changed Register constructors to assignment operators, to streamline
moving values into registers. (In theory, there's no difference between
the two, since the constructor should just inline away, but there seems
to be a big difference in the addled mind of the GCC optimizer.)

Reviewed by Cameron Zwarich and Gavin Barraclough.

In the interpreter, this is a 3.5% SunSpider speedup and a 1K-2K
reduction in stack usage per privateExecute stack frame.

  • interpreter/CallFrame.h:

(JSC::ExecState::setCalleeArguments):
(JSC::ExecState::setCallerFrame):
(JSC::ExecState::setScopeChain):
(JSC::ExecState::init):
(JSC::ExecState::setArgumentCount):
(JSC::ExecState::setCallee):
(JSC::ExecState::setCodeBlock): Added a little bit of casting so these
functions could use the new Register assignment operators.

  • interpreter/Register.h:

(JSC::Register::withInt):
(JSC::Register::Register):
(JSC::Register::operator=): Swapped in assignment operators for constructors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/CallFrame.h

    r51672 r52343  
    111111        Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
    112112
    113         void setCalleeArguments(JSValue arguments) { this[RegisterFile::OptionalCalleeArguments] = arguments; }
    114         void setCallerFrame(CallFrame* callerFrame) { this[RegisterFile::CallerFrame] = callerFrame; }
    115         void setScopeChain(ScopeChainNode* scopeChain) { this[RegisterFile::ScopeChain] = scopeChain; }
     113        void setCalleeArguments(JSValue arguments) { static_cast<Register*>(this)[RegisterFile::OptionalCalleeArguments] = arguments; }
     114        void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[RegisterFile::CallerFrame] = callerFrame; }
     115        void setScopeChain(ScopeChainNode* scopeChain) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scopeChain; }
    116116
    117117        ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
     
    123123            setScopeChain(scopeChain);
    124124            setCallerFrame(callerFrame);
    125             this[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
    126             this[RegisterFile::ReturnValueRegister] = Register::withInt(returnValueRegister);
     125            static_cast<Register*>(this)[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
     126            static_cast<Register*>(this)[RegisterFile::ReturnValueRegister] = Register::withInt(returnValueRegister);
    127127            setArgumentCount(argc); // original argument count (for the sake of the "arguments" object)
    128128            setCallee(function);
     
    141141
    142142    private:
    143         void setArgumentCount(int count) { this[RegisterFile::ArgumentCount] = Register::withInt(count); }
    144         void setCallee(JSFunction* callee) { this[RegisterFile::Callee] = callee; }
    145         void setCodeBlock(CodeBlock* codeBlock) { this[RegisterFile::CodeBlock] = codeBlock; }
     143        void setArgumentCount(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }
     144        void setCallee(JSFunction* callee) { static_cast<Register*>(this)[RegisterFile::Callee] = callee; }
     145        void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[RegisterFile::CodeBlock] = codeBlock; }
    146146
    147147        static const intptr_t HostCallFrameFlag = 1;
Note: See TracChangeset for help on using the changeset viewer.