[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

darin at apple.com darin at apple.com
Wed Dec 22 11:19:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 57bf9ee4a6d10828917e36b1e09ce5467b30bb6a
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 19 17:19:16 2010 +0000

    2010-07-16  Darin Adler  <darin at apple.com>
    
            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.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63675 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 610d9a3..a65a56b 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-07-16  Darin Adler  <darin at apple.com>
+
+        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.
+
 2010-07-19  Lucas De Marchi  <lucas.demarchi at profusion.mobi>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
index 4c2e6bb..229588b 100644
--- a/JavaScriptCore/runtime/Executable.cpp
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -45,20 +45,50 @@ VPtrHackExecutable::~VPtrHackExecutable()
 {
 }
 
+EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source)
+    : ScriptExecutable(exec, source)
+{
+}
+
 EvalExecutable::~EvalExecutable()
 {
-    delete m_evalCodeBlock;
+}
+
+ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
+    : ScriptExecutable(exec, source)
+{
 }
 
 ProgramExecutable::~ProgramExecutable()
 {
-    delete m_programCodeBlock;
+}
+
+FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+    : ScriptExecutable(globalData, source)
+    , m_numVariables(0)
+    , m_forceUsesArguments(forceUsesArguments)
+    , m_parameters(parameters)
+    , m_name(name)
+    , m_symbolTable(0)
+{
+    m_firstLine = firstLine;
+    m_lastLine = lastLine;
+}
+
+FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
+    : ScriptExecutable(exec, source)
+    , m_numVariables(0)
+    , m_forceUsesArguments(forceUsesArguments)
+    , m_parameters(parameters)
+    , m_name(name)
+    , m_symbolTable(0)
+{
+    m_firstLine = firstLine;
+    m_lastLine = lastLine;
 }
 
 FunctionExecutable::~FunctionExecutable()
 {
-    delete m_codeBlockForCall;
-    delete m_codeBlockForConstruct;
 }
 
 JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
@@ -77,15 +107,15 @@ JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scope
     JSGlobalObject* globalObject = scopeChain.globalObject();
 
     ASSERT(!m_evalCodeBlock);
-    m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth());
-    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock)));
+    m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
+    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
     generator->generate();
     
     evalNode->destroyData();
 
 #if ENABLE(JIT)
     if (exec->globalData().canUseJIT()) {
-        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_evalCodeBlock);
+        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_evalCodeBlock.get());
 #if !ENABLE(OPCODE_SAMPLING)
         if (!BytecodeGenerator::dumpsGeneratedCode())
             m_evalCodeBlock->discardBytecode();
@@ -125,15 +155,15 @@ JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* sc
     ScopeChain scopeChain(scopeChainNode);
     JSGlobalObject* globalObject = scopeChain.globalObject();
     
-    m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider());
-    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock)));
+    m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
+    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get())));
     generator->generate();
 
     programNode->destroyData();
 
 #if ENABLE(JIT)
     if (exec->globalData().canUseJIT()) {
-        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock);
+        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock.get());
 #if !ENABLE(OPCODE_SAMPLING)
         if (!BytecodeGenerator::dumpsGeneratedCode())
             m_programCodeBlock->discardBytecode();
@@ -162,8 +192,8 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChain
     JSGlobalObject* globalObject = scopeChain.globalObject();
 
     ASSERT(!m_codeBlockForCall);
-    m_codeBlockForCall = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false);
-    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall)));
+    m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false));
+    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
     generator->generate();
     m_numParametersForCall = m_codeBlockForCall->m_numParameters;
     ASSERT(m_numParametersForCall);
@@ -174,7 +204,7 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChain
 
 #if ENABLE(JIT)
     if (exec->globalData().canUseJIT()) {
-        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall, &m_jitCodeForCallWithArityCheck);
+        m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall.get(), &m_jitCodeForCallWithArityCheck);
 #if !ENABLE(OPCODE_SAMPLING)
         if (!BytecodeGenerator::dumpsGeneratedCode())
             m_codeBlockForCall->discardBytecode();
@@ -203,8 +233,8 @@ JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, Scope
     JSGlobalObject* globalObject = scopeChain.globalObject();
 
     ASSERT(!m_codeBlockForConstruct);
-    m_codeBlockForConstruct = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true);
-    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct)));
+    m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true));
+    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
     generator->generate();
     m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters;
     ASSERT(m_numParametersForConstruct);
@@ -215,7 +245,7 @@ JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, Scope
 
 #if ENABLE(JIT)
     if (exec->globalData().canUseJIT()) {
-        m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, m_codeBlockForConstruct, &m_jitCodeForConstructWithArityCheck);
+        m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, m_codeBlockForConstruct.get(), &m_jitCodeForConstructWithArityCheck);
 #if !ENABLE(OPCODE_SAMPLING)
         if (!BytecodeGenerator::dumpsGeneratedCode())
             m_codeBlockForConstruct->discardBytecode();
@@ -298,10 +328,8 @@ PassOwnPtr<ExceptionInfo> EvalExecutable::reparseExceptionInfo(JSGlobalData* glo
 
 void FunctionExecutable::recompile(ExecState*)
 {
-    delete m_codeBlockForCall;
-    m_codeBlockForCall = 0;
-    delete m_codeBlockForConstruct;
-    m_codeBlockForConstruct = 0;
+    m_codeBlockForCall.clear();
+    m_codeBlockForConstruct.clear();
     m_numParametersForCall = NUM_PARAMETERS_NOT_COMPILED;
     m_numParametersForConstruct = NUM_PARAMETERS_NOT_COMPILED;
 #if ENABLE(JIT)
diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h
index 912f501..10dfb34 100644
--- a/JavaScriptCore/runtime/Executable.h
+++ b/JavaScriptCore/runtime/Executable.h
@@ -220,17 +220,13 @@ namespace JSC {
 #endif
 
     private:
-        EvalExecutable(ExecState* exec, const SourceCode& source)
-            : ScriptExecutable(exec, source)
-            , m_evalCodeBlock(0)
-        {
-        }
+        EvalExecutable(ExecState*, const SourceCode&);
 
         JSObject* compileInternal(ExecState*, ScopeChainNode*);
 
         virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
 
-        EvalCodeBlock* m_evalCodeBlock;
+        OwnPtr<EvalCodeBlock> m_evalCodeBlock;
     };
 
     class ProgramExecutable : public ScriptExecutable {
@@ -267,17 +263,13 @@ namespace JSC {
 #endif
 
     private:
-        ProgramExecutable(ExecState* exec, const SourceCode& source)
-            : ScriptExecutable(exec, source)
-            , m_programCodeBlock(0)
-        {
-        }
+        ProgramExecutable(ExecState*, const SourceCode&);
 
         JSObject* compileInternal(ExecState*, ScopeChainNode*);
 
         virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*);
 
-        ProgramCodeBlock* m_programCodeBlock;
+        OwnPtr<ProgramCodeBlock> m_programCodeBlock;
     };
 
     class FunctionExecutable : public ScriptExecutable {
@@ -358,37 +350,12 @@ namespace JSC {
         SharedSymbolTable* symbolTable() const { return m_symbolTable; }
 
         void recompile(ExecState*);
-        void markAggregate(MarkStack& markStack);
+        void markAggregate(MarkStack&);
         static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
 
     private:
-        FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
-            : ScriptExecutable(globalData, source)
-            , m_numVariables(0)
-            , m_forceUsesArguments(forceUsesArguments)
-            , m_parameters(parameters)
-            , m_codeBlockForCall(0)
-            , m_codeBlockForConstruct(0)
-            , m_name(name)
-            , m_symbolTable(0)
-        {
-            m_firstLine = firstLine;
-            m_lastLine = lastLine;
-        }
-
-        FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
-            : ScriptExecutable(exec, source)
-            , m_numVariables(0)
-            , m_forceUsesArguments(forceUsesArguments)
-            , m_parameters(parameters)
-            , m_codeBlockForCall(0)
-            , m_codeBlockForConstruct(0)
-            , m_name(name)
-            , m_symbolTable(0)
-        {
-            m_firstLine = firstLine;
-            m_lastLine = lastLine;
-        }
+        FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine);
+        FunctionExecutable(ExecState*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine);
 
         JSObject* compileForCallInternal(ExecState*, ScopeChainNode*);
         JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*);
@@ -399,8 +366,8 @@ namespace JSC {
         bool m_forceUsesArguments : 1;
 
         RefPtr<FunctionParameters> m_parameters;
-        FunctionCodeBlock* m_codeBlockForCall;
-        FunctionCodeBlock* m_codeBlockForConstruct;
+        OwnPtr<FunctionCodeBlock> m_codeBlockForCall;
+        OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct;
         Identifier m_name;
         SharedSymbolTable* m_symbolTable;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list