gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12333: Actually test the with stack


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12333: Actually test the with stack limit. It's 13. Drop the version dependent
Date: Sat, 24 Jul 2010 17:40:05 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12333 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2010-07-24 17:40:05 +0200
message:
  Actually test the with stack limit. It's 13. Drop the version dependent
  code and data member.
modified:
  libcore/vm/ActionExec.cpp
  libcore/vm/ActionExec.h
  testsuite/actionscript.all/with.as
=== modified file 'libcore/vm/ActionExec.cpp'
--- a/libcore/vm/ActionExec.cpp 2010-07-23 14:22:11 +0000
+++ b/libcore/vm/ActionExec.cpp 2010-07-24 12:51:39 +0000
@@ -75,7 +75,6 @@
     retval(nRetVal),
     _withStack(),
     _scopeStack(func.getScopeStack()),
-    _withStackLimit(7),
     _func(&func),
     _this_ptr(this_ptr),
     _initialStackSize(0),
@@ -90,12 +89,6 @@
 {
     assert(stop_pc < code.size());
 
-    // See comment in header
-    // TODO: stack limit dependent on function version or VM version ?
-    if ( env.get_version() > 5 ) {
-        _withStackLimit = 15;
-    }
-
     // Functions defined in SWF version 6 and higher pushes
     // the activation object to the scope stack
     // NOTE: if we query env.get_version() we get version of the calling
@@ -125,7 +118,6 @@
     retval(0),
     _withStack(),
     _scopeStack(),
-    _withStackLimit(7),
     _func(0),
     _initialStackSize(0),
     _originalTarget(0),
@@ -137,11 +129,6 @@
     next_pc(0),
     stop_pc(abuf.size())
 {
-    /// See comment in header
-    // TODO: stack limit dependent on function version or VM version ?
-    if (env.get_version() > 5) {
-        _withStackLimit = 15;
-    }
 }
 
 void
@@ -636,16 +623,13 @@
 bool
 ActionExec::pushWith(const With& entry)
 {
-    // See comment in header about _withStackLimit
-    if (_withStack.size() >= _withStackLimit)
-    {
-        IF_VERBOSE_ASCODING_ERRORS (
-        log_aserror(_("'With' stack depth (%d) "
-            "exceeds the allowed limit for current SWF "
-            "target version (%d for version %d)."
-            " Don't expect this movie to work with all players."),
-            _withStack.size()+1, _withStackLimit,
-            env.get_version());
+    // The maximum number of withs supported is 13, regardless of the
+    // other documented figures. See actionscript.all/with.as.
+    const size_t withLimit = 13;
+
+    if (_withStack.size() == withLimit) {
+        IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror("With stack limit of %s exceeded");
         );
         return false;
     }

=== modified file 'libcore/vm/ActionExec.h'
--- a/libcore/vm/ActionExec.h   2010-07-23 14:22:11 +0000
+++ b/libcore/vm/ActionExec.h   2010-07-24 12:51:39 +0000
@@ -337,22 +337,6 @@
        /// the scope stack associated with this execution thread
        ScopeStack _scopeStack;
 
-       /// Limit of with stack
-       //
-       /// This is 7 for SWF up to 5 and 15 for SWF 6 and up
-       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
-       ///
-       /// Actually, there's likely NO point in using the limit.
-       /// The spec say that a player6 is ensured to provide at least 15 
elements
-       /// in a 'with' stack, while player5 can support at most 7.
-       /// There is no provision of a limit though.
-       ///
-       /// Gnash will use this information only to generate useful
-       /// warnings for coders (if ActionScript errors verbosity is
-       /// enabled).
-       ///
-       size_t _withStackLimit;
-
        /// A pointer to the function being executed, or NULL
        /// for non-function execution
        ///

=== modified file 'testsuite/actionscript.all/with.as'
--- a/testsuite/actionscript.all/with.as        2010-01-11 06:41:38 +0000
+++ b/testsuite/actionscript.all/with.as        2010-07-24 12:51:00 +0000
@@ -543,12 +543,94 @@
 check_equals(child, "rootChild");
 #endif // OUTPUT_VERSION > 5
 
+var a = {};
+a.b = {};
+a.b.c = {};
+a.b.c.d = {};
+a.b.c.d.e = {};
+a.b.c.d.e.f = {};
+a.b.c.d.e.f.g = {};
+a.b.c.d.e.f.g.h = {};
+a.b.c.d.e.f.g.h.i = {};
+a.b.c.d.e.f.g.h.i.j = {};
+a.b.c.d.e.f.g.h.i.j.k = {};
+a.b.c.d.e.f.g.h.i.j.k.l = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n.o = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r = {};
+a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s = {};
+
+withs = "";
+
+with(a) {
+ withs += "a";
+ check_equals(typeof(b), "object");
+ with(b) {
+  withs += "b";
+  with(c) {
+   withs += "c";
+   with(d) {
+    withs += "d";
+    with(e) {
+     withs += "e";
+     with(f) {
+      withs += "f";
+      with(g) {
+       withs += "g";
+       with(h) {
+        withs += "h";
+        with(i) {
+         withs += "i";
+         with(j) {
+          withs += "j";
+          with(k) {
+           withs += "k";
+           with(l) {
+            withs += "l";
+            with(m) {
+             withs += "m";
+             with(n) {
+              withs += "n";
+              with(o) {
+               withs += "o";
+               with(p) {
+                withs += "p";
+                with(q) {
+                 withs += "q";
+                 with(r) {
+                  withs += "r";
+                 }
+                }
+               }
+              }
+             }
+            }
+           }
+          }
+         }
+        }
+       }
+      }
+     }
+    }
+   }
+  }
+ }
+}
+
+// There are 13 levels for all versions!
+check_equals(withs, "abcdefghijklm");
+
+
 //---------------------------------------------------------
 // END OF TESTS
 //---------------------------------------------------------
 
 #if OUTPUT_VERSION < 6
- check_totals(41);
+ check_totals(43);
 #else
- check_totals(99);
+ check_totals(101);
 #endif


reply via email to

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