[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/swf_function.cpp server/...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/swf_function.cpp server/... |
Date: |
Tue, 06 Mar 2007 16:05:19 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/03/06 16:05:18
Modified files:
. : ChangeLog
server : swf_function.cpp
server/vm : ASHandlers.cpp ActionExec.cpp ActionExec.h
testsuite/misc-mtasc.all: function.as
Log message:
* server/vm/ASHandlers.cpp (ActionCallMethod): properly
setup the 'this' pointer when not specified in the tag
itself as the object parameter.
* server/vm/ActionExec.{h,cpp}:
Add a _this_ptr member and a getThisPointer() function
for use with function calls.
* server/swf_function.cpp (operator()): setup the this_ptr
in ActionExec instance.
* testsuite/misc-mtasc.all/function.as: unexpect last failure.
Looking for more failures now...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2555&r2=1.2556
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-mtasc.all/function.as?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2555
retrieving revision 1.2556
diff -u -b -r1.2555 -r1.2556
--- ChangeLog 6 Mar 2007 15:29:44 -0000 1.2555
+++ ChangeLog 6 Mar 2007 16:05:18 -0000 1.2556
@@ -1,5 +1,18 @@
2007-03-06 Sandro Santilli <address@hidden>
+ * server/vm/ASHandlers.cpp (ActionCallMethod): properly
+ setup the 'this' pointer when not specified in the tag
+ itself as the object parameter.
+ * server/vm/ActionExec.{h,cpp}:
+ Add a _this_ptr member and a getThisPointer() function
+ for use with function calls.
+ * server/swf_function.cpp (operator()): setup the this_ptr
+ in ActionExec instance.
+ * testsuite/misc-mtasc.all/function.as: unexpect last failure.
+ Looking for more failures now...
+
+2007-03-06 Sandro Santilli <address@hidden>
+
* testsuite/misc-mtasc.all/function.as:
Add a (succeeding) test for 'this' pointer being correctly set
on ActionCallMethod with *defined* name.
Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/swf_function.cpp 2 Mar 2007 19:38:56 -0000 1.21
+++ server/swf_function.cpp 6 Mar 2007 16:05:18 -0000 1.22
@@ -316,7 +316,7 @@
// Execute the actions.
//ActionExec exec(*m_action_buffer, *our_env, m_start_pc, m_length,
fn.result, m_with_stack, m_is_function2);
- ActionExec exec(*this, *our_env, fn.result);
+ ActionExec exec(*this, *our_env, fn.result, fn.this_ptr);
exec();
our_env->popCallFrame();
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- server/vm/ASHandlers.cpp 6 Mar 2007 15:14:52 -0000 1.54
+++ server/vm/ASHandlers.cpp 6 Mar 2007 16:05:18 -0000 1.55
@@ -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.54 2007/03/06 15:14:52 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.55 2007/03/06 16:05:18 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2635,12 +2635,24 @@
);
as_value method_val;
- as_object* obj = obj_value.to_object(); // for this_ptr, but should
probably not be used that wayobject
+ as_object* obj = obj_value.to_object();
if ( method_name.is_undefined() )
{
- method_val = obj_value;
- if ( ! method_val.is_function() )
+
+ // Does this ever happen ?
+ //method_val = obj_value;
+ //if ( ! method_val.is_function() )
+ //{
+ if ( ! obj )
{
+ log_error("ActionCallMethod invoked with "
+ "undefined method_name "
+ "and non-object object/func");
+ env.drop(nargs+2);
+ env.top(0).set_undefined();
+ return;
+ }
+
// TODO: all this crap should go into an
as_object::getConstructor instead
as_value ctor;
if ( ! obj->get_member("constructor", &ctor) )
@@ -2662,7 +2674,8 @@
return;
}
method_val = ctor;
- }
+ obj = thread.getThisPointer();
+ //}
}
else
{
Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/vm/ActionExec.cpp 28 Feb 2007 09:46:48 -0000 1.21
+++ server/vm/ActionExec.cpp 6 Mar 2007 16:05:18 -0000 1.22
@@ -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.21 2007/02/28 09:46:48 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.22 2007/03/06 16:05:18 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -73,13 +73,14 @@
s_fscommand_handler = handler;
}
-ActionExec::ActionExec(const swf_function& func, as_environment& newEnv,
as_value* nRetVal)
+ActionExec::ActionExec(const swf_function& func, as_environment& newEnv,
as_value* nRetVal, as_object* this_ptr)
:
with_stack(func.getWithStack()),
// See comment in header
_with_stack_limit(7),
_function_var(func.isFunction2() ? 2 : 1),
_func(&func),
+ _this_ptr(this_ptr),
code(func.getActionBuffer()),
pc(func.getStartPC()),
stop_pc(pc+func.getLength()),
Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/vm/ActionExec.h 28 Feb 2007 09:46:48 -0000 1.12
+++ server/vm/ActionExec.h 6 Mar 2007 16:05:18 -0000 1.13
@@ -25,6 +25,7 @@
#include "with_stack_entry.h"
#include "as_environment.h" // for ensureStack
+#include "smart_ptr.h"
#include <vector>
@@ -74,6 +75,9 @@
///
const swf_function* _func;
+ /// The 'this' pointer, if this is a function call
+ boost::intrusive_ptr<as_object> _this_ptr;
+
size_t _initial_stack_size;
/// Warn about a stack underrun and fix it
@@ -157,7 +161,7 @@
/// @param nRetval
/// Where to return a value. If NULL any return will be discarded.
///
- ActionExec(const swf_function& func, as_environment& newEnv, as_value*
nRetVal);
+ ActionExec(const swf_function& func, as_environment& newEnv, as_value*
nRetVal, as_object* this_ptr);
/// Is this execution thread a function2 call ?
bool isFunction2() { return _function_var==2; }
@@ -165,6 +169,9 @@
/// Is this execution thread a function call ?
bool isFunction() { return _function_var!=0; }
+ /// Get the current 'this' pointer, for use in function calls
+ as_object* getThisPointer() { return _function_var ? _this_ptr.get() :
getTarget(); }
+
/// Returns 'with' stack associated with this execution thread
//
/// If you need to modify it, use the pushWithEntry() function.
Index: testsuite/misc-mtasc.all/function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-mtasc.all/function.as,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-mtasc.all/function.as 6 Mar 2007 15:29:44 -0000
1.6
+++ testsuite/misc-mtasc.all/function.as 6 Mar 2007 16:05:18 -0000
1.7
@@ -33,7 +33,7 @@
// This checks that the 'this' pointer is properly set
// (and shows it's NOT properly set with Gnash)
-
_root.xcheck_equals(typeof(myTest.__proto__.TestClassCtorCalled), 'undefined');
+
_root.check_equals(typeof(myTest.__proto__.TestClassCtorCalled), 'undefined');
// This checks that the 'this' pointer is properly set for
"normal"
// ActionCallMethod (see setX(2) in Test ctor)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/swf_function.cpp server/...,
Sandro Santilli <=