gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11127: Restore reverted log message


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11127: Restore reverted log messages and some implementation.
Date: Tue, 16 Jun 2009 10:39:26 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11127
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-06-16 10:39:26 +0200
message:
  Restore reverted log messages and some implementation.
  
  Fix global.setInterval crash.
modified:
  libcore/asobj/Global.cpp
  libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11124.1.7
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2009-06-16 10:08:34 +0200
    message:
      Don't crash but log error when clearInterval is called with no args.
    modified:
      libcore/asobj/Global.cpp
    ------------------------------------------------------------
    revno: 11124.1.8
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2009-06-16 10:16:01 +0200
    message:
      Restore changes that merge reverted (not very impressive bzr).
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11124.1.9
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2009-06-16 10:22:15 +0200
    message:
      Line breaks.
    modified:
      libcore/vm/Machine.cpp
=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp  2009-06-16 05:42:44 +0000
+++ b/libcore/asobj/Global.cpp  2009-06-16 08:08:34 +0000
@@ -740,7 +740,12 @@
 as_value
 global_clearInterval(const fn_call& fn)
 {
-       //log_debug("%s: nargs = %d", __FUNCTION__, fn.nargs);
+    if (!fn.nargs) {
+        IF_VERBOSE_ASCODING_ERRORS(
+                log_aserror("clearInterval requires one argument, got none");
+        );
+        return as_value();
+    }
 
        int id = int(fn.arg(0).to_number());
 

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-06-16 06:51:59 +0000
+++ b/libcore/vm/Machine.cpp    2009-06-16 08:39:26 +0000
@@ -269,6 +269,35 @@
 
 }
 
+Machine::Machine(VM& vm)
+        :
+        mStack(),
+        mRegisters(),
+        mScopeStack(),
+        mStream(0),
+        mST(vm.getStringTable()),
+        mDefaultXMLNamespace(0),
+        mCurrentScope(0),
+        mGlobalScope(0),
+        mDefaultThis(0),
+        mThis(0),
+        mGlobalObject(0),
+        mGlobalReturn(),
+        mIgnoreReturn(),
+        mIsAS3(false),
+        mExitWithReturn(false),
+        mPoolObject(0),
+        mCurrentFunction(0),
+        _vm(vm),
+        mCH(_vm.getClassHierarchy())
+{
+       // Local registers should be initialized at the beginning of each
+    // function call, but we don't currently parse the number of local
+    // registers for each function.
+    // mRegisters.resize(16);
+}
+
+
 void
 Machine::execute()
 {
@@ -1274,11 +1303,12 @@
                 ///  [ns [n]] -- Namespace stuff
                 ///  obj -- The object whose property is to be accessed.
                 /// Stack Out:
-                ///  value -- the value from obj::(resolve)'name_offset'(arg1, 
..., argN)
+                ///  value -- the value from obj::(resolve)'name_offset'
+                ///      (arg1, ..., argN)
                 ///  (unless ABC_ACTION_CALL_PROPVOID, then: . )
                 /// NB: Calls getter/setter if they exist.
-                /// If the opcode is ABC_ACTION_CALLPROPLEX, obj is not 
altered by
-                /// getter/setters
+                /// If the opcode is ABC_ACTION_CALLPROPLEX, obj is
+                /// not altered by getter/setters
                 case SWF::ABC_ACTION_CALLPROPERTY:
                 case SWF::ABC_ACTION_CALLPROPLEX:
                 case SWF::ABC_ACTION_CALLPROPVOID:
@@ -1286,11 +1316,11 @@
                     as_value result;
                     asName a = pool_name(mStream->read_V32(), mPoolObject);
                     boost::uint32_t argc = mStream->read_V32();
-                    std::auto_ptr< std::vector<as_value> > args = 
get_args(argc);
-                    //TODO: If multiname is runtime also pop namespace and/or 
name values.
-                    
+                    std::auto_ptr< std::vector<as_value> > args =
+                        get_args(argc);
+
                     if (a.isRuntime()) {
-                        log_unimpl("ABC_ACTION_CALL* with runtime multiname");
+                        mStack.drop(completeName(a));
                     }
 
                     as_value object_val = pop_stack();
@@ -1298,26 +1328,27 @@
                     as_object *object = object_val.to_object().get();
                     if (!object) {
                         IF_VERBOSE_ASCODING_ERRORS(
-                        log_aserror(_("Can't call a method of a value that 
doesn't "
-                                "cast to an object (%s)."),
-                            object_val);
+                        log_aserror(_("Can't call a method of a value "
+                                "that doesn't cast to an object (%s)."),
+                                object_val);
                         )
                     }
                     else {
 
-                        as_value property = 
object->getMember(a.getGlobalName(), 0);
+                        as_value property = object->getMember(
+                                a.getGlobalName(), 0);
                     
                         if (!property.is_undefined() && !property.is_null()) {
                             log_abc("Calling method %s on object %s",
-                                    
property.toDebugString(),object_val.toDebugString());
+                                    property, object_val);
                             as_environment env = as_environment(_vm);
                             result = call_method(property,env,object,args);
 
                         }
                         else {
                             IF_VERBOSE_ASCODING_ERRORS(
-                            log_aserror(_("Property '%s' of object '%s' is 
'%s', "
-                                    "cannot call as method"),
+                            log_aserror(_("Property '%s' of object '%s' "
+                                    "is '%s', cannot call as method"),
                                     mPoolObject->stringPoolAt(a.getABCName()),
                                     object_val, property);
                             )
@@ -1585,14 +1616,20 @@
                     new_class->init_member(NSV::PROP_uuCONSTRUCTORuu,
                             as_value(static_constructor), 0);
                     
-                    as_function* constructor = 
c->getConstructor()->getPrototype();
-                    new_class->init_member(NSV::PROP_CONSTRUCTOR, 
as_value(constructor), 0);
-                    push_stack(as_value(new_class));
-
-                    // Call the class's static constructor (which may be 
undefined).
+                    as_function* constructor =
+                        c->getConstructor()->getPrototype();
+                    new_class->init_member(NSV::PROP_CONSTRUCTOR, as_value(
+                                constructor), 0);
+
+                    push_stack(new_class);
+
+                    // Call the class's static constructor (which may be
+                    // undefined).
                     as_environment env = as_environment(_vm);
-                    as_value property = 
new_class->getMember(NSV::PROP_uuCONSTRUCTORuu, 0);
-                    as_value value = call_method(property, env, new_class, 
get_args(0));
+                    as_value property = new_class->getMember(
+                            NSV::PROP_uuCONSTRUCTORuu, 0);
+                    as_value value = call_method(property, env, new_class,
+                            get_args(0));
 
                     break;
                 }
@@ -1818,6 +1855,9 @@
                     as_value object_val = pop_stack();
                     as_object* object = object_val.to_object().get();
                     
+                    log_abc(_("GETPROPERTY: Looking for property "
+                            "%s of object %s"), mST.value(name), object_val);
+
                     if (!object) {
                         log_abc(_("GETPROPERTY: expecting object on "
                                     "stack, got %s."), object_val);
@@ -3051,38 +3091,12 @@
     log_debug("Finished instantiating class %s", className);
 }
 
-Machine::Machine(VM& vm)
-        :
-        mStack(),
-        mRegisters(),
-        mScopeStack(),
-        mStream(0),
-        mST(vm.getStringTable()),
-        mDefaultXMLNamespace(0),
-        mCurrentScope(0),
-        mGlobalScope(0),
-        mDefaultThis(0),
-        mThis(0),
-        mGlobalObject(0),
-        mGlobalReturn(),
-        mIgnoreReturn(),
-        mIsAS3(false),
-        mExitWithReturn(false),
-        mPoolObject(0),
-        mCurrentFunction(0),
-        _vm(vm),
-        mCH(_vm.getClassHierarchy())
+as_value
+Machine::find_prop_strict(asName multiname)
 {
-       //Local registers should be initialized at the beginning of each 
function call, but
-       //we don't currently parse the number of local registers for each 
function.
-//     mRegisters.resize(16);
-//     mST = new string_table();
-//     mST = ST;
-}
-
-as_value
-Machine::find_prop_strict(asName multiname) {
        
+    log_abc("Looking for property %s", mST.value(multiname.getGlobalName()));
+
        as_value val;
        mScopeStack.push(mGlobalObject);
        for (size_t i = 0; i < mScopeStack.size(); ++i)
@@ -3102,16 +3116,17 @@
                }
        }
 
-       log_abc("Cannot find property in scope stack.  Trying again using "
-            "as_environment.");
-       as_object *target = NULL;
+       as_object *target = 0;
        as_environment env = as_environment(_vm);
        std::string name = mPoolObject->stringPoolAt(multiname.getABCName());
        std::string ns = mPoolObject->stringPoolAt(
             multiname.getNamespace()->getAbcURI());
        std::string path = ns.empty() ? name : ns + "." + name;
 
-    std::auto_ptr<as_environment::ScopeStack> envStack ( getScopeStack() );
+    log_abc("Failed to find property in scope stack. Looking for %s in "
+        "as_environment", path);
+
+    std::auto_ptr<as_environment::ScopeStack> envStack (getScopeStack());
        val = env.get_variable(path, *envStack, &target);
 
        push_stack(target);     


reply via email to

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