Ignore:
Timestamp:
Mar 20, 2008, 2:34:47 AM (17 years ago)
Author:
[email protected]
Message:

2008-03-20 Maciej Stachowiak <[email protected]>

Reviewed by Oliver.


  • reduce function call overhead for 1.014x speedup on SunSpider

I moved some functions from ExecState.cpp to ExecStateInline.h and
from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
inline; machine function call overhead for these was hurting JS
funcion call overhead.


  • kjs/ExecState.cpp:
  • kjs/ExecStateInlines.h: Added. (KJS::ExecState::ExecState): (KJS::ExecState::~ExecState): (KJS::FunctionExecState::FunctionExecState): (KJS::FunctionExecState::~FunctionExecState):
  • kjs/JSGlobalObject.cpp:
  • kjs/JSGlobalObject.h: (KJS::JSGlobalObject::pushActivation): (KJS::JSGlobalObject::checkActivationCount): (KJS::JSGlobalObject::popActivation):
  • kjs/function.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ExecState.cpp

    r31172 r31173  
    3030#include "internal.h"
    3131#include "scope_chain_mark.h"
     32#include "ExecStateInlines.h"
    3233
    3334namespace KJS {
     
    110111}
    111112
    112 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject,
    113          FunctionBodyNode* functionBodyNode, ExecState* callingExec,
    114          FunctionImp* func, const List& args)
    115     : m_globalObject(globalObject)
    116     , m_exception(0)
    117     , m_propertyNames(callingExec->m_propertyNames)
    118     , m_emptyList(callingExec->m_emptyList)
    119     , m_callingExec(callingExec)
    120     , m_scopeNode(functionBodyNode)
    121     , m_function(func)
    122     , m_arguments(&args)
    123     , m_scopeChain(func->scope())
    124     , m_inlineScopeChainNode(0, 0)
    125     , m_thisValue(thisObject)
    126     , m_iterationDepth(0)
    127     , m_switchDepth(0)
    128     , m_codeType(FunctionCode)
    129 {
    130     ASSERT(m_scopeNode);
    131 
    132     ActivationImp* activation = globalObject->pushActivation(this);
    133     m_activation = activation;
    134     m_localStorage = &activation->localStorage();
    135     m_variableObject = activation;
    136     if (functionBodyNode->usesEval() || functionBodyNode->needsClosure())
    137         m_scopeChain.push(activation);
    138     else {
    139         m_inlineScopeChainNode.object = activation;
    140         // The ScopeChain will ref this node itself, so we don't need to worry about
    141         // anything trying to delete our scopenode
    142         m_scopeChain.push(&m_inlineScopeChainNode);
    143     }
    144 }
    145 
    146 inline ExecState::~ExecState()
    147 {
    148 }
    149 
    150113JSGlobalObject* ExecState::lexicalGlobalObject() const
    151114{
     
    188151    m_globalObject->activeExecStates().removeLast();
    189152}
    190 
    191 FunctionExecState::FunctionExecState(JSGlobalObject* globalObject, JSObject* thisObject,
    192          FunctionBodyNode* functionBodyNode, ExecState* callingExec,
    193          FunctionImp* func, const List& args)
    194     : ExecState(globalObject, thisObject, functionBodyNode, callingExec, func, args)
    195 {
    196     m_globalObject->activeExecStates().append(this);
    197 }
    198 
    199 FunctionExecState::~FunctionExecState()
    200 {
    201     ASSERT(m_globalObject->activeExecStates().last() == this);
    202     m_globalObject->activeExecStates().removeLast();
    203 
    204     if (m_activation->needsPop())
    205         m_globalObject->popActivation();
    206 }
    207 
     153   
    208154} // namespace KJS
Note: See TracChangeset for help on using the changeset viewer.