CVSROOT: /sources/gnash Module name: gnash Changes by: Chad Musick <cmusick> 07/11/20 10:31:40
Modified files: . : ChangeLog server : as_object.cpp as_object.h edit_text_character.cpp server/asobj : AsBroadcaster.cpp Key.cpp MovieClipLoader.cpp xml.cpp xmlsocket.cpp server/vm : fn_call.h Log message: Remove the parameter as_environment from as_object::callMethod Interally, an as_environment is still used, but this should be going away quite soon. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4898&r2=1.4899 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.81&r2=1.82 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.84&r2=1.85 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.132&r2=1.133 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/AsBroadcaster.cpp?cvsroot=gnash&r1=1.9&r2=1.10 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.cpp?cvsroot=gnash&r1=1.45&r2=1.46 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.35&r2=1.36 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.53&r2=1.54 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.cpp?cvsroot=gnash&r1=1.37&r2=1.38 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/fn_call.h?cvsroot=gnash&r1=1.12&r2=1.13 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4898 retrieving revision 1.4899 diff -u -b -r1.4898 -r1.4899 --- ChangeLog 20 Nov 2007 06:43:13 -0000 1.4898 +++ ChangeLog 20 Nov 2007 10:31:39 -0000 1.4899 @@ -1,3 +1,13 @@ +2007-11-20 Chad Musick <[EMAIL PROTECTED]> + + * server/as_object.h,.cpp: Remove as_environment parameter from + callMethod methods. + * server/edit_text_character.cpp: Fix call to callMethod + * server/asobj/AsBroadcaster.cpp Key.cpp MovieClipLoader.cpp + xml.cpp xmlsocket.cpp: Fix calls to callMethod + * server/vm/fn_call.h: Add necessary support for removing env() + function (not yet removed). + 2007-11-20 Zou Lunkai <[EMAIL PROTECTED]> * testsuite/misc-swfc.all/swf4opcode.sc, Makefile.am: add tests for swf4 @@ -8,7 +18,7 @@ * server/vm/AsHandlers.cpp: using to_string_versioned() for opcode ActionStringEq, fix bug21567. -2007-11-20 Chad Musick <[EMAIL PROTECTED]> +2007-10-20 Chad Musick <[EMAIL PROTECTED]> * server/swf_function.h,.cpp: Remove getSuper function * server/as_object.cpp: Implement get_super function. Index: server/as_object.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_object.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -u -b -r1.81 -r1.82 --- server/as_object.cpp 20 Nov 2007 01:32:34 -0000 1.81 +++ server/as_object.cpp 20 Nov 2007 10:31:39 -0000 1.82 @@ -858,7 +858,7 @@ } as_value -as_object::callMethod(string_table::key methodName, as_environment& env) +as_object::callMethod(string_table::key methodName) { as_value ret; as_value method; @@ -868,11 +868,13 @@ return ret; } + as_environment env; + return call_method(method, &env, this, 0, env.stack_size()); } as_value -as_object::callMethod(string_table::key methodName, as_environment& env, const as_value& arg0) +as_object::callMethod(string_table::key methodName, const as_value& arg0) { as_value ret; as_value method; @@ -882,6 +884,7 @@ return ret; } + as_environment env; env.push(arg0); ret = call_method(method, &env, this, 1, env.stack_size()-1); @@ -892,7 +895,7 @@ } as_value -as_object::callMethod(string_table::key methodName, as_environment& env, +as_object::callMethod(string_table::key methodName, const as_value& arg0, const as_value& arg1) { as_value ret; @@ -907,6 +910,8 @@ size_t origStackSize = env.stack_size(); #endif + as_environment env; + env.push(arg1); env.push(arg0); Index: server/as_object.h =================================================================== RCS file: /sources/gnash/gnash/server/as_object.h,v retrieving revision 1.84 retrieving revision 1.85 diff -u -b -r1.84 -r1.85 --- server/as_object.h 16 Nov 2007 21:28:54 -0000 1.84 +++ server/as_object.h 20 Nov 2007 10:31:39 -0000 1.85 @@ -524,10 +524,10 @@ /// or undefined if not found. Use get_member if you /// need to know wheter it was found or not. /// - as_value callMethod(string_table::key name, as_environment& env); - as_value callMethod(string_table::key name, as_environment& env, const as_value& arg0); - as_value callMethod(string_table::key name, as_environment& env, const as_value& arg0, const as_value& arg1); - as_value callMethod(string_table::key name, as_environment& env, const as_value& arg0, const as_value& arg1, const as_value& arg2); + as_value callMethod(string_table::key name); + as_value callMethod(string_table::key name, const as_value& arg0); + as_value callMethod(string_table::key name, const as_value& arg0, const as_value& arg1); + as_value callMethod(string_table::key name, const as_value& arg0, const as_value& arg1, const as_value& arg2); /// Delete a property of this object, unless protected from deletion. // Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.132 retrieving revision 1.133 diff -u -b -r1.132 -r1.133 --- server/edit_text_character.cpp 20 Nov 2007 00:44:03 -0000 1.132 +++ server/edit_text_character.cpp 20 Nov 2007 10:31:39 -0000 1.133 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.132 2007/11/20 00:44:03 cmusick Exp $ */ +/* $Id: edit_text_character.cpp,v 1.133 2007/11/20 10:31:39 cmusick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2059,7 +2059,7 @@ string_table& st = _vm.getStringTable(); string_table::key key = st.find(PROPNAME("onChanged")); as_environment& env = const_cast<edit_text_character*>(this)->get_environment(); - callMethod(key, env); + callMethod(key); } void @@ -2068,7 +2068,7 @@ string_table& st = _vm.getStringTable(); string_table::key key = st.find(PROPNAME("onSetFocus")); as_environment& env = const_cast<edit_text_character*>(this)->get_environment(); - callMethod(key, env); + callMethod(key); } void @@ -2077,7 +2077,7 @@ string_table& st = _vm.getStringTable(); string_table::key key = st.find(PROPNAME("onKillFocus")); as_environment& env = const_cast<edit_text_character*>(this)->get_environment(); - callMethod(key, env); + callMethod(key); } void Index: server/asobj/AsBroadcaster.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/AsBroadcaster.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -b -r1.9 -r1.10 --- server/asobj/AsBroadcaster.cpp 20 Nov 2007 00:44:04 -0000 1.9 +++ server/asobj/AsBroadcaster.cpp 20 Nov 2007 10:31:39 -0000 1.10 @@ -41,10 +41,7 @@ /// Name of the event being broadcasted /// appropriately cased based on SWF version /// of the current VM - std::string _eventName; - - /// Environment to use for marshalling and functions invokation - as_environment& _env; + string_table::key _eventName; // These two will be needed for consistency checking //size_t _origEnvStackSize; @@ -53,7 +50,7 @@ /// Number of event dispatches unsigned int _dispatched; - const fn_call& _fn; + fn_call _fn; public: @@ -64,11 +61,12 @@ /// BroadcasterVisitor(const fn_call& fn) : - _eventName(PROPNAME(fn.arg(0).to_string())), - _env(fn.env()), + _eventName(0), _dispatched(0), _fn(fn) { + _eventName = VM::get().getStringTable().find(PROPNAME(fn.arg(0).to_string())); + _fn.drop_bottom(); } /// Call a method on the given value @@ -78,7 +76,7 @@ if ( ! o ) return; as_value method; - o->get_member(VM::get().getStringTable().find(_eventName), &method); + o->get_member(_eventName, &method); if ( method.is_function() ) { @@ -86,7 +84,8 @@ #ifndef NDEBUG size_t oldStackSize = _env.stack_size(); #endif - call_method(method, &_env, o.get(), _fn.nargs-1, _fn.offset()-1); + _fn.this_ptr = o.get(); + method.to_as_function()->call(_fn); assert ( _env.stack_size() == oldStackSize ); @@ -182,7 +181,7 @@ as_value newListener; assert(newListener.is_undefined()); if ( fn.nargs ) newListener = fn.arg(0); - obj->callMethod(NSV::PROP_REMOVE_LISTENER, fn.env(), newListener); + obj->callMethod(NSV::PROP_REMOVE_LISTENER, newListener); as_value listenersValue; @@ -223,7 +222,7 @@ fn.dump_args().c_str(), listenersValue.to_debug_string().c_str()); ); - listenersObj->callMethod(NSV::PROP_PUSH, fn.env(), newListener); + listenersObj->callMethod(NSV::PROP_PUSH, newListener); } else @@ -292,7 +291,7 @@ as_value v = listenersObj->getMember(VM::get().getStringTable().find(n)); if ( v.equals(listenerToRemove) ) { - listenersObj->callMethod(NSV::PROP_SPLICE, fn.env(), iVal, as_value(1)); + listenersObj->callMethod(NSV::PROP_SPLICE, iVal, as_value(1)); return as_value(true); } } Index: server/asobj/Key.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/Key.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -b -r1.45 -r1.46 --- server/asobj/Key.cpp 16 Nov 2007 17:35:34 -0000 1.45 +++ server/asobj/Key.cpp 20 Nov 2007 10:31:39 -0000 1.46 @@ -132,7 +132,7 @@ as_environment env; log_debug("notify_listeners calling broadcastMessage with arg %s", ev.to_debug_string().c_str()); - callMethod(NSV::PROP_BROADCAST_MESSAGE, env, ev); + callMethod(NSV::PROP_BROADCAST_MESSAGE, ev); } int Index: server/asobj/MovieClipLoader.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -b -r1.35 -r1.36 --- server/asobj/MovieClipLoader.cpp 20 Nov 2007 00:44:04 -0000 1.35 +++ server/asobj/MovieClipLoader.cpp 20 Nov 2007 10:31:39 -0000 1.36 @@ -262,7 +262,7 @@ as_value ev(event); log_debug("dispatchEvent calling broadcastMessage with args %s and %s", ev.to_debug_string().c_str(), arg.to_debug_string().c_str()); - callMethod(NSV::PROP_BROADCAST_MESSAGE, env, ev, arg); + callMethod(NSV::PROP_BROADCAST_MESSAGE, ev, arg); } static as_value Index: server/asobj/xml.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -b -r1.53 -r1.54 --- server/asobj/xml.cpp 20 Nov 2007 00:44:05 -0000 1.53 +++ server/asobj/xml.cpp 20 Nov 2007 10:31:39 -0000 1.54 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: xml.cpp,v 1.53 2007/11/20 00:44:05 cmusick Exp $ */ +/* $Id: xml.cpp,v 1.54 2007/11/20 10:31:39 cmusick Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -433,7 +433,7 @@ src.append(buf, bytes); if ( bytes < 255 ) break; // end of buffer } - callMethod(onDataKey, env, as_value(src)); + callMethod(onDataKey, as_value(src)); } // This reads in an XML file from disk and parses into into a memory resident @@ -450,7 +450,7 @@ { log_error(_("Can't load XML file: %s (security?)"), url.str().c_str()); as_value nullValue; nullValue.set_null(); - callMethod(VM::get().getStringTable().find("onData"), env, nullValue); + callMethod(VM::get().getStringTable().find("onData"), nullValue); return false; } @@ -797,14 +797,14 @@ string_table::key parseXMLKey = st.find(PROPNAME("parseXML")); as_value tmp(true); thisPtr->set_member(loadedKey, tmp); - thisPtr->callMethod(parseXMLKey, env, src); - thisPtr->callMethod(onLoadKey, env, tmp); + thisPtr->callMethod(parseXMLKey, src); + thisPtr->callMethod(onLoadKey, tmp); } else { as_value tmp(true); thisPtr->set_member(loadedKey, tmp); - thisPtr->callMethod(onLoadKey, env, tmp); + thisPtr->callMethod(onLoadKey, tmp); } return as_value(); Index: server/asobj/xmlsocket.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -b -r1.37 -r1.38 --- server/asobj/xmlsocket.cpp 20 Nov 2007 00:44:05 -0000 1.37 +++ server/asobj/xmlsocket.cpp 20 Nov 2007 10:31:40 -0000 1.38 @@ -456,7 +456,7 @@ // log_debug(_("XMLSocket.connect(): tring to call onConnect")); as_environment& env = fn.env(); - ptr->callMethod(st.find(PROPNAME("onConnect")), env, success); + ptr->callMethod(st.find(PROPNAME("onConnect")), success); if ( success ) { @@ -573,7 +573,7 @@ VM& vm = VM::get(); string_table& st = vm.getStringTable(); - ptr->callMethod(st.find(PROPNAME("onXML")), env, arg); + ptr->callMethod(st.find(PROPNAME("onXML")), arg); return as_value(); Index: server/vm/fn_call.h =================================================================== RCS file: /sources/gnash/gnash/server/vm/fn_call.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -b -r1.12 -r1.13 --- server/vm/fn_call.h 1 Nov 2007 16:14:21 -0000 1.12 +++ server/vm/fn_call.h 20 Nov 2007 10:31:40 -0000 1.13 @@ -55,6 +55,14 @@ unsigned int nargs; public: + fn_call(const fn_call& fn) : this_ptr(fn.this_ptr), nargs(fn.nargs), + _env(fn._env), _stack_offset(fn._stack_offset) + {/**/} + + fn_call(const fn_call& fn, as_object* this_in) : this_ptr(this_in), + nargs(fn.nargs), _env(fn._env), _stack_offset(fn._stack_offset) + {/**/} + fn_call(as_object* this_in, as_environment* env_in, int nargs_in, int first_in) @@ -84,6 +92,17 @@ return _env->bottom(_stack_offset - n); } + void drop_top() + { + --nargs; + } + + void drop_bottom() + { + --nargs; + --_stack_offset; + } + int offset() const { return _stack_offset; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit