[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11162: Put some functions where the
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11162: Put some functions where they should be. Fix crash when Gnash fakes things. |
Date: |
Tue, 23 Jun 2009 16:02:57 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11162
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-06-23 16:02:57 +0200
message:
Put some functions where they should be. Fix crash when Gnash fakes things.
modified:
libcore/asClass.cpp
libcore/asMethod.cpp
libcore/vm/Machine.cpp
------------------------------------------------------------
revno: 11153.1.16
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-06-23 15:44:26 +0200
message:
Put asMethod functions in asMethod.cpp.
modified:
libcore/asClass.cpp
libcore/asMethod.cpp
------------------------------------------------------------
revno: 11153.1.17
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-06-23 15:45:54 +0200
message:
Don't use asClass constructor if there isn't one. This happens due
to a Gnash bug.
modified:
libcore/vm/Machine.cpp
=== modified file 'libcore/asClass.cpp'
--- a/libcore/asClass.cpp 2009-05-14 12:05:01 +0000
+++ b/libcore/asClass.cpp 2009-06-23 13:44:26 +0000
@@ -61,14 +61,6 @@
}
return true;
}
-
-bool
-asMethod::addMemberClass(string_table::key name, asNamespace *ns,
- boost::uint32_t slotId, asClass *type)
-{
- return addSlot(name, ns, slotId, type);
-}
-
bool
asClass::addMemberClass(string_table::key name, asNamespace *ns,
boost::uint32_t slotId, asClass *type, bool isstatic)
@@ -77,33 +69,6 @@
}
bool
-asMethod::addSlot(string_table::key name, asNamespace* ns, boost::uint32_t
slotId,
- asClass */*type*/)
-{
- string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
- int flags = as_prop_flags::dontDelete;
-
- _prototype->init_member(name, as_value(), flags, nsname, slotId);
- return true;
-}
-
-bool
-asMethod::addSlotFunction(string_table::key name, asNamespace *ns,
- boost::uint32_t slotId, asMethod *method)
-{
- asClass a;
- a.setName(NSV::CLASS_FUNCTION);
- as_value b(method->getPrototype());
- return addValue(name, ns, slotId, &a, b, false);
-}
-
-void
-asMethod::initPrototype(Machine* machine)
-{
- _prototype = new abc_function(this,machine);
-}
-
-bool
asClass::addSlotFunction(string_table::key name, asNamespace *ns,
boost::uint32_t slotId, asMethod *method, bool isstatic)
{
@@ -132,20 +97,7 @@
return true;
}
-bool
-asMethod::addMethod(string_table::key /*name*/, asNamespace* /*ns*/, asMethod*
- /*method*/)
-{
-// string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
-// as_value val(method->getPrototype());
-// as value val = new
as_value(abc_function(asMethod->getBody,_prototype->getVM().getMachine()));
-// _prototype->init_member(name, val, as_prop_flags::readOnly |
-// as_prop_flags::dontDelete | as_prop_flags::dontEnum, nsname);
-// return true;
-return false;
-}
-
-bool
+ bool
asClass::addMethod(string_table::key name, asNamespace* /*ns*/,
asMethod* method, bool /*isstatic*/)
{
@@ -159,6 +111,7 @@
return true;
}
+
bool
asClass::addGetter(string_table::key name, asNamespace *ns, asMethod *method,
bool isstatic)
@@ -201,42 +154,6 @@
return true;
}
-bool
-asMethod::addGetter(string_table::key name, asNamespace *ns, asMethod *method)
-{
- string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
-
- Property *getset = _prototype->getOwnProperty(name, nsname);
-
- if (getset)
- getset->setGetter(method->getPrototype());
- else
- {
- int flags = as_prop_flags::dontDelete | as_prop_flags::dontEnum;
- _prototype->init_property(name, *method->getPrototype(),
- *method->getPrototype(), flags, nsname);
- }
- return true;
-}
-
-bool
-asMethod::addSetter(string_table::key name, asNamespace *ns, asMethod *method)
-{
- string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
-
- Property *getset = _prototype->getOwnProperty(name, nsname);
-
- if (getset)
- getset->setSetter(method->getPrototype());
- else
- {
- int flags = as_prop_flags::dontDelete | as_prop_flags::dontEnum;
- _prototype->init_property(name, *method->getPrototype(),
- *method->getPrototype(), flags, nsname);
- }
- return true;
-}
-
#if 0 // TODO
void
asClass::buildFromPrototype(as_object *o, string_table::key name,
=== modified file 'libcore/asMethod.cpp'
--- a/libcore/asMethod.cpp 2009-06-23 07:15:40 +0000
+++ b/libcore/asMethod.cpp 2009-06-23 13:44:26 +0000
@@ -23,6 +23,7 @@
#include "asClass.h"
#include "CodeStream.h"
#include "abc_function.h"
+#include "VM.h"
namespace gnash {
@@ -101,4 +102,88 @@
return true;
}
+bool
+asMethod::addGetter(string_table::key name, asNamespace *ns, asMethod *method)
+{
+ string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
+
+ Property *getset = _prototype->getOwnProperty(name, nsname);
+
+ if (getset)
+ getset->setGetter(method->getPrototype());
+ else
+ {
+ int flags = as_prop_flags::dontDelete | as_prop_flags::dontEnum;
+ _prototype->init_property(name, *method->getPrototype(),
+ *method->getPrototype(), flags, nsname);
+ }
+ return true;
+}
+
+bool
+asMethod::addSetter(string_table::key name, asNamespace *ns, asMethod *method)
+{
+ string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
+
+ Property *getset = _prototype->getOwnProperty(name, nsname);
+
+ if (getset)
+ getset->setSetter(method->getPrototype());
+ else
+ {
+ int flags = as_prop_flags::dontDelete | as_prop_flags::dontEnum;
+ _prototype->init_property(name, *method->getPrototype(),
+ *method->getPrototype(), flags, nsname);
+ }
+ return true;
+}
+
+bool
+asMethod::addMemberClass(string_table::key name, asNamespace *ns,
+ boost::uint32_t slotId, asClass *type)
+{
+ return addSlot(name, ns, slotId, type);
+}
+
+bool
+asMethod::addSlot(string_table::key name, asNamespace* ns, boost::uint32_t
slotId,
+ asClass */*type*/)
+{
+ string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
+ int flags = as_prop_flags::dontDelete;
+
+ _prototype->init_member(name, as_value(), flags, nsname, slotId);
+ return true;
+}
+
+bool
+asMethod::addSlotFunction(string_table::key name, asNamespace *ns,
+ boost::uint32_t slotId, asMethod *method)
+{
+ asClass a;
+ a.setName(NSV::CLASS_FUNCTION);
+ as_value b(method->getPrototype());
+ return addValue(name, ns, slotId, &a, b, false);
+}
+
+void
+asMethod::initPrototype(Machine* machine)
+{
+ _prototype = new abc_function(this,machine);
+}
+
+bool
+asMethod::addMethod(string_table::key /*name*/, asNamespace* /*ns*/, asMethod*
+ /*method*/)
+{
+// string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
+// as_value val(method->getPrototype());
+// as value val = new
as_value(abc_function(asMethod->getBody,_prototype->getVM().getMachine()));
+// _prototype->init_member(name, val, as_prop_flags::readOnly |
+// as_prop_flags::dontDelete | as_prop_flags::dontEnum, nsname);
+// return true;
+return false;
+}
+
+
} // namespace gnash
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-06-23 07:39:53 +0000
+++ b/libcore/vm/Machine.cpp 2009-06-23 13:45:54 +0000
@@ -3162,6 +3162,12 @@
asMethod* ctor = cl->getConstructor();
+ if (!ctor) {
+ log_error("Class found has no constructor, can't instantiate "
+ "class");
+ return;
+ }
+
clearRegisters(ctor->getMaxRegisters());
mCurrentFunction = ctor->getPrototype();
mStack.clear();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11162: Put some functions where they should be. Fix crash when Gnash fakes things.,
Benjamin Wolsey <=