Changeset 33301

Show
Ignore:
Timestamp:
05/12/08 23:02:17 (6 months ago)
Author:
mrowe@apple.com
Message:

2008-04-28 Geoffrey Garen <ggaren@apple.com>

Reviewed by Maciej Stachowiak.

Simplified activation object a bit: No need to store the callee
in the activation object -- we can pull it out of the call frame
when needed, instead.

SunSpider reports no change.

Location:
branches/squirrelfish/JavaScriptCore
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/squirrelfish/JavaScriptCore/ChangeLog

    r33300 r33301  
     12008-04-28  Geoffrey Garen  <ggaren@apple.com> 
     2 
     3        Reviewed by Maciej Stachowiak. 
     4         
     5        Simplified activation object a bit: No need to store the callee 
     6        in the activation object -- we can pull it out of the call frame 
     7        when needed, instead. 
     8         
     9        SunSpider reports no change. 
     10 
    1112008-04-28  Geoffrey Garen  <ggaren@apple.com> 
    212 
  • branches/squirrelfish/JavaScriptCore/VM/Machine.cpp

    r33299 r33301  
    427427} 
    428428 
    429 ALWAYS_INLINE ScopeChainNode* scopeChainForCall(CodeBlock* newCodeBlock, ScopeChainNode* callDataScopeChain, FunctionImp* function, Register* callFrame, Register** registerBase, Register* r) 
     429ALWAYS_INLINE ScopeChainNode* scopeChainForCall(FunctionBodyNode* functionBodyNode, CodeBlock* newCodeBlock, ScopeChainNode* callDataScopeChain, Register* callFrame, Register** registerBase, Register* r) 
    430430{ 
    431431    if (newCodeBlock->needsFullScopeChain) { 
    432         JSActivation* activation = new JSActivation(function, registerBase, r - (*registerBase)); 
     432        JSActivation* activation = new JSActivation(functionBodyNode, registerBase, r - (*registerBase)); 
    433433        callFrame[Machine::OptionalCalleeActivation].u.jsValue = activation; 
    434434 
     
    617617 
    618618    callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 
    619     scopeChain = scopeChainForCall(newCodeBlock, scopeChain, function, callFrame, registerBase, r);             
     619    scopeChain = scopeChainForCall(functionBodyNode, newCodeBlock, scopeChain, callFrame, registerBase, r);             
    620620    m_reentryDepth++; 
    621621    JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, newCodeBlock, exception); 
     
    14701470            codeBlock = newCodeBlock; 
    14711471            callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 
    1472             scopeChain = scopeChainForCall(codeBlock, callDataScopeChain, static_cast<FunctionImp*>(v), callFrame, registerBase, r);             
     1472            scopeChain = scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r);             
    14731473            k = codeBlock->jsValues.data(); 
    14741474            vPC = codeBlock->instructions.begin(); 
     
    15761576            codeBlock = newCodeBlock; 
    15771577            callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 
    1578             scopeChain = scopeChainForCall(codeBlock, callDataScopeChain, static_cast<FunctionImp*>(constructor), callFrame, registerBase, r);             
     1578            scopeChain = scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r);             
    15791579            k = codeBlock->jsValues.data(); 
    15801580            vPC = codeBlock->instructions.begin(); 
  • branches/squirrelfish/JavaScriptCore/kjs/JSActivation.cpp

    r33300 r33301  
    3838const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 }; 
    3939 
    40 JSActivation::JSActivation(FunctionImp* function, Register** registerBase, int registerOffset) 
    41     : Base(new JSActivationData(function->body, function, registerBase, registerOffset)) 
     40JSActivation::JSActivation(PassRefPtr<FunctionBodyNode> functionBody, Register** registerBase, int registerOffset) 
     41    : Base(new JSActivationData(functionBody, registerBase, registerOffset)) 
    4242{ 
    4343} 
     
    133133    Base::mark(); 
    134134     
    135     // We don't mark d()->function because it can only be accessed while it's 
    136     // still live in the register file, and we don't want to keep it live 
    137     // after that. 
    138      
    139135    if (d()->argumentsObject) 
    140136        d()->argumentsObject->mark(); 
     
    182178JSObject* JSActivation::createArgumentsObject(ExecState* exec) 
    183179{ 
    184     CodeBlock& codeBlock = d()->function->body->generatedCode(); 
     180    CodeBlock& codeBlock = d()->functionBody->generatedCode(); 
    185181    Register* callFrame = registers() - codeBlock.numVars - codeBlock.numParameters - Machine::CallFrameHeaderSize; 
     182 
     183    FunctionImp* function = static_cast<FunctionImp*>(callFrame[Machine::Callee].u.jsValue); 
    186184    int argv = callFrame[Machine::ArgumentStartRegister].u.i; 
    187185    int argc = callFrame[Machine::ArgumentCount].u.i; 
     186 
    188187    List args(&(*registerBase() + argv + 1)->u.jsValue, argc - 1); 
    189  
    190     return new Arguments(exec, d()->function, args, this); 
     188    return new Arguments(exec, function, args, this); 
    191189} 
    192190 
  • branches/squirrelfish/JavaScriptCore/kjs/JSActivation.h

    r33285 r33301  
    4141    typedef JSVariableObject Base; 
    4242    public: 
    43         JSActivation(FunctionImp*, Register**, int registerOffset); 
     43        JSActivation(PassRefPtr<FunctionBodyNode>, Register**, int registerOffset); 
    4444        virtual ~JSActivation(); 
    4545         
     
    6464    private: 
    6565        struct JSActivationData : public JSVariableObjectData { 
    66             JSActivationData(PassRefPtr<FunctionBodyNode> functionBody_, FunctionImp* function_, Register** registerBase, int registerOffset) 
     66            JSActivationData(PassRefPtr<FunctionBodyNode> functionBody_, Register** registerBase, int registerOffset) 
    6767                : JSVariableObjectData(&functionBody_->symbolTable(), registerBase, registerOffset) 
    6868                , registerArray(0) 
    6969                , functionBody(functionBody_) 
    70                 , function(function_) 
    7170                , argumentsObject(0) 
    7271            { 
     
    7473 
    7574            Register* registerArray; 
    76             RefPtr<FunctionBodyNode> functionBody; // Owns the symbol table 
    77             FunctionImp* function; 
     75            RefPtr<FunctionBodyNode> functionBody; // Owns the symbol table and code block 
    7876            JSObject* argumentsObject; 
    7977        };