[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/avm2 r9539: Pass an asMethod object to ini
From: |
Tom Stellard |
Subject: |
[Gnash-commit] /srv/bzr/gnash/avm2 r9539: Pass an asMethod object to initialize abc_function. |
Date: |
Sun, 31 Aug 2008 08:41:54 +0800 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9539
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Sun 2008-08-31 08:41:54 +0800
message:
Pass an asMethod object to initialize abc_function.
modified:
libcore/abc_function.cpp
libcore/abc_function.h
libcore/asClass.cpp
libcore/asClass.h
libcore/parser/abc_block.cpp
libcore/vm/Machine.cpp
=== modified file 'libcore/abc_function.cpp'
--- a/libcore/abc_function.cpp 2008-08-22 09:51:45 +0000
+++ b/libcore/abc_function.cpp 2008-08-31 00:41:54 +0000
@@ -17,13 +17,13 @@
#include "log.h"
#include "abc_function.h"
+#include "asClass.h"
#include "fn_call.h"
namespace gnash{
-//TODO: Should we create a new machine for each abc_function.
-abc_function::abc_function(CodeStream* stream, Machine* machine):as_function(){
- mStream = stream;
+abc_function::abc_function(asMethod *methodInfo, Machine*
machine):as_function(){
+ mMethodInfo = methodInfo;
mMachine = machine;
}
@@ -31,8 +31,10 @@
as_value
abc_function::operator()(const fn_call& fn)
{
- log_debug("Calling an abc_function.");
- return mMachine->executeFunction(mStream,fn);
+ log_debug("Calling an abc_function id=%u.",mMethodInfo->mMethodID);
+ as_value val = mMachine->executeFunction(mMethodInfo->getBody(),fn);
+ log_debug("Done calling abc_function id=%u
value=%s",mMethodInfo->mMethodID,val.toDebugString());
+ return val;
}
=== modified file 'libcore/abc_function.h'
--- a/libcore/abc_function.h 2008-08-19 03:29:32 +0000
+++ b/libcore/abc_function.h 2008-08-31 00:41:54 +0000
@@ -24,6 +24,7 @@
#include "as_function.h"
#include "as_value.h"
+#include "asClass.h"
#include "CodeStream.h"
#include "Machine.h"
@@ -34,11 +35,11 @@
{
private:
- CodeStream* mStream;
+ asMethod *mMethodInfo;
Machine* mMachine;
public:
- abc_function(CodeStream* stream, Machine* mMachine);
+ abc_function(asMethod *methodInfo, Machine* mMachine);
as_value operator()(const fn_call& fn);
=== modified file 'libcore/asClass.cpp'
--- a/libcore/asClass.cpp 2008-08-22 09:42:25 +0000
+++ b/libcore/asClass.cpp 2008-08-31 00:41:54 +0000
@@ -169,7 +169,7 @@
bool isstatic)
{
log_debug("in add method");
- as_value val = as_value(new
abc_function(method->getBody(),mPrototype->getVM().getMachine()));
+ as_value val = as_value(new
abc_function(method,mPrototype->getVM().getMachine()));
mPrototype->init_member(name, val);
// int flags = as_prop_flags::readOnly | as_prop_flags::dontDelete
// | as_prop_flags::dontEnum;
=== modified file 'libcore/asClass.h'
--- a/libcore/asClass.h 2008-08-22 03:07:31 +0000
+++ b/libcore/asClass.h 2008-08-31 00:41:54 +0000
@@ -356,6 +356,8 @@
public:
+ boost::uint32_t mMethodID;
+
boost::uint32_t getBodyLength(){ return mBodyLength;}
void setBodyLength(boost::uint32_t length){ mBodyLength = length;}
=== modified file 'libcore/parser/abc_block.cpp'
--- a/libcore/parser/abc_block.cpp 2008-08-29 12:11:17 +0000
+++ b/libcore/parser/abc_block.cpp 2008-08-31 00:41:54 +0000
@@ -704,6 +704,7 @@
{
log_debug(" Reading method %u",i);
asMethod *pMethod = mCH->newMethod();
+ pMethod->mMethodID = i;
// log_debug("Min arg count: %d max:
%d",pMethod->minArgumentCount(),pMethod->maxArgumentCount());
mMethods[i] = pMethod;
boost::uint32_t param_count = mS->read_V32();
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2008-08-30 13:40:38 +0000
+++ b/libcore/vm/Machine.cpp 2008-08-31 00:41:54 +0000
@@ -1019,7 +1019,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->getBody(),this)));
+ push_stack(as_value(new abc_function(m,this)));
break;
}
/// 0x41 ABC_ACTION_CALL
@@ -1377,8 +1377,8 @@
as_object* base_class = pop_stack().to_object().get();
as_object* new_class = c->getPrototype();
//Create the class.
- abc_function* static_constructor = new
abc_function(c->getStaticConstructor()->getBody(),this);
- abc_function* constructor = new
abc_function(c->getConstructor()->getBody(),this);
+ abc_function* static_constructor = new
abc_function(c->getStaticConstructor(),this);
+ abc_function* constructor = new
abc_function(c->getConstructor(),this);
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 r9539: Pass an asMethod object to initialize abc_function.,
Tom Stellard <=