[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/avm2 r9573: Begin implementing abc_block::
From: |
Tom Stellard |
Subject: |
[Gnash-commit] /srv/bzr/gnash/avm2 r9573: Begin implementing abc_block::finalize_mbody. |
Date: |
Sun, 28 Sep 2008 21:23:03 +0800 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9573
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Sun 2008-09-28 21:23:03 +0800
message:
Begin implementing abc_block::finalize_mbody.
modified:
libcore/abc_function.cpp
libcore/abc_function.h
libcore/asClass.cpp
libcore/asClass.h
libcore/parser/abc_block.cpp
libcore/swf/DoABCTag.h
libcore/vm/Machine.cpp
=== modified file 'libcore/abc_function.cpp'
--- a/libcore/abc_function.cpp 2008-09-28 06:37:27 +0000
+++ b/libcore/abc_function.cpp 2008-09-28 13:23:03 +0000
@@ -19,6 +19,7 @@
#include "abc_function.h"
#include "asClass.h"
#include "fn_call.h"
+#include "Machine.h"
namespace gnash{
=== modified file 'libcore/abc_function.h'
--- a/libcore/abc_function.h 2008-08-31 00:41:54 +0000
+++ b/libcore/abc_function.h 2008-09-28 13:23:03 +0000
@@ -24,12 +24,13 @@
#include "as_function.h"
#include "as_value.h"
-#include "asClass.h"
#include "CodeStream.h"
-#include "Machine.h"
namespace gnash {
+class asMethod;
+class Machine;
+
/// ABC-defined Function
class abc_function : public as_function
{
=== modified file 'libcore/asClass.cpp'
--- a/libcore/asClass.cpp 2008-09-02 02:19:58 +0000
+++ b/libcore/asClass.cpp 2008-09-28 13:23:03 +0000
@@ -69,7 +69,13 @@
if (isconst)
flags |= as_prop_flags::readOnly;
- mPrototype->init_member(name, val, flags, nsname, slotId);
+
+ if(slotId == 0){
+ mPrototype->init_member(name, val, flags, nsname);
+ }
+ else{
+ mPrototype->init_member(name, val, flags, nsname, slotId);
+ }
return true;
}
=== modified file 'libcore/asClass.h'
--- a/libcore/asClass.h 2008-09-28 06:37:27 +0000
+++ b/libcore/asClass.h 2008-09-28 13:23:03 +0000
@@ -26,7 +26,7 @@
#include "CodeStream.h"
#include "Property.h"
#include "as_function.h"
-
+#include "abc_function.h"
#include "abc_block.h"
@@ -46,6 +46,7 @@
class ClassHierarchy;
class Property;
class asName;
+class Machine;
namespace abc_parsing{
class abc_Trait;
@@ -329,7 +330,7 @@
class asMethod
{
private:
- as_function* mPrototype;
+ abc_function* mPrototype;
typedef enum
{
@@ -356,6 +357,8 @@
public:
+ void initPrototype(Machine* machine){ mPrototype = new
abc_function(this,machine);}
+
boost::uint32_t getMaxRegisters(){ return mMaxRegisters;}
void setMaxRegisters(boost::uint32_t maxRegisters){ mMaxRegisters =
maxRegisters;}
=== modified file 'libcore/parser/abc_block.cpp'
--- a/libcore/parser/abc_block.cpp 2008-09-28 06:37:27 +0000
+++ b/libcore/parser/abc_block.cpp 2008-09-28 13:23:03 +0000
@@ -114,8 +114,7 @@
bool
abc_Trait::finalize_mbody(abc_block *pBlock, asMethod *pMethod)
{
- LOG_DEBUG_ABC("Finalize_mbody doesn't work. Returning.");
- return true;
+ LOG_DEBUG_ABC("Finalizing method");
switch (mKind)
{
case KIND_SLOT:
@@ -133,36 +132,48 @@
return false;
}
// The name has been validated in read.
- if (mHasValue)
- pMethod->addValue(mName, mNamespace, mSlotId, pType,
- mValue, mKind == KIND_CONST);
- else
- pMethod->addSlot(mName, mNamespace, mSlotId, pType);
+ // TODO: Find a better way to initialize trait values.
+ if (!mHasValue){
+ mValue = as_value(0);
+ }
+ LOG_DEBUG_ABC("Adding property=%s with value=%s
slot=%u",pBlock->mStringPool[mName],mValue.toDebugString(),mSlotId);
+ pMethod->addValue(mGlobalName, mNamespace, mSlotId, pType,
+ mValue, mKind == KIND_CONST);
break;
}
case KIND_METHOD:
{
+ LOG_DEBUG_ABC("Finalize method trait not implemented.
Returning");
+ break;
pMethod->addMethod(mName, mNamespace, mMethod);
break;
}
case KIND_GETTER:
{
+ LOG_DEBUG_ABC("Finalize getter trait not implemented.
Returning");
+ break;
pMethod->addGetter(mName, mNamespace, mMethod);
break;
}
case KIND_SETTER:
{
+ LOG_DEBUG_ABC("Finalize setter trait not implemented.
Returning");
+ break;
pMethod->addSetter(mName, mNamespace, mMethod);
break;
}
case KIND_CLASS:
{
+ LOG_DEBUG_ABC("Finalize class trait not implemented.
Returning");
+ break;
pMethod->addMemberClass(mName, mNamespace, mSlotId,
pBlock->mClasses[mClassInfoIndex]);
break;
}
case KIND_FUNCTION:
{
+ LOG_DEBUG_ABC("Finalize function trait not implemented.
Returning");
+ break;
pMethod->addSlotFunction(mName, mNamespace, mSlotId, mMethod);
break;
}
=== modified file 'libcore/swf/DoABCTag.h'
--- a/libcore/swf/DoABCTag.h 2008-09-17 03:06:58 +0000
+++ b/libcore/swf/DoABCTag.h 2008-09-28 13:23:03 +0000
@@ -55,10 +55,21 @@
virtual void execute(sprite_instance* m, DisplayList& /* dlist */) const
{
+ VM& vm = VM::get();
+ log_debug("getting machine.");
+ Machine *mach = vm.getMachine();
+ as_object* global = vm.getGlobal();
+
std::vector<asClass*>::iterator ci = mABC->mClasses.begin();
for(; ci != mABC->mClasses.end(); ++ci){
(*ci)->initPrototype();
}
+
+ std::vector<asMethod*>::iterator mi = mABC->mMethods.begin();
+ for(; mi != mABC->mMethods.end(); ++mi){
+ (*mi)->initPrototype(mach);
+ }
+
std::vector<abc_Trait*>::iterator i = mABC->mTraits.begin();
for ( ; i != mABC->mTraits.end(); ++i)
@@ -67,10 +78,6 @@
}
mABC->mTraits.clear();
log_debug("Begin execute abc_block.");
- VM& vm = VM::get();
- log_debug("getting machine.");
- Machine *mach = vm.getMachine();
- as_object* global = vm.getGlobal();
// log_debug("Getting entry script.");
// asClass* start_script = a.mScripts.back();
// log_debug("Getting constructor.");
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2008-09-28 06:37:27 +0000
+++ b/libcore/vm/Machine.cpp 2008-09-28 13:23:03 +0000
@@ -1020,7 +1020,7 @@
boost::int32_t method_index = mStream->read_V32();
LOG_DEBUG_AVM("Creating new abc_function: method
index=%u",method_index);
asMethod *m = pool_method(method_index, mPoolObject);
- push_stack(as_value(new abc_function(m,this)));
+ push_stack(as_value(m->getPrototype()));
break;
}
/// 0x41 ABC_ACTION_CALL
@@ -1383,8 +1383,8 @@
new_class->set_prototype(base_class);
//Create the class.
- abc_function* static_constructor = new
abc_function(c->getStaticConstructor(),this);
- abc_function* constructor = new
abc_function(c->getConstructor(),this);
+ as_function* static_constructor =
c->getStaticConstructor()->getPrototype();
+ as_function* constructor = c->getConstructor()->getPrototype();
new_class->init_member(NSV::PROP_uuCONSTRUCTORuu,as_value(static_constructor),0);
new_class->init_member(NSV::PROP_CONSTRUCTOR,as_value(constructor),0);
push_stack(as_value(new_class));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/avm2 r9573: Begin implementing abc_block::finalize_mbody.,
Tom Stellard <=