gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server...
Date: Tue, 20 Feb 2007 20:05:41 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/20 20:05:41

Modified files:
        .              : ChangeLog 
        server/vm      : ASHandlers.cpp ActionExec.cpp ActionExec.h 
                         with_stack_entry.h 

Log message:
        This commit fixes a bad bug, and "temporarly" breaks the DrawingAPI..
        
                * server/vm/with_stack_entry.h: add non-const
                  version of object() accessor.
                * server/vm/ActionExec.{cpp,h}: add getTarget()
                  method to properly set "this" pointer for function
                  calls.
                * server/vm/ASHandlers.cpp (ActionCallFunction):
                  Properly set the "this" pointer by fetching it
                  from ActionExec "thread" (looks in 'with' stack).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2412&r2=1.2413
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/with_stack_entry.h?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2412
retrieving revision 1.2413
diff -u -b -r1.2412 -r1.2413
--- ChangeLog   20 Feb 2007 19:31:30 -0000      1.2412
+++ ChangeLog   20 Feb 2007 20:05:41 -0000      1.2413
@@ -1,5 +1,16 @@
 2007-02-20 Sandro Santilli <address@hidden>
 
+       * server/vm/with_stack_entry.h: add non-const
+         version of object() accessor.
+       * server/vm/ActionExec.{cpp,h}: add getTarget()
+         method to properly set "this" pointer for function
+         calls.
+       * server/vm/ASHandlers.cpp (ActionCallFunction):
+         Properly set the "this" pointer by fetching it
+         from ActionExec "thread" (looks in 'with' stack).
+
+2007-02-20 Sandro Santilli <address@hidden>
+
        * testsuite/actionscript.all/with.as: add test for function
          call in 'with' context (fails!).
        * testsuite/misc-ming.all/eventSoundTest1-Runner.cpp:

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- server/vm/ASHandlers.cpp    10 Feb 2007 01:30:32 -0000      1.36
+++ server/vm/ASHandlers.cpp    20 Feb 2007 20:05:41 -0000      1.37
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ASHandlers.cpp,v 1.36 2007/02/10 01:30:32 rsavoye Exp $ */
+/* $Id: ASHandlers.cpp,v 1.37 2007/02/20 20:05:41 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -2191,7 +2191,7 @@
         debugger.callStackPush(function_name);
        debugger.matchBreakPoint(function_name, true);
 #endif
-       as_value result = call_method(function, &env, env.get_target(),
+       as_value result = call_method(function, &env, thread.getTarget(),
                                  nargs, env.get_top_index() - 2);
 
        //log_msg("Function's result: %s", result.to_string());

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/vm/ActionExec.cpp    13 Feb 2007 19:36:34 -0000      1.19
+++ server/vm/ActionExec.cpp    20 Feb 2007 20:05:41 -0000      1.20
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ActionExec.cpp,v 1.19 2007/02/13 19:36:34 rsavoye Exp $ */
+/* $Id: ActionExec.cpp,v 1.20 2007/02/20 20:05:41 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -390,6 +390,20 @@
        env.padStack(_initial_stack_size, missing);
 }
 
+as_object*
+ActionExec::getTarget()
+{
+       if ( ! with_stack.empty() )
+       {
+               //return const_cast<as_object*>(with_stack.back().object());
+               return with_stack.back().object();
+       }
+       else
+       {
+               return env.get_target();
+       }
+}
+
 } // end of namespace gnash
 
 

Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/vm/ActionExec.h      18 Jan 2007 22:53:22 -0000      1.10
+++ server/vm/ActionExec.h      20 Feb 2007 20:05:41 -0000      1.11
@@ -159,38 +159,6 @@
        ///
        ActionExec(const swf_function& func, as_environment& newEnv, as_value* 
nRetVal);
 
-#if 0
-       /// Create an execution thread for a function call.
-       //
-       /// @param abuf
-       ///     the action code
-       ///
-       /// @param newEnv
-       ///     the execution environment (variables scope, stack etc.)
-       ///
-       /// @param nStartPC
-       ///     where to start execution (offset from start of action code)
-       ///
-       /// @param nExecBytes
-       ///     Number of bytes to run this is probably a redundant
-       ///     information, as an ActionEnd should tell us when to stop.
-       ///     We'll keep this parameter as an SWF integrity checker.
-       ///
-       /// @param nRetval
-       ///     where to return a value, if this is a function call (??)
-       ///
-       /// @param initial_with_stack
-       ///     the 'with' stack to use
-       ///
-       /// @param nIsFunction2
-       ///     wheter the given action code is actually a Function2
-       ///     
-       ActionExec(const action_buffer& abuf, as_environment& newEnv,
-               size_t nStartPC, size_t nExecBytes, as_value* nRetval,  
-               const std::vector<with_stack_entry>& initial_with_stack,
-               bool nIsFunction2);
-#endif
-
        /// Is this execution thread a function2 call ?
        bool isFunction2() { return _function_var==2; }
 
@@ -304,6 +272,20 @@
        ///
        bool getObjectMember(as_object& obj, const std::string& name, as_value& 
val);
 
+       /// Get current target.
+       //
+       /// This function returns top 'with' stack entry, if any.
+       /// Main use for this function is for calling methods and
+       /// properly setting the "this" pointer. 
+       ///
+       /// TODO:
+       /// A better, cleaner and less error-prone approach
+       /// would be providing a callFunction() method in
+       /// ActionExec. This will likely help debugger too
+       /// 
+       ///
+       as_object* getTarget();
+
        /// Execute.
        void operator() ();
 };

Index: server/vm/with_stack_entry.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/with_stack_entry.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/vm/with_stack_entry.h        19 Dec 2006 12:05:30 -0000      1.2
+++ server/vm/with_stack_entry.h        20 Feb 2007 20:05:41 -0000      1.3
@@ -63,6 +63,11 @@
                return _object.get();
        }
 
+       as_object* object() 
+       {
+               return _object.get();
+       }
+
 private:
 
        boost::intrusive_ptr<as_object> _object;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]