gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] gnash ChangeLog server/as_object.cpp server/swf...


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/as_object.cpp server/swf...
Date: Tue, 20 Nov 2007 09:55:57 +0800

In case you may like to know:  we have a testcase
misc-mtasc.all/super_test1.as and we get a 'ActionLimit hit' there due
to calling super.  As a side effect, all checks are actually discarded
in that file and cann't be caught.  So don't be surprised if you get
any unexpected failures with that tests. The checks haven't be
verified by Gnash.

--zou

On Nov 20, 2007 9:32 AM, Chad Musick <address@hidden> wrote:
> CVSROOT:        /sources/gnash
> Module name:    gnash
> Changes by:     Chad Musick <cmusick>   07/11/20 01:32:34
>
> Modified files:
>         .              : ChangeLog
>         server         : as_object.cpp swf_function.cpp swf_function.h
>
> Log message:
>         Moving swf_function::getSuper to as_object::get_super
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4895&r2=1.4896
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.80&r2=1.81
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.39&r2=1.40
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.h?cvsroot=gnash&r1=1.17&r2=1.18
>
> Patches:
> Index: ChangeLog
> ===================================================================
> RCS file: /sources/gnash/gnash/ChangeLog,v
> retrieving revision 1.4895
> retrieving revision 1.4896
> diff -u -b -r1.4895 -r1.4896
> --- ChangeLog   20 Nov 2007 00:44:02 -0000      1.4895
> +++ ChangeLog   20 Nov 2007 01:32:33 -0000      1.4896
> @@ -1,5 +1,10 @@
>  2007-10-20 Chad Musick <address@hidden>
>
> +       * server/swf_function.h,.cpp: Remove getSuper function
> +       * server/as_object.cpp: Implement get_super function.
> +
> +2007-10-20 Chad Musick <address@hidden>
> +
>         * server/array.cpp as_value.cpp as_value.h character.cpp
>           edit_text_character.cpp sprite_instance.cpp timers.cpp:
>           Remove as_environment from value conversions.
>
> Index: server/as_object.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/as_object.cpp,v
> retrieving revision 1.80
> retrieving revision 1.81
> diff -u -b -r1.80 -r1.81
> --- server/as_object.cpp        16 Nov 2007 07:43:52 -0000      1.80
> +++ server/as_object.cpp        20 Nov 2007 01:32:34 -0000      1.81
> @@ -138,8 +138,27 @@
>  as_object*
>  as_object::get_super()
>  {
> -       // TODO: Implement
> +       // Super is this.__proto__.__constructor__.prototype
> +       as_object *proto = get_prototype().get();
> +       if (!proto)
> +               return NULL;
> +
> +       as_value ctor;
> +       bool ret = proto->get_member(NSV::PROP_uuCONSTRUCTORuu, &ctor);
> +       if (!ret)
> +               return NULL;
> +
> +       as_object *ctor_obj = ctor.to_object().get();
> +       if (!ctor_obj)
> +               return NULL;
> +
> +       as_value ctor_proto;
> +       ret = ctor_obj->get_member(NSV::PROP_PROTOTYPE, &ctor_proto);
> +       if (!ret)
>         return NULL;
> +
> +       as_object *super = ctor_proto.to_object().get();
> +       return super;
>  }
>
>  as_function*
>
> Index: server/swf_function.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
> retrieving revision 1.39
> retrieving revision 1.40
> diff -u -b -r1.39 -r1.40
> --- server/swf_function.cpp     12 Oct 2007 08:01:10 -0000      1.39
> +++ server/swf_function.cpp     20 Nov 2007 01:32:34 -0000      1.40
> @@ -70,75 +70,6 @@
>  }
>
>  /*private static*/
> -boost::intrusive_ptr<as_object>
> -swf_function::getSuper(as_object& obj)
> -{
> -//#define GNASH_DEBUG_GETSUPER
> -       // Super class prototype is : obj.__proto__.__constructor__.prototype
> -       boost::intrusive_ptr<as_object> proto = obj.get_prototype();
> -       if ( ! proto )
> -       {
> -#ifdef GNASH_DEBUG_GETSUPER
> -               log_msg("Object %p doesn't have a __proto__", &obj);
> -#endif
> -               return NULL;
> -       }
> -
> -       // TODO: add a getConstructor() method to as_object
> -       //       returning an as_function ?
> -       //
> -       as_value ctor;
> -       bool ret = proto->get_member(NSV::PROP_uuCONSTRUCTORuu, &ctor);
> -       if ( ! ret )
> -       {
> -#ifdef GNASH_DEBUG_GETSUPER
> -               log_msg("Object.__proto__ %p doesn't have a __constructor__", 
> (void*)proto.get());
> -#endif
> -               return NULL;
> -       }
> -
> -       // TODO: if we cast ctor to an as_function and call getPrototype on 
> it,
> -       //       it is possible that the returned object is NOT the current
> -       //       'prototype' member, as as_function caches it ?
> -       //
> -       boost::intrusive_ptr<as_object> ctor_obj = ctor.to_object();
> -       if ( ! ctor_obj )
> -       {
> -#ifdef GNASH_DEBUG_GETSUPER
> -               log_msg("Object.__proto__.__constructor__ doesn't cast to an 
> object");
> -#endif
> -               return NULL;
> -       }
> -
> -#ifdef GNASH_DEBUG_GETSUPER
> -       log_msg("ctor_obj is %p", ctor_obj.get());
> -#endif
> -
> -       as_value ctor_proto;
> -       ret = ctor_obj->get_member(NSV::PROP_PROTOTYPE, &ctor_proto);
> -       if ( ! ret )
> -
> -       {
> -#ifdef GNASH_DEBUG_GETSUPER
> -               log_msg("Object.__proto__.constructor %p doesn't have a 
> prototype", ctor_obj.get());
> -#endif
> -               return NULL;
> -       }
> -
> -       boost::intrusive_ptr<as_object> super = ctor_proto.to_object();
> -       if ( ! super )
> -       {
> -#ifdef GNASH_DEBUG_GETSUPER
> -               log_msg("Object.__proto__.constructor.prototype doesn't cast 
> to an object");
> -#endif
> -               return NULL;
> -       }
> -
> -       return super; // FIXME: return the intrusive_ptr directly !!
> -
> -}
> -
> -/*private static*/
>  as_array_object*
>  swf_function::getArguments(swf_function& callee, const fn_call& fn)
>  {
> @@ -181,6 +112,9 @@
>         log_msg("  first_arg_bottom_index: %d\n", fn.first_arg_bottom_index);
>  #endif
>
> +       assert(fn.this_ptr);
> +       as_object *super = fn.this_ptr->get_super();
> +
>         // Some features are version-dependant
>         unsigned swfversion = VM::get().getSWFVersion();
>
> @@ -206,7 +140,6 @@
>                 // Add 'super' (SWF6+ only)
>                 if ( swfversion > 5 )
>                 {
> -                       boost::intrusive_ptr<as_object> super = 
> getSuper(*(fn.this_ptr));
>                         our_env->set_local("super", as_value(super));
>                 }
>
> @@ -285,7 +218,7 @@
>                 if ( (m_function2_flags & PRELOAD_SUPER) && swfversion > 5)
>                 {
>                         // Put 'super' in a register (SWF6+ only).
> -                       
> our_env->local_register(current_reg).set_as_object(getSuper(*(fn.this_ptr)));
> +                       
> our_env->local_register(current_reg).set_as_object(super);
>                         current_reg++;
>                 }
>
> @@ -296,7 +229,7 @@
>                 else if ( swfversion > 5 )
>                 {
>                         // Put 'super' in a local var (SWF6+ only)
> -                       our_env->add_local("super", 
> as_value(getSuper(*(fn.this_ptr))));
> +                       our_env->add_local("super", as_value(super));
>                 }
>
>                 if (m_function2_flags & PRELOAD_ROOT)
>
> Index: server/swf_function.h
> ===================================================================
> RCS file: /sources/gnash/gnash/server/swf_function.h,v
> retrieving revision 1.17
> retrieving revision 1.18
> diff -u -b -r1.17 -r1.18
> --- server/swf_function.h       28 Aug 2007 09:38:02 -0000      1.17
> +++ server/swf_function.h       20 Nov 2007 01:32:34 -0000      1.18
> @@ -84,17 +84,6 @@
>         /// See 
> http://sswf.sourceforge.net/SWFalexref.html#action_declare_function2
>         uint16_t        m_function2_flags;
>
> -       /// Return a pointer to the given object's superclass interface
> -       //
> -       /// Super class prototype is : obj.__proto__.constructor.prototype
> -       /// If any of the above element is undefined NULL is returned.
> -       ///
> -       /// TODO: cleanup and optimize this function, probably delegating
> -       ///       parts of it to the as_object class
> -       ///       (getConstructor, for example)
> -       ///
> -       static boost::intrusive_ptr<as_object> getSuper(as_object& obj);
> -
>         /// Return an 'arguments' object.
>         //
>         /// The 'arguments' variable is an array with an additional
>
>
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit
>




reply via email to

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