Changeset 42538 in webkit


Ignore:
Timestamp:
Apr 15, 2009, 12:31:48 AM (16 years ago)
Author:
oliver@apple.com
Message:

Move CallFrameClosure from inside the Interpreter class to its own file.

Reviewed by NOBODY(Build fix)

Location:
trunk/JavaScriptCore
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r42537 r42538  
     12009-04-15  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by NOBODY (Build fix).
     4
     5        Move CallFrameClosure from inside the Interpreter class to its own file.
     6
     7        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
     8        * JavaScriptCore.xcodeproj/project.pbxproj:
     9        * interpreter/CachedCall.h:
     10        * interpreter/CallFrameClosure.h: Copied from JavaScriptCore/yarr/RegexJIT.h.
     11        (JSC::CallFrameClosure::setArgument):
     12        (JSC::CallFrameClosure::resetCallFrame):
     13        * interpreter/Interpreter.cpp:
     14        (JSC::Interpreter::prepareForRepeatCall):
     15        * interpreter/Interpreter.h:
     16
    1172009-04-14  Oliver Hunt  <oliver@apple.com>
    218
  • trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj

    r42537 r42538  
    281281                        <File
    282282                                RelativePath="..\..\interpreter\CallFrame.h"
     283                                >
     284                        </File>
     285                        <File
     286                                RelativePath="..\..\interpreter\CallFrameClosure.h"
    283287                                >
    284288                        </File>
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r42537 r42538  
    706706                A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStaticScopeObject.cpp; sourceTree = "<group>"; };
    707707                A7F8690E0F9584A100558697 /* CachedCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedCall.h; sourceTree = "<group>"; };
     708                A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameClosure.h; sourceTree = "<group>"; };
    708709                A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
    709710                A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
     
    992993                                1429D8DB0ED2205B00B89619 /* CallFrame.cpp */,
    993994                                1429D8DC0ED2205B00B89619 /* CallFrame.h */,
     995                                A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */,
    994996                                1429D7D30ED2128200B89619 /* Interpreter.cpp */,
    995997                                1429D77B0ED20D7300B89619 /* Interpreter.h */,
  • trunk/JavaScriptCore/interpreter/CachedCall.h

    r42537 r42538  
    2727#define CachedCall_h
    2828
     29#include "CallFrameClosure.h"
    2930#include "Interpreter.h"
    3031
     
    6061        JSValuePtr* m_exception;
    6162        DynamicGlobalObjectScope m_globalObjectScope;
    62         Interpreter::CallFrameClosure m_closure;
     63        CallFrameClosure m_closure;
    6364    };
    6465}
  • trunk/JavaScriptCore/interpreter/CallFrameClosure.h

    r42537 r42538  
    2424 */
    2525
    26 #ifndef CachedCall_h
    27 #define CachedCall_h
    28 
    29 #include "Interpreter.h"
     26#ifndef CallFrameClosure_h
     27#define CallFrameClosure_h
    3028
    3129namespace JSC {
    32     class CachedCall : Noncopyable {
    33     public:
    34         CachedCall(CallFrame* callFrame, JSFunction* function, int argCount, JSValuePtr* exception)
    35             : m_valid(false)
    36             , m_interpreter(callFrame->interpreter())
    37             , m_exception(exception)
    38             , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().node()->globalObject())
    39         {
    40             m_closure = m_interpreter->prepareForRepeatCall(function->body(), callFrame, function, argCount, function->scope().node(), exception);
    41             m_valid = !exception;
    42         }
    43        
    44         JSValuePtr call()
    45         {
    46             return m_interpreter->execute(m_closure, m_exception);
    47         }
    48         void setThis(JSValuePtr v) { m_closure.setArgument(0, v); }
    49         void setArgument(int n, JSValuePtr v) { m_closure.setArgument(n + 1, v); }
    50        
    51         ~CachedCall()
    52         {
    53             if (m_valid)
    54                 m_interpreter->endRepeatCall(m_closure);
    55         }
    56        
    57     private:
    58         bool m_valid;
    59         Interpreter* m_interpreter;
    60         JSValuePtr* m_exception;
    61         DynamicGlobalObjectScope m_globalObjectScope;
    62         Interpreter::CallFrameClosure m_closure;
    63     };
     30
     31struct CallFrameClosure {
     32    CallFrame* oldCallFrame;
     33    CallFrame* newCallFrame;
     34    JSFunction* function;
     35    CodeBlock* codeBlock;
     36    JSGlobalData* globalData;
     37    Register* oldEnd;
     38    ScopeChainNode* scopeChain;
     39    int expectedParams;
     40    int providedParams;
     41   
     42    void setArgument(int arg, JSValuePtr value)
     43    {
     44        if (arg < expectedParams)
     45            newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams] = value;
     46        else
     47            newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams] = value;
     48    }
     49    void resetCallFrame()
     50    {
     51        newCallFrame->setScopeChain(scopeChain);
     52        newCallFrame->setCalleeArguments(0);
     53        for (int i = providedParams; i < expectedParams; ++i)
     54            newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
     55    }
     56};
     57
    6458}
    6559
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r42537 r42538  
    3333#include "Arguments.h"
    3434#include "BatchedTransitionOptimizer.h"
     35#include "CallFrameClosure.h"
    3536#include "CodeBlock.h"
    3637#include "DebuggerCallFrame.h"
     
    701702}
    702703
    703 Interpreter::CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValuePtr* exception)
     704CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValuePtr* exception)
    704705{
    705706    ASSERT(!scopeChain->globalData->exception);
  • trunk/JavaScriptCore/interpreter/Interpreter.h

    r42537 r42538  
    5252    class ScopeChainNode;
    5353    class SamplingTool;
     54    struct CallFrameClosure;
    5455    struct HandlerInfo;
    5556
     
    110111    private:
    111112        enum ExecutionFlag { Normal, InitializeAndReturn };
    112        
    113         struct CallFrameClosure {
    114             CallFrame* oldCallFrame;
    115             CallFrame* newCallFrame;
    116             JSFunction* function;
    117             CodeBlock* codeBlock;
    118             JSGlobalData* globalData;
    119             Register* oldEnd;
    120             ScopeChainNode* scopeChain;
    121             int expectedParams;
    122             int providedParams;
    123113
    124             void setArgument(int arg, JSValuePtr value)
    125             {
    126                 if (arg < expectedParams)
    127                     newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams] = value;
    128                 else
    129                     newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams] = value;
    130             }
    131             void resetCallFrame()
    132             {
    133                 newCallFrame->setScopeChain(scopeChain);
    134                 newCallFrame->setCalleeArguments(0);
    135                 for (int i = providedParams; i < expectedParams; ++i)
    136                     newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
    137             }
    138         };
    139114        CallFrameClosure prepareForRepeatCall(FunctionBodyNode*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValuePtr* exception);
    140115        void endRepeatCall(CallFrameClosure&);
Note: See TracChangeset for help on using the changeset viewer.