Ignore:
Timestamp:
Jun 4, 2008, 10:36:55 PM (17 years ago)
Author:
[email protected]
Message:

2008-06-04 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak.

Big cleanup of formatting and whitespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.h

    r34319 r34372  
    3838#include "Machine.h"
    3939#include "RegisterID.h"
     40#include "SegmentedVector.h"
    4041#include "SymbolTable.h"
    41 #include "SegmentedVector.h"
    4242#include "debugger.h"
    4343#include "nodes.h"
     
    6464        RegisterID* retAddrDst;
    6565    };
    66    
     66
    6767    struct ControlFlowContext {
    6868        bool isFinallyBlock;
    6969        FinallyContext finallyContext;
    7070    };
    71    
     71
    7272    class CodeGenerator {
    7373    public:
    7474        typedef DeclarationStacks::VarStack VarStack;
    7575        typedef DeclarationStacks::FunctionStack FunctionStack;
    76        
     76
    7777        static void setDumpsGeneratedCode(bool dumpsGeneratedCode);
    78        
     78
    7979        CodeGenerator(ProgramNode*, const Debugger*, const ScopeChain&, SymbolTable*, CodeBlock*, VarStack&, FunctionStack&, bool canCreateGlobals);
    8080        CodeGenerator(FunctionBodyNode*, const Debugger*, const ScopeChain&, SymbolTable*, CodeBlock*);
     
    9696
    9797        // Searches the scope chain in an attempt to  statically locate the requested
    98         // property.  Returns false if for any reason the property cannot be safely 
     98        // property.  Returns false if for any reason the property cannot be safely
    9999        // optimised at all.  Otherwise it will return the index and depth of the
    100         // VariableObject that defines the property.  If the property cannot be found 
     100        // VariableObject that defines the property.  If the property cannot be found
    101101        // statically, depth will contain the depth of the scope chain where dynamic
    102102        // lookup must begin.
     
    133133
    134134        // Returns the place to write the final output of an operation.
    135         RegisterID* finalDestination(RegisterID* originalDst, RegisterID* tempDst = 0) 
    136         { 
     135        RegisterID* finalDestination(RegisterID* originalDst, RegisterID* tempDst = 0)
     136        {
    137137            if (originalDst)
    138138                return originalDst;
    139139            if (tempDst && tempDst->isTemporary())
    140140                return tempDst;
    141             return newTemporary();
    142         }
    143        
    144         RegisterID* destinationForAssignResult(RegisterID* dst) {
    145             if (dst && m_codeBlock->needsFullScopeChain)
     141            return newTemporary();
     142        }
     143
     144        RegisterID* destinationForAssignResult(RegisterID* dst)
     145        {
     146            if (dst && m_codeBlock->needsFullScopeChain)
    146147                return dst->isTemporary() ? dst : newTemporary();
    147148            return 0;
     
    151152        RegisterID* moveToDestinationIfNeeded(RegisterID* dst, RegisterID* src) { return (dst && dst != src) ? emitMove(dst, src) : src; }
    152153
    153 
    154154        PassRefPtr<LabelID> newLabel();
    155        
     155
    156156        // The emitNode functions are just syntactic sugar for calling
    157157        // Node::emitCode. They're the only functions that accept a NULL register.
    158         RegisterID* emitNode(RegisterID* dst, Node* n) {
     158        RegisterID* emitNode(RegisterID* dst, Node* n)
     159        {
    159160            // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
    160161            ASSERT(!dst || !dst->isTemporary() || dst->refCount());
     
    183184                return dst;
    184185            }
    185            
     186
    186187            return PassRefPtr<RegisterID>(emitNode(n));
    187188        }
     
    190191        RegisterID* emitLoad(RegisterID* dst, double);
    191192        RegisterID* emitLoad(RegisterID* dst, JSValue*);
    192        
     193
    193194        RegisterID* emitNewObject(RegisterID* dst);
    194195        RegisterID* emitNewArray(RegisterID* dst);
     
    266267        PassRefPtr<LabelID> emitJumpSubroutine(RegisterID* retAddrDst, LabelID*);
    267268        void emitSubroutineReturn(RegisterID* retAddrSrc);
    268        
     269
    269270        RegisterID* emitGetPropertyNames(RegisterID* dst, RegisterID* base);
    270271        RegisterID* emitNextPropertyName(RegisterID* dst, RegisterID* iter, LabelID* target);
     
    273274        void emitThrow(RegisterID*);
    274275        RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue* message);
    275        
     276
    276277        RegisterID* emitPushScope(RegisterID* scope);
    277278        void emitPopScope();
    278        
     279
    279280        void emitDebugHook(DebugHookID, int firstLine, int lastLine);
    280281
    281282        int scopeDepth() { return m_dynamicScopeDepth + m_finallyDepth; }
    282        
     283
    283284        void pushFinallyContext(LabelID* target, RegisterID* returnAddrDst);
    284285        void popFinallyContext();
     
    290291        JumpContext* jumpContextForBreak(const Identifier&);
    291292
    292 
    293293        CodeType codeType() const { return m_codeType; }
     294
    294295    private:
    295296        PassRefPtr<LabelID> emitComplexJumpScopes(LabelID* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
     
    300301
    301302        typedef HashMap<JSValue*, unsigned, DefaultHash<JSValue*>::Hash, JSValueHashTraits> JSValueMap;
    302        
     303
    303304        struct IdentifierMapIndexHashTraits {
    304305            typedef int TraitType;
     
    316317        // Maps a register index in the symbol table to a RegisterID index in m_locals.
    317318        int localsIndex(int registerIndex) { return -registerIndex - 1; }
    318        
     319
    319320        // Returns the RegisterID corresponding to ident.
    320321        RegisterID* addVar(const Identifier& ident, bool isConstant)
     
    335336        unsigned addConstant(JSValue*);
    336337        unsigned addRegExp(RegExp* r);
    337        
     338
    338339        Vector<Instruction>& instructions() { return m_codeBlock->instructions; }
    339340        SymbolTable& symbolTable() { return *m_symbolTable; }
    340341        Vector<HandlerInfo>& exceptionHandlers() { return m_codeBlock->exceptionHandlers; }
    341        
     342
    342343        bool shouldOptimizeLocals() { return (m_codeType != EvalCode) && !m_dynamicScopeDepth; }
    343344        bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval; }
    344345
    345346        bool m_shouldEmitDebugHooks;
    346        
     347
    347348        const ScopeChain* m_scopeChain;
    348349        SymbolTable* m_symbolTable;
    349        
     350
    350351        ScopeNode* m_scopeNode;
    351352        CodeBlock* m_codeBlock;
    352        
     353
    353354        HashSet<RefPtr<UString::Rep>, IdentifierRepHash> m_functions;
    354355        RegisterID m_thisRegister;
     
    359360        int m_dynamicScopeDepth;
    360361        CodeType m_codeType;
    361        
     362
    362363        Vector<JumpContext> m_jumpContextStack;
    363364        int m_continueDepth;
     
    373374        CommonIdentifiers* m_propertyNames;
    374375
    375 #ifndef NDEBUG       
     376#ifndef NDEBUG
    376377        static bool s_dumpsGeneratedCode;
    377378#endif
Note: See TracChangeset for help on using the changeset viewer.