Ignore:
Timestamp:
Jul 19, 2010, 10:19:16 AM (15 years ago)
Author:
Darin Adler
Message:

2010-07-16 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

Use OwnPtr for CodeBlock objects
https://bugs.webkit.org/show_bug.cgi?id=42490

  • runtime/Executable.cpp: (JSC::EvalExecutable::EvalExecutable): Moved this here and made it non-inline. Eliminated the code that used to initialize the raw pointer since it's now an OwnPtr. (JSC::EvalExecutable::~EvalExecutable): Removed the explicit delete here. (JSC::ProgramExecutable::ProgramExecutable): Ditto. (JSC::ProgramExecutable::~ProgramExecutable): Ditto. (JSC::FunctionExecutable::FunctionExecutable): Ditto. (JSC::FunctionExecutable::~FunctionExecutable): Ditto. (JSC::EvalExecutable::compileInternal): Added use of adoptPtr and get. (JSC::ProgramExecutable::compileInternal): Ditto. (JSC::FunctionExecutable::compileForCallInternal): Ditto. (JSC::FunctionExecutable::compileForConstructInternal): Ditto. (JSC::FunctionExecutable::recompile): Use clear instead of delete followed by assignment of 0.
  • runtime/Executable.h: Moved constructors to the cpp file and changed raw pointers to OwnPtr.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Executable.h

    r63404 r63675  
    221221
    222222    private:
    223         EvalExecutable(ExecState* exec, const SourceCode& source)
    224             : ScriptExecutable(exec, source)
    225             , m_evalCodeBlock(0)
    226         {
    227         }
     223        EvalExecutable(ExecState*, const SourceCode&);
    228224
    229225        JSObject* compileInternal(ExecState*, ScopeChainNode*);
     
    231227        virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
    232228
    233         EvalCodeBlock* m_evalCodeBlock;
     229        OwnPtr<EvalCodeBlock> m_evalCodeBlock;
    234230    };
    235231
     
    268264
    269265    private:
    270         ProgramExecutable(ExecState* exec, const SourceCode& source)
    271             : ScriptExecutable(exec, source)
    272             , m_programCodeBlock(0)
    273         {
    274         }
     266        ProgramExecutable(ExecState*, const SourceCode&);
    275267
    276268        JSObject* compileInternal(ExecState*, ScopeChainNode*);
     
    278270        virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
    279271
    280         ProgramCodeBlock* m_programCodeBlock;
     272        OwnPtr<ProgramCodeBlock> m_programCodeBlock;
    281273    };
    282274
     
    359351
    360352        void recompile(ExecState*);
    361         void markAggregate(MarkStack& markStack);
     353        void markAggregate(MarkStack&);
    362354        static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
    363355
    364356    private:
    365         FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
    366             : ScriptExecutable(globalData, source)
    367             , m_numVariables(0)
    368             , m_forceUsesArguments(forceUsesArguments)
    369             , m_parameters(parameters)
    370             , m_codeBlockForCall(0)
    371             , m_codeBlockForConstruct(0)
    372             , m_name(name)
    373             , m_symbolTable(0)
    374         {
    375             m_firstLine = firstLine;
    376             m_lastLine = lastLine;
    377         }
    378 
    379         FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
    380             : ScriptExecutable(exec, source)
    381             , m_numVariables(0)
    382             , m_forceUsesArguments(forceUsesArguments)
    383             , m_parameters(parameters)
    384             , m_codeBlockForCall(0)
    385             , m_codeBlockForConstruct(0)
    386             , m_name(name)
    387             , m_symbolTable(0)
    388         {
    389             m_firstLine = firstLine;
    390             m_lastLine = lastLine;
    391         }
     357        FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine);
     358        FunctionExecutable(ExecState*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine);
    392359
    393360        JSObject* compileForCallInternal(ExecState*, ScopeChainNode*);
     
    400367
    401368        RefPtr<FunctionParameters> m_parameters;
    402         FunctionCodeBlock* m_codeBlockForCall;
    403         FunctionCodeBlock* m_codeBlockForConstruct;
     369        OwnPtr<FunctionCodeBlock> m_codeBlockForCall;
     370        OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct;
    404371        Identifier m_name;
    405372        SharedSymbolTable* m_symbolTable;
Note: See TracChangeset for help on using the changeset viewer.