Permalink
Browse files

Pre perf testinPre perf testingg

  • Loading branch information...
1 parent 4bd29f8 commit 41c6f5c86bf803750d6bf641b83ac4c3823a4d5e @alexp-sssup alexp-sssup committed Nov 22, 2009
Showing with 21 additions and 24 deletions.
  1. +2 −3 abc_opcodes.cpp
  2. +8 −7 swftypes.cpp
  3. +11 −14 swftypes.h
View
5 abc_opcodes.cpp
@@ -1382,7 +1382,7 @@ void ABCVm::callSuper(call_context* th, int n, int m)
LOG(NOT_IMPLEMENTED,"Calling an undefined function");
th->runtime_stack_push(new Undefined);
}
- LOG(CALLS,"End of calling " << *name);
+ LOG(CALLS,"End of callSuper " << *name);
//Reset prototype to its previous value
assert(obj->actualPrototype==old_prototype->super);
@@ -1403,7 +1403,6 @@ void ABCVm::callSuperVoid(call_context* th, int n, int m)
ASObject* obj=th->runtime_stack_pop();
- cout << "super name " << obj->actualPrototype->super->class_name << endl;
//HACK (nice) set the max level to the current actual prototype before looking up the member
assert(obj->actualPrototype);
int oldlevel=obj->max_level;
@@ -1463,7 +1462,7 @@ void ABCVm::callSuperVoid(call_context* th, int n, int m)
{
LOG(NOT_IMPLEMENTED,"Calling an undefined function");
}
- LOG(CALLS,"End of calling " << *name);
+ LOG(CALLS,"End of callSuperVoid " << *name);
//Reset prototype to its previous value
assert(obj->actualPrototype==old_prototype->super);
View
15 swftypes.cpp
@@ -439,13 +439,13 @@ void ASObject::setVariableByQName(const tiny_string& name, const tiny_string& ns
obj_var* variables_map::findObjVar(const multiname& mname, int level, bool create, bool exact)
{
- tiny_string name;
+ nameAndLevel name("",level);
if(mname.name_type==multiname::NAME_INT)
- name=tiny_string(mname.name_i);
+ name.name=tiny_string(mname.name_i);
else if(mname.name_type==multiname::NAME_STRING)
- name=mname.name_s;
+ name.name=mname.name_s;
- pair<var_iterator, var_iterator> ret=Variables.equal_range(nameAndLevel(name,level));
+ pair<var_iterator, var_iterator> ret=Variables.equal_range(name);
if(ret.first!=ret.second)
{
//Check if one the namespace is already present
@@ -465,7 +465,8 @@ obj_var* variables_map::findObjVar(const multiname& mname, int level, bool creat
//return the first
if(!exact)
{
- LOG(NOT_IMPLEMENTED,"Overriding or other weird condition on [multinam]::" << name << ". Found on " << ret.first->second.first);
+ LOG(NOT_IMPLEMENTED,"Overriding or other weird condition on [multinam]::" << name.name << ". Found on " <<
+ ret.first->second.first);
return &ret.first->second.second;
}
}
@@ -478,10 +479,10 @@ obj_var* variables_map::findObjVar(const multiname& mname, int level, bool creat
{
//Hack, insert with empty name
//Here the object MUST exist
- var_iterator inserted=Variables.insert(ret.first,make_pair(nameAndLevel(name,level), make_pair("", obj_var() ) ) );
+ var_iterator inserted=Variables.insert(ret.first,make_pair(name, make_pair("", obj_var() ) ) );
return &inserted->second.second;
}
- var_iterator inserted=Variables.insert(ret.first,make_pair(nameAndLevel(name,level), make_pair(mname.ns[0], obj_var() ) ) );
+ var_iterator inserted=Variables.insert(ret.first,make_pair(name, make_pair(mname.ns[0], obj_var() ) ) );
return &inserted->second.second;
}
else
View
25 swftypes.h
@@ -55,12 +55,12 @@ class tiny_string
{
friend std::ostream& operator<<(std::ostream& s, const tiny_string& r);
private:
- char buf[1024];
+ char buf[512];
public:
tiny_string(){buf[0]=0;}
tiny_string(const char* s)
{
- if(strlen(s)>1023)
+ if(strlen(s)>511)
abort();
strcpy(buf,s);
}
@@ -70,39 +70,39 @@ friend std::ostream& operator<<(std::ostream& s, const tiny_string& r);
}
tiny_string& operator=(const std::string& s)
{
- strncpy(buf,s.c_str(),1023);
+ strncpy(buf,s.c_str(),512);
return *this;
}
tiny_string& operator=(const char* s)
{
- strncpy(buf,s,1023);
+ strncpy(buf,s,512);
return *this;
}
tiny_string& operator+=(const char* s)
{
- strncat(buf,s,1023-strlen(buf));
+ strncat(buf,s,511-strlen(buf));
return *this;
}
tiny_string& operator+=(const tiny_string& r)
{
- strncat(buf,r.buf,1023-strlen(buf));
+ strncat(buf,r.buf,511-strlen(buf));
return *this;
}
bool operator<(const tiny_string& r) const
{
- return strncmp(buf,r.buf,1024)<0;
+ return strncmp(buf,r.buf,512)<0;
}
bool operator==(const tiny_string& r) const
{
- return strncmp(buf,r.buf,1024)==0;
+ return strncmp(buf,r.buf,512)==0;
}
bool operator!=(const tiny_string& r) const
{
- return strncmp(buf,r.buf,1024)!=0;
+ return strncmp(buf,r.buf,512)!=0;
}
bool operator==(const char* r) const
{
- return strncmp(buf,r,1024)==0;
+ return strncmp(buf,r,512)==0;
}
const char* raw_buf() const
{
@@ -247,6 +247,7 @@ class nameAndLevel
public:
tiny_string name;
int level;
+ nameAndLevel(const char* s, int l):name(s),level(l){}
nameAndLevel(const tiny_string& n, int l):name(n),level(l){}
bool operator<(const nameAndLevel& r) const
{
@@ -320,14 +321,10 @@ friend class SystemState;
void incRef()
{
ref_count++;
- if(ref_count>20000)
- abort();
}
void decRef()
{
assert(ref_count>0);
- if(ref_count>20000)
- abort();
ref_count--;
if(ref_count==0)
{

0 comments on commit 41c6f5c

Please sign in to comment.