Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 108
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20160529.1025 +Version: 0.7.2.99+git20160604.1811 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -249,9 +249,7 @@ if (r->is<ObjectConstructor>()) return this == r->getClass(); - LOG(LOG_CALLS,_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType()); - if(classdef) - LOG(LOG_CALLS,_("Type ") << classdef->class_name); + LOG_CALL(_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType()); return false; } @@ -526,6 +524,8 @@ { assert(this->is<Class_base>()); obj=this->as<Class_base>()->borrowedVariables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT); + if (!this->is<Class_inherit>()) + o->setConstant(); } else obj=Variables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT); @@ -676,7 +676,7 @@ if(obj->setter) { //Call the setter - LOG(LOG_CALLS,_("Calling the setter")); + LOG_CALL(_("Calling the setter")); //Overriding function is automatically done by using cur_level IFunction* setter=obj->setter; //One argument can be passed without creating an array @@ -684,7 +684,7 @@ target->incRef(); _R<ASObject> ret= _MR( setter->call(target,&o,1) ); assert_and_throw(ret->is<Undefined>()); - LOG(LOG_CALLS,_("End of setter")); + LOG_CALL(_("End of setter")); } else { @@ -885,7 +885,7 @@ if (type == Type::anyType) { // type could not be found, so it's stored as an uninitialized variable - LOG(LOG_CALLS,"add uninitialized var:"<<mname<<" "<<*typemname); + LOG_CALL("add uninitialized var:"<<mname<<" "<<*typemname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; @@ -909,7 +909,7 @@ //if (!((Class_base*)type)->super) { // super type could not be found, so the class is stored as an uninitialized variable - LOG(LOG_CALLS,"add uninitialized class var:"<<mname); + LOG_CALL("add uninitialized class var:"<<mname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; @@ -942,7 +942,7 @@ //By default we assume it's a passthrough cast if(argslen==1) { - LOG(LOG_CALLS,_("Passthrough of ") << args[0]); + LOG_CALL(_("Passthrough of ") << args[0]); args[0]->incRef(); return args[0]; } @@ -1184,16 +1184,16 @@ ASObject* target=this; if(target->classdef) { - LOG(LOG_CALLS,_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name); + LOG_CALL(_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name); } else { - LOG(LOG_CALLS,_("Calling the getter")<< " for "<<name); + LOG_CALL(_("Calling the getter")<< " for "<<name); } IFunction* getter=obj->getter; target->incRef(); ASObject* ret=getter->call(target,NULL,0); - LOG(LOG_CALLS,_("End of getter")); + LOG_CALL(_("End of getter")); // No incRef because ret is a new instance return _MNR(ret); } @@ -1203,7 +1203,7 @@ assert_and_throw(obj->var); if(obj->var->getObjectType()==T_FUNCTION && obj->var->as<IFunction>()->isMethod()) { - LOG(LOG_CALLS,"Attaching this " << this << " to function " << name); + LOG_CALL("Attaching this " << this << " to function " << name); //the obj reference is acquired by the smart reference this->incRef(); IFunction* f=obj->var->as<IFunction>()->bind(_MR(this),-1); @@ -1337,10 +1337,9 @@ } } -ASObject::ASObject(Class_base* c):Variables((c)?c->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(c?c->sys:NULL), - type(T_OBJECT),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) +ASObject::ASObject(Class_base* c,SWFOBJECT_TYPE t):Variables((c)?c->memoryAccount:NULL),classdef(c),proxyMultiName(NULL),sys(c?c->sys:NULL), + type(t),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) { - setClass(c); #ifndef NDEBUG //Stuff only used in debugging initialized=false; @@ -1350,43 +1349,20 @@ ASObject::ASObject(const ASObject& o):Variables((o.classdef)?o.classdef->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(o.classdef? o.classdef->sys : NULL), type(o.type),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) { - if(o.classdef) - setClass(o.classdef); - #ifndef NDEBUG //Stuff only used in debugging initialized=false; #endif - - assert_and_throw(o.Variables.size()==0); + assert(o.Variables.size()==0); } void ASObject::setClass(Class_base* c) { if (classdef == c) return; - if(classdef) - { - classdef->abandonObject(this); - classdef->decRef(); - } classdef=c; - if(classdef) - { - classdef->acquireObject(this); - classdef->incRef(); + if(c) this->sys = c->sys; - } -} - -void ASObject::destroy() -{ - if(classdef) - { - classdef->abandonObject(this); - classdef->decRef(); - classdef=NULL; - } } bool ASObject::destruct() @@ -1479,11 +1455,11 @@ if(obj->getter) { //Call the getter - LOG(LOG_CALLS,_("Calling the getter")); + LOG_CALL(_("Calling the getter")); IFunction* getter=obj->getter; incRef(); _R<ASObject> ret(getter->call(this,NULL,0)); - LOG(LOG_CALLS,_("End of getter")); + LOG_CALL(_("End of getter")); return ret; } else
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -406,9 +406,10 @@ */ bool destruct(); // called when object is really destroyed - virtual void destroy(); + virtual void destroy(){} public: - ASObject(Class_base* c); + ASObject(Class_base* c,SWFOBJECT_TYPE t = T_OBJECT); + #ifndef NDEBUG //Stuff only used in debugging bool initialized:1;
View file
lightspark.tar.xz/src/backends/decoder.cpp
Changed
@@ -869,7 +869,7 @@ if(ret<0) return; - LOG(LOG_CALLS,_("FFMpeg found ") << formatCtx->nb_streams << _(" streams")); + LOG_CALL(_("FFMpeg found ") << formatCtx->nb_streams << _(" streams")); for(uint32_t i=0;i<formatCtx->nb_streams;i++) { if(formatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO && videoFound==false)
View file
lightspark.tar.xz/src/backends/graphics.cpp
Changed
@@ -118,7 +118,7 @@ if(w>allocWidth || h>allocHeight) //Destination texture should be reallocated { glBindTexture(GL_TEXTURE_2D,texId); - LOG(LOG_CALLS,_("Reallocating texture to size ") << w << 'x' << h); + LOG_CALL(_("Reallocating texture to size ") << w << 'x' << h); setAllocSize(w,h); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, allocWidth, allocHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); if(GLRenderContext::handleGLErrors())
View file
lightspark.tar.xz/src/logger.h
Changed
@@ -28,6 +28,21 @@ enum LOG_LEVEL { LOG_ERROR=0, LOG_INFO=1, LOG_NOT_IMPLEMENTED=2,LOG_CALLS=3,LOG_TRACE=4}; +// LOG_CALL will only generate output in DEBUG builds +// this is done because the LOG(LOG_CALLS...) macro creates measurable perfomance loss +// when used inside the ABCVm::executeFunction loop even on lower log levels +#ifndef NDEBUG +#define LOG_CALL(esp) \ +do { \ + if(LOG_CALLS<=Log::getLevel()) \ + { \ + Log l(level); \ + l() << esp << std::endl; \ + } \ +} while(0) +#else +#define LOG_CALL(esp) +#endif #define LOG(level,esp) \ do { \ if(level<=Log::getLevel()) \
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -1009,10 +1009,10 @@ #endif /* - * nextNamespaceBase is set to 1 since 0 is the empty namespace + * nextNamespaceBase is set to 2 since 0 is the empty namespace and 1 is the AS3 namespace */ ABCVm::ABCVm(SystemState* s, MemoryAccount* m):m_sys(s),status(CREATED),shuttingdown(false), - events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(1),currentCallContext(NULL), + events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(2),currentCallContext(NULL), vmDataMemory(m),cur_recursion(0) { limits.max_recursion = 256;
View file
lightspark.tar.xz/src/scripting/abc_fast_interpreter.cpp
Changed
@@ -78,7 +78,7 @@ case 0x01: { //bkpt - LOG(LOG_CALLS, _("bkpt") ); + LOG_CALL( _("bkpt") ); break; } case 0x02: @@ -124,7 +124,7 @@ { //kill uint32_t t=data->uints[0]; - LOG(LOG_CALLS, "kill " << t); + LOG_CALL( "kill " << t); instructionPointer+=4; assert_and_throw(context->locals[t]); context->locals[t]->decRef(); @@ -363,7 +363,7 @@ { //lookupswitch uint32_t defaultdest=data->uints[0]; - LOG(LOG_CALLS,_("Switch default dest ") << defaultdest); + LOG_CALL(_("Switch default dest ") << defaultdest); uint32_t count=data->uints[1]; ASObject* index_obj=context->runtime_stack_pop(); @@ -553,70 +553,70 @@ case 0x35: { //li8 - LOG(LOG_CALLS, "li8"); + LOG_CALL( "li8"); loadIntN<uint8_t>(context); break; } case 0x36: { //li16 - LOG(LOG_CALLS, "li16"); + LOG_CALL( "li16"); loadIntN<uint16_t>(context); break; } case 0x37: { //li32 - LOG(LOG_CALLS, "li32"); + LOG_CALL( "li32"); loadIntN<uint32_t>(context); break; } case 0x38: { //lf32 - LOG(LOG_CALLS, "lf32"); + LOG_CALL( "lf32"); loadFloat(context); break; } case 0x39: { //lf32 - LOG(LOG_CALLS, "lf64"); + LOG_CALL( "lf64"); loadDouble(context); break; } case 0x3a: { //si8 - LOG(LOG_CALLS, "si8"); + LOG_CALL( "si8"); storeIntN<uint8_t>(context); break; } case 0x3b: { //si16 - LOG(LOG_CALLS, "si16"); + LOG_CALL( "si16"); storeIntN<uint16_t>(context); break; } case 0x3c: { //si32 - LOG(LOG_CALLS, "si32"); + LOG_CALL( "si32"); storeIntN<uint32_t>(context); break; } case 0x3d: { //sf32 - LOG(LOG_CALLS, "sf32"); + LOG_CALL( "sf32"); storeFloat(context); break; } case 0x3e: { //sf32 - LOG(LOG_CALLS, "sf64"); + LOG_CALL( "sf64"); storeDouble(context); break; } @@ -696,7 +696,7 @@ case 0x47: { //returnvoid - LOG(LOG_CALLS,_("returnVoid")); + LOG_CALL(_("returnVoid")); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return NULL; } @@ -704,7 +704,7 @@ { //returnvalue ASObject* ret=context->runtime_stack_pop(); - LOG(LOG_CALLS,_("returnValue ") << ret); + LOG_CALL(_("returnValue ") << ret); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return ret; } @@ -757,7 +757,7 @@ case 0x50: { //sxi1 - LOG(LOG_CALLS, "sxi1"); + LOG_CALL( "sxi1"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=arg1->toUInt() & 0x1; arg1->decRef(); @@ -767,7 +767,7 @@ case 0x51: { //sxi8 - LOG(LOG_CALLS, "sxi8"); + LOG_CALL( "sxi8"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int8_t)arg1->toUInt(); arg1->decRef(); @@ -777,7 +777,7 @@ case 0x52: { //sxi16 - LOG(LOG_CALLS, "sxi16"); + LOG_CALL( "sxi16"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int16_t)arg1->toUInt(); arg1->decRef(); @@ -893,12 +893,12 @@ instructionPointer+=4; if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } context->locals[i]->incRef(); - LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); + LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); context->runtime_stack_push(context->locals[i]); break; } @@ -907,7 +907,7 @@ //setlocal uint32_t i=data->uints[0]; instructionPointer+=4; - LOG(LOG_CALLS, _("setLocal ") << i ); + LOG_CALL( _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); if ((int)i != context->argarrayposition || obj->is<Array>()) @@ -1126,7 +1126,7 @@ rewriteableCode[instructionPointer-1]=0xfc; rewritableData->types[0]=type; - LOG(LOG_CALLS,"coerceOnce " << *name); + LOG_CALL("coerceOnce " << *name); ASObject* o=context->runtime_stack_pop(); o=type->coerce(o); @@ -1274,7 +1274,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("subtractI ") << num1 << '-' << num2); + LOG_CALL(_("subtractI ") << num1 << '-' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1-num2); @@ -1297,7 +1297,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("multiplyI ") << num1 << '*' << num2); + LOG_CALL(_("multiplyI ") << num1 << '*' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1*num2); @@ -1330,7 +1330,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("moduloI ") << num1 << '%' << num2); + LOG_CALL(_("moduloI ") << num1 << '%' << num2); v1->decRef(); v2->decRef(); if (num2 == 0) @@ -1584,11 +1584,11 @@ int i=opcode&3; if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } - LOG(LOG_CALLS, "getLocal " << i << ": " << context->locals[i]->toDebugString() ); + LOG_CALL( "getLocal " << i << ": " << context->locals[i]->toDebugString() ); context->locals[i]->incRef(); context->runtime_stack_push(context->locals[i]); break; @@ -1600,7 +1600,7 @@ { //setlocal_n int i=opcode&3; - LOG(LOG_CALLS, "setLocal " << i ); + LOG_CALL( "setLocal " << i ); ASObject* obj=context->runtime_stack_pop(); if ((int)i != context->argarrayposition || obj->is<Array>()) { @@ -1613,14 +1613,14 @@ case 0xf2: { //bkptline - LOG(LOG_CALLS, _("bkptline") ); + LOG_CALL( _("bkptline") ); instructionPointer+=4; break; } case 0xf3: { //timestamp - LOG(LOG_CALLS, _("timestamp") ); + LOG_CALL( _("timestamp") ); instructionPointer+=4; break; } @@ -1634,7 +1634,7 @@ ASObject* value=context->runtime_stack_pop(); ASObject* obj=context->runtime_stack_pop(); - LOG(LOG_CALLS,"setSlotNoCoerce " << t); + LOG_CALL("setSlotNoCoerce " << t); obj->setSlotNoCoerce(t,value); obj->decRef(); break; @@ -1643,7 +1643,7 @@ { //coerceearly const Type* type = data->types[0]; - LOG(LOG_CALLS,"coerceEarly " << type); + LOG_CALL("coerceEarly " << type); ASObject* o=context->runtime_stack_pop(); o=type->coerce(o); @@ -1658,7 +1658,7 @@ //This opcode is similar to getscopeobject, but it allows access to any //index of the scope stack uint32_t t=data->uints[0]; - LOG(LOG_CALLS, "getScopeAtIndex " << t); + LOG_CALL( "getScopeAtIndex " << t); ASObject* obj; uint32_t parentsize = context->parent_scope_stack.isNull() ? 0 :context->parent_scope_stack->scope.size(); if (!context->parent_scope_stack.isNull() && t<parentsize) @@ -1679,7 +1679,7 @@ //This opcode execute a lookup on the application domain //and rewrites itself to a pushearly const multiname* name=data->names[0]; - LOG(LOG_CALLS, "getLexOnce " << *name); + LOG_CALL( "getLexOnce " << *name); ASObject* target; ASObject* obj=ABCVm::getCurrentApplicationDomain(context)->getVariableAndTargetByMultiname(*name,target); //The object must exists, since it was found during optimization @@ -1701,7 +1701,7 @@ //pushearly ASObject* o=data->objs[0]; instructionPointer+=8; - LOG(LOG_CALLS, "pushEarly " << o); + LOG_CALL( "pushEarly " << o); o->incRef(); context->runtime_stack_push(o); break;
View file
lightspark.tar.xz/src/scripting/abc_interpreter.cpp
Changed
@@ -74,7 +74,7 @@ case 0x01: { //bkpt - LOG(LOG_CALLS, _("bkpt") ); + LOG_CALL( _("bkpt") ); break; } case 0x02: @@ -120,7 +120,7 @@ { //kill uint32_t t = code.readu30(); - LOG(LOG_CALLS, "kill " << t); + LOG_CALL( "kill " << t); assert_and_throw(context->locals[t]); context->locals[t]->decRef(); context->locals[t]=function->getSystemState()->getUndefinedRef(); @@ -425,13 +425,13 @@ int here=int(code.tellg())-1; //Base for the jumps is the instruction itself for the switch int32_t t = code.reads24(); int defaultdest=here+t; - LOG(LOG_CALLS,_("Switch default dest ") << defaultdest); + LOG_CALL(_("Switch default dest ") << defaultdest); uint32_t count = code.readu30(); int32_t* offsets=g_newa(int32_t, count+1); for(unsigned int i=0;i<count+1;i++) { offsets[i] = code.reads24(); - LOG(LOG_CALLS,_("Switch dest ") << i << ' ' << offsets[i]); + LOG_CALL(_("Switch dest ") << i << ' ' << offsets[i]); } ASObject* index_obj=context->runtime_stack_pop(); @@ -679,70 +679,70 @@ case 0x35: { //li8 - LOG(LOG_CALLS, "li8"); + LOG_CALL( "li8"); loadIntN<uint8_t>(context); break; } case 0x36: { //li16 - LOG(LOG_CALLS, "li16"); + LOG_CALL( "li16"); loadIntN<uint16_t>(context); break; } case 0x37: { //li32 - LOG(LOG_CALLS, "li32"); + LOG_CALL( "li32"); loadIntN<uint32_t>(context); break; } case 0x38: { //lf32 - LOG(LOG_CALLS, "lf32"); + LOG_CALL( "lf32"); loadFloat(context); break; } case 0x39: { //lf32 - LOG(LOG_CALLS, "lf64"); + LOG_CALL( "lf64"); loadDouble(context); break; } case 0x3a: { //si8 - LOG(LOG_CALLS, "si8"); + LOG_CALL( "si8"); storeIntN<uint8_t>(context); break; } case 0x3b: { //si16 - LOG(LOG_CALLS, "si16"); + LOG_CALL( "si16"); storeIntN<uint16_t>(context); break; } case 0x3c: { //si32 - LOG(LOG_CALLS, "si32"); + LOG_CALL( "si32"); storeIntN<uint32_t>(context); break; } case 0x3d: { //sf32 - LOG(LOG_CALLS, "sf32"); + LOG_CALL( "sf32"); storeFloat(context); break; } case 0x3e: { //sf32 - LOG(LOG_CALLS, "sf64"); + LOG_CALL( "sf64"); storeDouble(context); break; } @@ -819,7 +819,7 @@ case 0x47: { //returnvoid - LOG(LOG_CALLS,_("returnVoid")); + LOG_CALL(_("returnVoid")); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return NULL; } @@ -827,7 +827,7 @@ { //returnvalue ASObject* ret=context->runtime_stack_pop(); - LOG(LOG_CALLS,_("returnValue ") << ret); + LOG_CALL(_("returnValue ") << ret); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return ret; } @@ -877,7 +877,7 @@ case 0x50: { //sxi1 - LOG(LOG_CALLS, "sxi1"); + LOG_CALL( "sxi1"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=arg1->toUInt() >>31; arg1->decRef(); @@ -887,7 +887,7 @@ case 0x51: { //sxi8 - LOG(LOG_CALLS, "sxi8"); + LOG_CALL( "sxi8"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int8_t)arg1->toUInt(); arg1->decRef(); @@ -897,7 +897,7 @@ case 0x52: { //sxi16 - LOG(LOG_CALLS, "sxi16"); + LOG_CALL( "sxi16"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int16_t)arg1->toUInt(); arg1->decRef(); @@ -1007,12 +1007,12 @@ uint32_t i = code.readu30(); if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } context->locals[i]->incRef(); - LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); + LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); context->runtime_stack_push(context->locals[i]); break; } @@ -1020,7 +1020,7 @@ { //setlocal uint32_t i = code.readu30(); - LOG(LOG_CALLS, _("setLocal ") << i ); + LOG_CALL( _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); if ((int)i != context->argarrayposition || obj->is<Array>()) @@ -1363,7 +1363,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("subtractI ") << num1 << '-' << num2); + LOG_CALL(_("subtractI ") << num1 << '-' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1-num2); @@ -1386,7 +1386,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("multiplyI ") << num1 << '*' << num2); + LOG_CALL(_("multiplyI ") << num1 << '*' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1*num2); @@ -1419,7 +1419,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("moduloI ") << num1 << '%' << num2); + LOG_CALL(_("moduloI ") << num1 << '%' << num2); v1->decRef(); v2->decRef(); if (num2 == 0) @@ -1670,11 +1670,11 @@ int i=opcode&3; if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } - LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); + LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); context->locals[i]->incRef(); context->runtime_stack_push(context->locals[i]); break; @@ -1686,7 +1686,7 @@ { //setlocal_n int i=opcode&3; - LOG(LOG_CALLS, _("setLocal ") << i); + LOG_CALL( _("setLocal ") << i); ASObject* obj=context->runtime_stack_pop(); if ((int)i != context->argarrayposition || obj->is<Array>()) { @@ -1699,7 +1699,7 @@ case 0xef: { //debug - LOG(LOG_CALLS, _("debug") ); + LOG_CALL( _("debug") ); code.readbyte(); code.readu30(); code.readbyte(); @@ -1709,28 +1709,28 @@ case 0xf0: { //debugline - LOG(LOG_CALLS, _("debugline") ); + LOG_CALL( _("debugline") ); code.readu30(); break; } case 0xf1: { //debugfile - LOG(LOG_CALLS, _("debugfile") ); + LOG_CALL( _("debugfile") ); code.readu30(); break; } case 0xf2: { //bkptline - LOG(LOG_CALLS, _("bkptline") ); + LOG_CALL( _("bkptline") ); code.readu30(); break; } case 0xf3: { //timestamp - LOG(LOG_CALLS, _("timestamp") ); + LOG_CALL( _("timestamp") ); break; } default:
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -38,7 +38,7 @@ int32_t i2=val2->toInt(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec); + LOG_CALL(_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec); return i1&i2; } @@ -47,13 +47,13 @@ int32_t i1=val1->toInt(); int32_t i2=val2; val1->decRef(); - LOG(LOG_CALLS,_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec); + LOG_CALL(_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec); return i1&i2; } void ABCVm::setProperty(ASObject* value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value); + LOG_CALL(_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value); if(obj->is<Null>()) { @@ -72,7 +72,7 @@ void ABCVm::setProperty_i(int32_t value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty_i ") << *name << ' ' <<obj); + LOG_CALL(_("setProperty_i ") << *name << ' ' <<obj); if(obj->is<Null>()) { LOG(LOG_ERROR,"calling setProperty_i on null:" << *name << ' ' << obj->toDebugString()<<" " << value); @@ -89,7 +89,7 @@ number_t ABCVm::convert_d(ASObject* o) { - LOG(LOG_CALLS, _("convert_d") ); + LOG_CALL( _("convert_d") ); number_t ret=o->toNumber(); o->decRef(); return ret; @@ -97,7 +97,7 @@ bool ABCVm::convert_b(ASObject* o) { - LOG(LOG_CALLS, _("convert_b") ); + LOG_CALL( _("convert_b") ); bool ret=Boolean_concrete(o); o->decRef(); return ret; @@ -105,7 +105,7 @@ uint32_t ABCVm::convert_u(ASObject* o) { - LOG(LOG_CALLS, _("convert_u") ); + LOG_CALL( _("convert_u") ); uint32_t ret=o->toUInt(); o->decRef(); return ret; @@ -113,7 +113,7 @@ int32_t ABCVm::convert_i(ASObject* o) { - LOG(LOG_CALLS, _("convert_i") ); + LOG_CALL( _("convert_i") ); int32_t ret=o->toInt(); o->decRef(); return ret; @@ -121,7 +121,7 @@ int64_t ABCVm::convert_di(ASObject* o) { - LOG(LOG_CALLS, _("convert_di") ); + LOG_CALL( _("convert_di") ); int64_t ret=o->toInt64(); o->decRef(); return ret; @@ -129,7 +129,7 @@ ASObject* ABCVm::convert_s(ASObject* o) { - LOG(LOG_CALLS, _("convert_s") ); + LOG_CALL( _("convert_s") ); ASObject* ret=o; if(o->getObjectType()!=T_STRING) { @@ -141,34 +141,34 @@ void ABCVm::label() { - LOG(LOG_CALLS, _("label") ); + LOG_CALL( _("label") ); } void ABCVm::lookupswitch() { - LOG(LOG_CALLS, _("lookupswitch") ); + LOG_CALL( _("lookupswitch") ); } ASObject* ABCVm::pushUndefined() { - LOG(LOG_CALLS, _("pushUndefined") ); + LOG_CALL( _("pushUndefined") ); return getSys()->getUndefinedRef(); } ASObject* ABCVm::pushNull() { - LOG(LOG_CALLS, _("pushNull") ); + LOG_CALL( _("pushNull") ); return getSys()->getNullRef(); } void ABCVm::coerce_a() { - LOG(LOG_CALLS, _("coerce_a") ); + LOG_CALL( _("coerce_a") ); } ASObject* ABCVm::checkfilter(ASObject* o) { - LOG(LOG_CALLS, _("checkfilter") ); + LOG_CALL( _("checkfilter") ); if (!o->is<XML>() && !o->is<XMLList>()) throwError<TypeError>(kFilterError, o->getClassName()); return o; @@ -182,7 +182,7 @@ void ABCVm::coerce(call_context* th, int n) { multiname* mn = th->context->getMultiname(n,NULL); - LOG(LOG_CALLS,"coerce " << *mn); + LOG_CALL("coerce " << *mn); const Type* type = Type::getTypeFromMultiname(mn, th->context); @@ -193,48 +193,48 @@ void ABCVm::pop() { - LOG(LOG_CALLS, _("pop: DONE") ); + LOG_CALL( _("pop: DONE") ); } void ABCVm::getLocal_int(int n, int v) { - LOG(LOG_CALLS,_("getLocal[") << n << _("] (int)= ") << dec << v); + LOG_CALL(_("getLocal[") << n << _("] (int)= ") << dec << v); } void ABCVm::getLocal(ASObject* o, int n) { - LOG(LOG_CALLS,_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString()); + LOG_CALL(_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString()); } void ABCVm::getLocal_short(int n) { - LOG(LOG_CALLS,_("getLocal[") << n << _("]")); + LOG_CALL(_("getLocal[") << n << _("]")); } void ABCVm::setLocal(int n) { - LOG(LOG_CALLS,_("setLocal[") << n << _("]")); + LOG_CALL(_("setLocal[") << n << _("]")); } void ABCVm::setLocal_int(int n, int v) { - LOG(LOG_CALLS,_("setLocal[") << n << _("] (int)= ") << dec << v); + LOG_CALL(_("setLocal[") << n << _("] (int)= ") << dec << v); } void ABCVm::setLocal_obj(int n, ASObject* v) { - LOG(LOG_CALLS,_("setLocal[") << n << _("] = ") << v->toDebugString()); + LOG_CALL(_("setLocal[") << n << _("] = ") << v->toDebugString()); } int32_t ABCVm::pushShort(intptr_t n) { - LOG(LOG_CALLS, _("pushShort ") << n ); + LOG_CALL( _("pushShort ") << n ); return n; } void ABCVm::setSlot(ASObject* value, ASObject* obj, int n) { - LOG(LOG_CALLS,"setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value); + LOG_CALL("setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value); obj->setSlot(n,value); obj->decRef(); } @@ -242,7 +242,7 @@ ASObject* ABCVm::getSlot(ASObject* obj, int n) { ASObject* ret=obj->getSlot(n); - LOG(LOG_CALLS,"getSlot " << n << " " << ret << "=" << ret->toDebugString()); + LOG_CALL("getSlot " << n << " " << ret << "=" << ret->toDebugString()); //getSlot can only access properties defined in the current //script, so they should already be defind by this script ret->incRef(); @@ -252,7 +252,7 @@ number_t ABCVm::negate(ASObject* v) { - LOG(LOG_CALLS, _("negate") ); + LOG_CALL( _("negate") ); number_t ret=-(v->toNumber()); v->decRef(); return ret; @@ -260,7 +260,7 @@ int32_t ABCVm::negate_i(ASObject* o) { - LOG(LOG_CALLS,_("negate_i")); + LOG_CALL(_("negate_i")); int n=o->toInt(); o->decRef(); @@ -271,7 +271,7 @@ { int32_t i1=val->toInt(); val->decRef(); - LOG(LOG_CALLS,_("bitNot ") << hex << i1 << dec); + LOG_CALL(_("bitNot ") << hex << i1 << dec); return ~i1; } @@ -281,7 +281,7 @@ int32_t i2=val2->toInt(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("bitXor ") << hex << i1 << '^' << i2 << dec); + LOG_CALL(_("bitXor ") << hex << i1 << '^' << i2 << dec); return i1^i2; } @@ -290,7 +290,7 @@ int32_t i1=val1; int32_t i2=val2->toInt(); val2->decRef(); - LOG(LOG_CALLS,_("bitOr ") << hex << i1 << '|' << i2 << dec); + LOG_CALL(_("bitOr ") << hex << i1 << '|' << i2 << dec); return i1|i2; } @@ -300,7 +300,7 @@ int32_t i2=val2->toInt(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("bitOr ") << hex << i1 << '|' << i2 << dec); + LOG_CALL(_("bitOr ") << hex << i1 << '|' << i2 << dec); return i1|i2; } @@ -311,7 +311,7 @@ args[m-i-1]=th->runtime_stack_pop(); multiname* name=th->context->getMultiname(n,th); - LOG(LOG_CALLS, (keepReturn ? "callProperty " : "callPropVoid") << *name << ' ' << m); + LOG_CALL( (keepReturn ? "callProperty " : "callPropVoid") << *name << ' ' << m); ASObject* obj=th->runtime_stack_pop(); checkDeclaredTraits(obj); @@ -379,7 +379,7 @@ proxyArgs[i+1]=args[i]; //We now suppress special handling - LOG(LOG_CALLS,_("Proxy::callProperty")); + LOG_CALL(_("Proxy::callProperty")); f->incRef(); obj->incRef(); ASObject* ret=f->call(obj,proxyArgs,m+1); @@ -394,14 +394,14 @@ obj->decRef(); } - LOG(LOG_CALLS,_("End of calling ") << *name); + LOG_CALL(_("End of calling ") << *name); return; } else if(!o.isNull()) { o->incRef(); callImpl(th, o.getPtr(), obj, args, m, called_mi, keepReturn); - LOG(LOG_CALLS,_("End of calling ") << *name); + LOG_CALL(_("End of calling ") << *name); return; } } @@ -438,7 +438,7 @@ th->runtime_stack_push(th->context->root->getSystemState()->getUndefinedRef()); } - LOG(LOG_CALLS,_("End of calling ") << *name); + LOG_CALL(_("End of calling ") << *name); } void ABCVm::checkDeclaredTraits(ASObject* obj) { @@ -455,7 +455,7 @@ int32_t ABCVm::getProperty_i(ASObject* obj, multiname* name) { - LOG(LOG_CALLS, _("getProperty_i ") << *name ); + LOG_CALL( _("getProperty_i ") << *name ); checkDeclaredTraits(obj); //TODO: implement exception handling to find out if no integer can be returned @@ -467,7 +467,7 @@ ASObject* ABCVm::getProperty(ASObject* obj, multiname* name) { - LOG(LOG_CALLS, _("getProperty ") << *name << ' ' << obj->toDebugString() << ' '<<obj->isInitialized()); + LOG_CALL( _("getProperty ") << *name << ' ' << obj->toDebugString() << ' '<<obj->isInitialized()); checkDeclaredTraits(obj); _NR<ASObject> prop=obj->getVariableByMultiname(*name); @@ -487,8 +487,8 @@ } else { - prop->incRef(); ret=prop.getPtr(); + ret->incRef(); } obj->decRef(); return ret; @@ -501,14 +501,14 @@ val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("divide ") << num1 << '/' << num2); + LOG_CALL(_("divide ") << num1 << '/' << num2); return num1/num2; } void ABCVm::pushWith(call_context* th) { ASObject* t=th->runtime_stack_pop(); - LOG(LOG_CALLS, _("pushWith ") << t ); + LOG_CALL( _("pushWith ") << t ); t->incRef(); assert_and_throw(th->curr_scope_stack < th->max_scope_stack); th->scope_stack[th->curr_scope_stack] = t; @@ -519,7 +519,7 @@ void ABCVm::pushScope(call_context* th) { ASObject* t=th->runtime_stack_pop(); - LOG(LOG_CALLS, _("pushScope ") << t ); + LOG_CALL( _("pushScope ") << t ); t->incRef(); assert_and_throw(th->curr_scope_stack < th->max_scope_stack); th->scope_stack[th->curr_scope_stack] = t; @@ -538,14 +538,14 @@ ret =th->scope_stack[0]; } assert_and_throw(ret->is<Global>()); - LOG(LOG_CALLS,_("getGlobalScope: ") << ret); + LOG_CALL(_("getGlobalScope: ") << ret); ret->incRef(); return ret->as<Global>(); } number_t ABCVm::decrement(ASObject* o) { - LOG(LOG_CALLS,_("decrement")); + LOG_CALL(_("decrement")); number_t n=o->toNumber(); o->decRef(); @@ -554,7 +554,7 @@ uint32_t ABCVm::decrement_i(ASObject* o) { - LOG(LOG_CALLS,_("decrement_i")); + LOG_CALL(_("decrement_i")); int32_t n=o->toInt(); o->decRef(); @@ -563,7 +563,7 @@ uint64_t ABCVm::decrement_di(ASObject* o) { - LOG(LOG_CALLS,_("decrement_di")); + LOG_CALL(_("decrement_di")); int64_t n=o->toInt64(); o->decRef(); @@ -574,7 +574,7 @@ { //Real comparision demanded to object bool ret=!(obj1->isLess(obj2)==TTRUE); - LOG(LOG_CALLS,_("ifNLT (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNLT (") << ((ret)?_("taken)"):_("not taken)"))); obj2->decRef(); obj1->decRef(); @@ -585,7 +585,7 @@ { //Real comparision demanded to object bool ret=(obj1->isLess(obj2)==TTRUE); - LOG(LOG_CALLS,_("ifLT (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifLT (") << ((ret)?_("taken)"):_("not taken)"))); obj2->decRef(); obj1->decRef(); @@ -594,7 +594,7 @@ bool ABCVm::ifLT_oi(ASObject* obj2, int32_t val1) { - LOG(LOG_CALLS,_("ifLT_oi")); + LOG_CALL(_("ifLT_oi")); //As ECMA said, on NaN return undefined... and undefined means not jump bool ret; @@ -609,7 +609,7 @@ bool ABCVm::ifLT_io(int32_t val2, ASObject* obj1) { - LOG(LOG_CALLS,_("ifLT_io ")); + LOG_CALL(_("ifLT_io ")); bool ret=obj1->toInt()<val2; @@ -621,7 +621,7 @@ { //Real comparision demanded to object bool ret=!(obj1->isEqual(obj2)); - LOG(LOG_CALLS,_("ifNE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNE (") << ((ret)?_("taken)"):_("not taken)"))); obj2->decRef(); obj1->decRef(); @@ -634,7 +634,7 @@ if(obj1->getObjectType()==T_UNDEFINED) return false; bool ret=obj1->toInt()!=val2; - LOG(LOG_CALLS,_("ifNE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNE (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); return ret; @@ -642,7 +642,7 @@ int32_t ABCVm::pushByte(intptr_t n) { - LOG(LOG_CALLS, _("pushByte ") << n ); + LOG_CALL( _("pushByte ") << n ); return n; } @@ -651,7 +651,7 @@ double num1=val1; double num2=val2->toNumber(); val2->decRef(); - LOG(LOG_CALLS,_("multiply_oi ") << num1 << '*' << num2); + LOG_CALL(_("multiply_oi ") << num1 << '*' << num2); return num1*num2; } @@ -661,7 +661,7 @@ double num2=val2->toNumber(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("multiply ") << num1 << '*' << num2); + LOG_CALL(_("multiply ") << num1 << '*' << num2); return num1*num2; } @@ -671,13 +671,13 @@ int num2=val2->toInt(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("multiply ") << num1 << '*' << num2); + LOG_CALL(_("multiply ") << num1 << '*' << num2); return num1*num2; } void ABCVm::incLocal(call_context* th, int n) { - LOG(LOG_CALLS, _("incLocal ") << n ); + LOG_CALL( _("incLocal ") << n ); number_t tmp=th->locals[n]->toNumber(); th->locals[n]->decRef(); th->locals[n]=abstract_d(th->context->root->getSystemState(),tmp+1); @@ -685,7 +685,7 @@ void ABCVm::incLocal_i(call_context* th, int n) { - LOG(LOG_CALLS, _("incLocal_i ") << n ); + LOG_CALL( _("incLocal_i ") << n ); int32_t tmp=th->locals[n]->toInt(); th->locals[n]->decRef(); th->locals[n]=abstract_i(th->context->root->getSystemState(),tmp+1); @@ -693,7 +693,7 @@ void ABCVm::decLocal(call_context* th, int n) { - LOG(LOG_CALLS, _("decLocal ") << n ); + LOG_CALL( _("decLocal ") << n ); number_t tmp=th->locals[n]->toNumber(); th->locals[n]->decRef(); th->locals[n]=abstract_d(th->context->root->getSystemState(),tmp-1); @@ -701,7 +701,7 @@ void ABCVm::decLocal_i(call_context* th, int n) { - LOG(LOG_CALLS, _("decLocal_i ") << n ); + LOG_CALL( _("decLocal_i ") << n ); int32_t tmp=th->locals[n]->toInt(); th->locals[n]->decRef(); th->locals[n]=abstract_i(th->context->root->getSystemState(),tmp-1); @@ -727,7 +727,7 @@ SyntheticFunction* sf=f->as<SyntheticFunction>(); if (sf->mi->body && !sf->mi->needsActivation()) { - LOG(LOG_CALLS,_("Building method traits")); + LOG_CALL(_("Building method traits")); for(unsigned int i=0;i<sf->mi->body->trait_count;i++) th->context->buildTrait(ret,&sf->mi->body->traits[i],false); } @@ -759,14 +759,14 @@ void ABCVm::construct(call_context* th, int m) { - LOG(LOG_CALLS, _("construct ") << m); + LOG_CALL( _("construct ") << m); ASObject** args=g_newa(ASObject*, m); for(int i=0;i<m;i++) args[m-i-1]=th->runtime_stack_pop(); ASObject* obj=th->runtime_stack_pop(); - LOG(LOG_CALLS,_("Constructing")); + LOG_CALL(_("Constructing")); ASObject* ret; switch(obj->getObjectType()) @@ -799,13 +799,13 @@ } ret->setConstructorCallComplete(); obj->decRef(); - LOG(LOG_CALLS,_("End of constructing ") << ret); + LOG_CALL(_("End of constructing ") << ret); th->runtime_stack_push(ret); } void ABCVm::constructGenericType(call_context* th, int m) { - LOG(LOG_CALLS, _("constructGenericType ") << m); + LOG_CALL( _("constructGenericType ") << m); if (m != 1) throwError<TypeError>(kWrongTypeArgCountError, "function", "1", Integer::toString(m)); ASObject** args=g_newa(ASObject*, m); @@ -867,7 +867,7 @@ ASObject* ABCVm::typeOf(ASObject* obj) { - LOG(LOG_CALLS,_("typeOf")); + LOG_CALL(_("typeOf")); string ret; switch(obj->getObjectType()) { @@ -912,13 +912,13 @@ void ABCVm::jump(int offset) { - LOG(LOG_CALLS,_("jump ") << offset); + LOG_CALL(_("jump ") << offset); } bool ABCVm::ifTrue(ASObject* obj1) { bool ret=Boolean_concrete(obj1); - LOG(LOG_CALLS,_("ifTrue (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifTrue (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); return ret; @@ -931,7 +931,7 @@ val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("modulo ") << num1 << '%' << num2); + LOG_CALL(_("modulo ") << num1 << '%' << num2); /* fmod returns NaN if num2 == 0 as the spec mandates */ return ::fmod(num1,num2); } @@ -942,7 +942,7 @@ int num1=val1; val2->decRef(); - LOG(LOG_CALLS,_("subtract_oi ") << num1 << '-' << num2); + LOG_CALL(_("subtract_oi ") << num1 << '-' << num2); return num1-num2; } @@ -952,7 +952,7 @@ number_t num1=val1->toNumber(); val1->decRef(); - LOG(LOG_CALLS,_("subtract_do ") << num1 << '-' << num2); + LOG_CALL(_("subtract_do ") << num1 << '-' << num2); return num1-num2; } @@ -968,7 +968,7 @@ int num1=val1->toInt(); val1->decRef(); - LOG(LOG_CALLS,_("subtract_io ") << dec << num1 << '-' << num2); + LOG_CALL(_("subtract_io ") << dec << num1 << '-' << num2); return num1-num2; } @@ -986,7 +986,7 @@ val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("subtract_i ") << num1 << '-' << num2); + LOG_CALL(_("subtract_i ") << num1 << '-' << num2); return num1-num2; } @@ -997,28 +997,28 @@ val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("subtract ") << num1 << '-' << num2); + LOG_CALL(_("subtract ") << num1 << '-' << num2); return num1-num2; } void ABCVm::pushUInt(call_context* th, uint32_t i) { - LOG(LOG_CALLS, "pushUInt " << i); + LOG_CALL( "pushUInt " << i); } void ABCVm::pushInt(call_context* th, int32_t i) { - LOG(LOG_CALLS, "pushInt " << i); + LOG_CALL( "pushInt " << i); } void ABCVm::pushDouble(call_context* th, double d) { - LOG(LOG_CALLS, "pushDouble " << d); + LOG_CALL( "pushDouble " << d); } void ABCVm::kill(int n) { - LOG(LOG_CALLS, _("kill ") << n ); + LOG_CALL( _("kill ") << n ); } ASObject* ABCVm::add(ASObject* val2, ASObject* val1) @@ -1032,7 +1032,7 @@ { int64_t num1=val1->toInt64(); int64_t num2=val2->toInt64(); - LOG(LOG_CALLS,"addI " << num1 << '+' << num2); + LOG_CALL("addI " << num1 << '+' << num2); res = abstract_di(val1->getSystemState(), num1+num2); val1->decRef(); val2->decRef(); @@ -1042,7 +1042,7 @@ { double num1=val1->as<Number>()->toNumber(); double num2=val2->as<Number>()->toNumber(); - LOG(LOG_CALLS,"addN " << num1 << '+' << num2); + LOG_CALL("addN " << num1 << '+' << num2); res = abstract_d(val1->getSystemState(), num1+num2); val1->decRef(); val2->decRef(); @@ -1052,7 +1052,7 @@ { tiny_string a = val1->toString(); tiny_string b = val2->toString(); - LOG(LOG_CALLS,"add " << a << '+' << b); + LOG_CALL("add " << a << '+' << b); res = abstract_s(val1->getSystemState(),a + b); val1->decRef(); val2->decRef(); @@ -1086,7 +1086,7 @@ {//If one is String, convert both to strings and concat string a(val1p->toString().raw_buf()); string b(val2p->toString().raw_buf()); - LOG(LOG_CALLS,"add " << a << '+' << b); + LOG_CALL("add " << a << '+' << b); res = abstract_s(val1->getSystemState(),a+b); val1->decRef(); val2->decRef(); @@ -1096,7 +1096,7 @@ {//Convert both to numbers and add number_t num1=val1p->toNumber(); number_t num2=val2p->toNumber(); - LOG(LOG_CALLS,"addN " << num1 << '+' << num2); + LOG_CALL("addN " << num1 << '+' << num2); number_t result = num1 + num2; res = abstract_d(val1->getSystemState(),result); val1->decRef(); @@ -1121,7 +1121,7 @@ val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("add_i ") << num1 << '+' << num2); + LOG_CALL(_("add_i ") << num1 << '+' << num2); return num1+num2; } @@ -1136,7 +1136,7 @@ int32_t num1=val1; res = abstract_i(val2->getSystemState(),num1+num2); val2->decRef(); - LOG(LOG_CALLS,_("add ") << num1 << '+' << num2); + LOG_CALL(_("add ") << num1 << '+' << num2); return res; } else if(val2->getObjectType()==T_NUMBER) @@ -1145,7 +1145,7 @@ double num1=val1; res = abstract_d(val2->getSystemState(),num1+num2); val2->decRef(); - LOG(LOG_CALLS,_("add ") << num1 << '+' << num2); + LOG_CALL(_("add ") << num1 << '+' << num2); return res; } else if(val2->getObjectType()==T_STRING) @@ -1155,7 +1155,7 @@ const tiny_string& b=val2->toString(); res = abstract_s(val2->getSystemState(), a+b); val2->decRef(); - LOG(LOG_CALLS,_("add ") << a << '+' << b); + LOG_CALL(_("add ") << a << '+' << b); return res; } else @@ -1175,7 +1175,7 @@ double num1=val1; res = abstract_d(val2->getSystemState(),num1+num2); val2->decRef(); - LOG(LOG_CALLS,_("add ") << num1 << '+' << num2); + LOG_CALL(_("add ") << num1 << '+' << num2); return res; } else if(val2->getObjectType()==T_INTEGER) @@ -1184,7 +1184,7 @@ double num1=val1; res = abstract_d(val2->getSystemState(),num1+num2); val2->decRef(); - LOG(LOG_CALLS,_("add ") << num1 << '+' << num2); + LOG_CALL(_("add ") << num1 << '+' << num2); return res; } else if(val2->getObjectType()==T_STRING) @@ -1193,7 +1193,7 @@ const tiny_string& b=val2->toString(); res = abstract_s(val2->getSystemState(),a+b); val2->decRef(); - LOG(LOG_CALLS,_("add ") << a << '+' << b); + LOG_CALL(_("add ") << a << '+' << b); return res; } else @@ -1209,7 +1209,7 @@ uint32_t i1=val1->toUInt()&0x1f; val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec); + LOG_CALL(_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec); //Left shift are supposed to always work in 32bit int32_t ret=i2<<i1; return ret; @@ -1220,7 +1220,7 @@ int32_t i2=val2->toInt(); uint32_t i1=val1&0x1f; val2->decRef(); - LOG(LOG_CALLS,_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec); + LOG_CALL(_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec); //Left shift are supposed to always work in 32bit int32_t ret=i2<<i1; return ret; @@ -1232,7 +1232,7 @@ uint32_t i1=val1->toUInt()&0x1f; val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("rShift ")<<hex<<i2<<_(">>")<<i1<<dec); + LOG_CALL(_("rShift ")<<hex<<i2<<_(">>")<<i1<<dec); return i2>>i1; } @@ -1242,7 +1242,7 @@ uint32_t i1=val1->toUInt()&0x1f; val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec); + LOG_CALL(_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec); return i2>>i1; } @@ -1251,13 +1251,13 @@ uint32_t i2=val2->toUInt(); uint32_t i1=val1&0x1f; val2->decRef(); - LOG(LOG_CALLS,_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec); + LOG_CALL(_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec); return i2>>i1; } bool ABCVm::_not(ASObject* v) { - LOG(LOG_CALLS, _("not") ); + LOG_CALL( _("not") ); bool ret=!Boolean_concrete(v); v->decRef(); return ret; @@ -1266,7 +1266,7 @@ bool ABCVm::equals(ASObject* val2, ASObject* val1) { bool ret=val1->isEqual(val2); - LOG(LOG_CALLS, _("equals ") << ret); + LOG_CALL( _("equals ") << ret); val1->decRef(); val2->decRef(); return ret; @@ -1311,7 +1311,7 @@ bool ABCVm::strictEquals(ASObject* obj2, ASObject* obj1) { - LOG(LOG_CALLS, _("strictEquals") ); + LOG_CALL( _("strictEquals") ); bool ret=strictEqualImpl(obj1, obj2); obj1->decRef(); obj2->decRef(); @@ -1320,24 +1320,24 @@ void ABCVm::dup() { - LOG(LOG_CALLS, _("dup: DONE") ); + LOG_CALL( _("dup: DONE") ); } bool ABCVm::pushTrue() { - LOG(LOG_CALLS, _("pushTrue") ); + LOG_CALL( _("pushTrue") ); return true; } bool ABCVm::pushFalse() { - LOG(LOG_CALLS, _("pushFalse") ); + LOG_CALL( _("pushFalse") ); return false; } ASObject* ABCVm::pushNaN() { - LOG(LOG_CALLS, _("pushNaN") ); + LOG_CALL( _("pushNaN") ); return abstract_d(getSys(),Number::NaN); } @@ -1345,7 +1345,7 @@ { //Real comparision demanded to object bool ret=(obj2->isLess(obj1)==TTRUE); - LOG(LOG_CALLS,_("ifGT (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifGT (") << ((ret)?_("taken)"):_("not taken)"))); obj2->decRef(); obj1->decRef(); @@ -1357,7 +1357,7 @@ //Real comparision demanded to object bool ret=!(obj2->isLess(obj1)==TTRUE); - LOG(LOG_CALLS,_("ifNGT (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNGT (") << ((ret)?_("taken)"):_("not taken)"))); obj2->decRef(); obj1->decRef(); @@ -1368,7 +1368,7 @@ { //Real comparision demanded to object bool ret=(obj2->isLess(obj1)==TFALSE); - LOG(LOG_CALLS,_("ifLE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifLE (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); obj2->decRef(); return ret; @@ -1378,7 +1378,7 @@ { //Real comparision demanded to object bool ret=!(obj2->isLess(obj1)==TFALSE); - LOG(LOG_CALLS,_("ifNLE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNLE (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); obj2->decRef(); return ret; @@ -1388,7 +1388,7 @@ { //Real comparision demanded to object bool ret=(obj1->isLess(obj2)==TFALSE); - LOG(LOG_CALLS,_("ifGE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifGE (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); obj2->decRef(); return ret; @@ -1398,7 +1398,7 @@ { //Real comparision demanded to object bool ret=!(obj1->isLess(obj2)==TFALSE); - LOG(LOG_CALLS,_("ifNGE (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifNGE (") << ((ret)?_("taken)"):_("not taken)"))); obj1->decRef(); obj2->decRef(); return ret; @@ -1406,7 +1406,7 @@ void ABCVm::_throw(call_context* th) { - LOG(LOG_CALLS,_("throw")); + LOG_CALL(_("throw")); throw th->runtime_stack_pop(); } @@ -1414,7 +1414,7 @@ { ASObject* value=th->runtime_stack_pop(); multiname* name=th->context->getMultiname(n,th); - LOG(LOG_CALLS,_("setSuper ") << *name); + LOG_CALL(_("setSuper ") << *name); ASObject* obj=th->runtime_stack_pop(); @@ -1431,7 +1431,7 @@ void ABCVm::getSuper(call_context* th, int n) { multiname* name=th->context->getMultiname(n,th); - LOG(LOG_CALLS,_("getSuper ") << *name); + LOG_CALL(_("getSuper ") << *name); ASObject* obj=th->runtime_stack_pop(); @@ -1469,7 +1469,7 @@ //getlex is specified not to allow runtime multinames assert_and_throw(th->context->getMultinameRTData(n)==0); multiname* name=th->context->getMultiname(n,NULL); - LOG(LOG_CALLS, "getLex: " << *name ); + LOG_CALL( "getLex: " << *name ); vector<scope_entry>::reverse_iterator it; // o will be a reference owned by this function (or NULL). At // the end the reference will be handed over to the runtime @@ -1541,7 +1541,7 @@ void ABCVm::constructSuper(call_context* th, int m) { - LOG(LOG_CALLS, _("constructSuper ") << m); + LOG_CALL( _("constructSuper ") << m); ASObject** args=g_newa(ASObject*, m); for(int i=0;i<m;i++) args[m-i-1]=th->runtime_stack_pop(); @@ -1552,16 +1552,16 @@ assert_and_throw(th->inClass->super); assert_and_throw(obj->getClass()); assert_and_throw(obj->getClass()->isSubClass(th->inClass)); - LOG(LOG_CALLS,_("Super prototype name ") << th->inClass->super->class_name); + LOG_CALL(_("Super prototype name ") << th->inClass->super->class_name); th->inClass->super->handleConstruction(obj,args, m, false); obj->decRef(); - LOG(LOG_CALLS,_("End super construct ")); + LOG_CALL(_("End super construct ")); } ASObject* ABCVm::findProperty(call_context* th, multiname* name) { - LOG(LOG_CALLS, _("findProperty ") << *name ); + LOG_CALL( _("findProperty ") << *name ); vector<scope_entry>::reverse_iterator it; bool found=false; @@ -1618,7 +1618,7 @@ ASObject* ABCVm::findPropStrict(call_context* th, multiname* name) { - LOG(LOG_CALLS, "findPropStrict " << *name ); + LOG_CALL( "findPropStrict " << *name ); vector<scope_entry>::reverse_iterator it; bool found=false; @@ -1680,7 +1680,7 @@ bool ABCVm::greaterThan(ASObject* obj1, ASObject* obj2) { - LOG(LOG_CALLS,_("greaterThan")); + LOG_CALL(_("greaterThan")); //Real comparision demanded to object bool ret=(obj2->isLess(obj1)==TTRUE); @@ -1691,7 +1691,7 @@ bool ABCVm::greaterEquals(ASObject* obj1, ASObject* obj2) { - LOG(LOG_CALLS,_("greaterEquals")); + LOG_CALL(_("greaterEquals")); //Real comparision demanded to object bool ret=(obj1->isLess(obj2)==TFALSE); @@ -1702,7 +1702,7 @@ bool ABCVm::lessEquals(ASObject* obj1, ASObject* obj2) { - LOG(LOG_CALLS,_("lessEquals")); + LOG_CALL(_("lessEquals")); //Real comparision demanded to object bool ret=(obj2->isLess(obj1)==TFALSE); @@ -1755,7 +1755,7 @@ args[i]->decRef(); throwError<ReferenceError>(kCallNotFoundError, "?", clsname); } - LOG(LOG_CALLS,"End of callStatic "); + LOG_CALL("End of callStatic "); } void ABCVm::callSuper(call_context* th, int n, int m, method_info** called_mi, bool keepReturn) @@ -1765,7 +1765,7 @@ args[m-i-1]=th->runtime_stack_pop(); multiname* name=th->context->getMultiname(n,th); - LOG(LOG_CALLS,(keepReturn ? "callSuper " : "callSuperVoid ") << *name << ' ' << m); + LOG_CALL((keepReturn ? "callSuper " : "callSuperVoid ") << *name << ' ' << m); ASObject* obj=th->runtime_stack_pop(); if(obj->is<Null>()) @@ -1799,7 +1799,7 @@ //LOG(LOG_ERROR,_("Calling an undefined function ") << th->context->root->getSystemState()->getStringFromUniqueId(name->name_s_id)); throwError<ReferenceError>(kCallNotFoundError, name->qualifiedString(th->context->root->getSystemState()), clsname); } - LOG(LOG_CALLS,_("End of callSuper ") << *name); + LOG_CALL(_("End of callSuper ") << *name); } bool ABCVm::isType(ABCContext* context, ASObject* obj, multiname* name) @@ -1811,7 +1811,7 @@ bool ABCVm::isTypelate(ASObject* type, ASObject* obj) { - LOG(LOG_CALLS,_("isTypelate")); + LOG_CALL(_("isTypelate")); bool real_ret=false; Class_base* objc=NULL; @@ -1855,7 +1855,7 @@ real_ret=(obj->toNumber()==obj->toUInt()); else real_ret=false; - LOG(LOG_CALLS,_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name); + LOG_CALL(_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name); obj->decRef(); type->decRef(); return real_ret; @@ -1870,14 +1870,14 @@ else { real_ret=obj->getObjectType()==type->getObjectType(); - LOG(LOG_CALLS,_("isTypelate on non classed object ") << real_ret); + LOG_CALL(_("isTypelate on non classed object ") << real_ret); obj->decRef(); type->decRef(); return real_ret; } real_ret=objc->isSubClass(c); - LOG(LOG_CALLS,_("Type ") << objc->class_name << _(" is ") << ((real_ret)?"":_("not ")) + LOG_CALL(_("Type ") << objc->class_name << _(" is ") << ((real_ret)?"":_("not ")) << "subclass of " << c->class_name); obj->decRef(); type->decRef(); @@ -1887,7 +1887,7 @@ ASObject* ABCVm::asType(ABCContext* context, ASObject* obj, multiname* name) { bool ret = context->isinstance(obj, name); - LOG(LOG_CALLS,_("asType")); + LOG_CALL(_("asType")); if(ret) return obj; @@ -1901,7 +1901,7 @@ ASObject* ABCVm::asTypelate(ASObject* type, ASObject* obj) { - LOG(LOG_CALLS,_("asTypelate")); + LOG_CALL(_("asTypelate")); if(!type->is<Class_base>()) { @@ -1923,7 +1923,7 @@ real_ret=(obj->toNumber()==obj->toUInt()); else real_ret=false; - LOG(LOG_CALLS,_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name); + LOG_CALL(_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name); type->decRef(); if(real_ret) return obj; @@ -1947,7 +1947,7 @@ } bool real_ret=objc->isSubClass(c); - LOG(LOG_CALLS,_("Type ") << objc->class_name << _(" is ") << ((real_ret)?_(" "):_("not ")) + LOG_CALL(_("Type ") << objc->class_name << _(" is ") << ((real_ret)?_(" "):_("not ")) << _("subclass of ") << c->class_name); type->decRef(); if(real_ret) @@ -1963,7 +1963,7 @@ bool ABCVm::ifEq(ASObject* obj1, ASObject* obj2) { bool ret=obj1->isEqual(obj2); - LOG(LOG_CALLS,_("ifEq (") << ((ret)?_("taken)"):_("not taken)"))); + LOG_CALL(_("ifEq (") << ((ret)?_("taken)"):_("not taken)"))); //Real comparision demanded to object obj1->decRef(); @@ -1974,7 +1974,7 @@ bool ABCVm::ifStrictEq(ASObject* obj2, ASObject* obj1) { bool ret=strictEqualImpl(obj1,obj2); - LOG(LOG_CALLS,_("ifStrictEq ")<<ret); + LOG_CALL(_("ifStrictEq ")<<ret); obj1->decRef(); obj2->decRef(); return ret; @@ -1983,7 +1983,7 @@ bool ABCVm::ifStrictNE(ASObject* obj2, ASObject* obj1) { bool ret=!strictEqualImpl(obj1,obj2); - LOG(LOG_CALLS,_("ifStrictNE ")<<ret); + LOG_CALL(_("ifStrictNE ")<<ret); obj1->decRef(); obj2->decRef(); return ret; @@ -1991,7 +1991,7 @@ bool ABCVm::in(ASObject* val2, ASObject* val1) { - LOG(LOG_CALLS, _("in") ); + LOG_CALL( _("in") ); if(val2->is<Null>()) throwError<TypeError>(kConvertNullToObjectError); @@ -2010,7 +2010,7 @@ bool ABCVm::ifFalse(ASObject* obj1) { bool ret=!Boolean_concrete(obj1); - LOG(LOG_CALLS,_("ifFalse (") << ((ret)?_("taken"):_("not taken")) << ')'); + LOG_CALL(_("ifFalse (") << ((ret)?_("taken"):_("not taken")) << ')'); obj1->decRef(); return ret; @@ -2024,7 +2024,7 @@ multiname* name=th->context->getMultiname(n,th); - LOG(LOG_CALLS,_("constructProp ")<< *name << ' ' << m); + LOG_CALL(_("constructProp ")<< *name << ' ' << m); ASObject* obj=th->runtime_stack_pop(); @@ -2050,7 +2050,7 @@ name->resetNameIfObject(); - LOG(LOG_CALLS,_("Constructing")); + LOG_CALL(_("Constructing")); ASObject* ret; try { @@ -2068,7 +2068,7 @@ } catch(ASObject* exc) { - LOG(LOG_CALLS,_("Exception during object construction. Returning Undefined")); + LOG_CALL(_("Exception during object construction. Returning Undefined")); //Handle eventual exceptions from the constructor, to fix the stack th->runtime_stack_push(obj->getSystemState()->getUndefinedRef()); obj->decRef(); @@ -2079,12 +2079,12 @@ ret->setConstructorCallComplete(); obj->decRef(); - LOG(LOG_CALLS,_("End of constructing ") << ret->toDebugString()); + LOG_CALL(_("End of constructing ") << ret->toDebugString()); } bool ABCVm::hasNext2(call_context* th, int n, int m) { - LOG(LOG_CALLS,"hasNext2 " << n << ' ' << m); + LOG_CALL("hasNext2 " << n << ' ' << m); ASObject* obj=th->locals[n]; //If the local is not assigned bail out if(obj==NULL) @@ -2106,7 +2106,7 @@ void ABCVm::newObject(call_context* th, int n) { - LOG(LOG_CALLS,_("newObject ") << n); + LOG_CALL(_("newObject ") << n); ASObject* ret=Class<ASObject>::getInstanceS(th->context->root->getSystemState()); //Duplicated keys overwrite the previous value multiname propertyName(NULL); @@ -2128,7 +2128,7 @@ { multiname* name=th->context->getMultiname(n,th); ASObject* obj=th->runtime_stack_pop(); - LOG(LOG_CALLS,"getDescendants " << *name << " " <<name->isAttribute<< " "<<obj->getClassName()); + LOG_CALL("getDescendants " << *name << " " <<name->isAttribute<< " "<<obj->getClassName()); XML::XMLVector ret; XMLList* targetobject = NULL; if(obj->getClass()==Class<XML>::getClass(obj->getSystemState())) @@ -2177,7 +2177,7 @@ proxyArgs[0]=namearg; //We now suppress special handling - LOG(LOG_CALLS,_("Proxy::getDescendants")); + LOG_CALL(_("Proxy::getDescendants")); f->incRef(); obj->incRef(); ASObject* ret=f->call(obj,proxyArgs,1); @@ -2185,7 +2185,7 @@ th->runtime_stack_push(ret); obj->decRef(); - LOG(LOG_CALLS,_("End of calling ") << *name); + LOG_CALL(_("End of calling ") << *name); return; } else @@ -2208,7 +2208,7 @@ number_t ABCVm::increment(ASObject* o) { - LOG(LOG_CALLS,"increment"); + LOG_CALL("increment"); number_t n=o->toNumber(); o->decRef(); @@ -2217,7 +2217,7 @@ uint32_t ABCVm::increment_i(ASObject* o) { - LOG(LOG_CALLS,_("increment_i")); + LOG_CALL(_("increment_i")); int n=o->toInt(); o->decRef(); @@ -2226,7 +2226,7 @@ uint64_t ABCVm::increment_di(ASObject* o) { - LOG(LOG_CALLS,_("increment_di")); + LOG_CALL(_("increment_di")); int64_t n=o->toInt64(); o->decRef(); @@ -2235,7 +2235,7 @@ ASObject* ABCVm::nextValue(ASObject* index, ASObject* obj) { - LOG(LOG_CALLS,"nextValue"); + LOG_CALL("nextValue"); if(index->getObjectType()!=T_INTEGER) throw UnsupportedException("Type mismatch in nextValue"); @@ -2248,7 +2248,7 @@ ASObject* ABCVm::nextName(ASObject* index, ASObject* obj) { - LOG(LOG_CALLS,"nextName"); + LOG_CALL("nextName"); if(index->getObjectType()!=T_INTEGER) throw UnsupportedException("Type mismatch in nextName"); @@ -2290,7 +2290,7 @@ } for(unsigned int i=0;i<interfaces.size();i++) { - LOG(LOG_CALLS,_("Linking with interface ") << interfaces[i]->class_name); + LOG_CALL(_("Linking with interface ") << interfaces[i]->class_name); interfaces[i]->linkInterface(target); } return true; @@ -2301,7 +2301,7 @@ int name_index=th->context->instances[n].name; assert_and_throw(name_index); const multiname* mname=th->context->getMultiname(name_index,NULL); - LOG(LOG_CALLS, "newClass " << *mname ); + LOG_CALL( "newClass " << *mname ); ASObject* baseClass=th->runtime_stack_pop(); @@ -2329,7 +2329,7 @@ ASObject* oldDefinition=domain->getVariableAndTargetByMultiname(*mname, target); if(oldDefinition && oldDefinition->getObjectType()==T_CLASS) { - LOG(LOG_CALLS,_("Class ") << className << _(" already defined. Pushing previous definition")); + LOG_CALL(_("Class ") << className << _(" already defined. Pushing previous definition")); baseClass->decRef(); oldDefinition->incRef(); th->runtime_stack_push(oldDefinition); @@ -2341,7 +2341,7 @@ ret=new (th->context->root->getSystemState()->unaccountedMemory) Class_inherit(className, th->context->root->getSystemState()->unaccountedMemory); - LOG(LOG_CALLS,"add classes defined:"<<*mname<<" "<<th->context); + LOG_CALL("add classes defined:"<<*mname<<" "<<th->context); //Add the class to the ones being currently defined in this context th->context->root->applicationDomain->classesBeingDefined.insert(make_pair(mname, ret)); } @@ -2398,11 +2398,11 @@ ret->class_scope.push_back(scope_entry(_MR(th->scope_stack[i]),th->scope_stack_dynamic[i])); } - LOG(LOG_CALLS,_("Building class traits")); + LOG_CALL(_("Building class traits")); for(unsigned int i=0;i<th->context->classes[n].trait_count;i++) th->context->buildTrait(ret,&th->context->classes[n].traits[i],false); - LOG(LOG_CALLS,_("Adding immutable object traits to class")); + LOG_CALL(_("Adding immutable object traits to class")); //Class objects also contains all the methods/getters/setters declared for instances instance_info* cur=&th->context->instances[n]; for(unsigned int i=0;i<cur->trait_count;i++) @@ -2478,7 +2478,7 @@ if (th->context->instances[n].isInterface()) ABCVm::SetAllClassLinks(); - LOG(LOG_CALLS,_("Calling Class init ") << ret); + LOG_CALL(_("Calling Class init ") << ret); ret->incRef(); //Class init functions are called with global as this method_info* m=&th->context->methods[th->context->classes[n].cinit]; @@ -2499,7 +2499,7 @@ } catch(ASObject* exc) { - LOG(LOG_CALLS,_("Exception during class initialization. Returning Undefined")); + LOG_CALL(_("Exception during class initialization. Returning Undefined")); //Handle eventual exceptions from the constructor, to fix the stack th->runtime_stack_push(th->context->root->applicationDomain->getSystemState()->getUndefinedRef()); cinit->decRef(); @@ -2510,7 +2510,7 @@ } assert_and_throw(ret2->is<Undefined>()); ret2->decRef(); - LOG(LOG_CALLS,_("End of Class init ") << *mname <<" " <<ret); + LOG_CALL(_("End of Class init ") << *mname <<" " <<ret); th->runtime_stack_push(ret); cinit->decRef(); @@ -2531,12 +2531,12 @@ void ABCVm::swap() { - LOG(LOG_CALLS,_("swap")); + LOG_CALL(_("swap")); } ASObject* ABCVm::newActivation(call_context* th, method_info* mi, ASObject* caller) { - LOG(LOG_CALLS,"newActivation"); + LOG_CALL("newActivation"); //TODO: Should create a real activation object //TODO: Should method traits be added to the activation context? ASObject* act= NULL; @@ -2561,14 +2561,14 @@ void ABCVm::popScope(call_context* th) { - LOG(LOG_CALLS,_("popScope")); + LOG_CALL(_("popScope")); assert_and_throw(th->curr_scope_stack); th->curr_scope_stack--; } bool ABCVm::lessThan(ASObject* obj1, ASObject* obj2) { - LOG(LOG_CALLS,_("lessThan")); + LOG_CALL(_("lessThan")); //Real comparision demanded to object bool ret=(obj1->isLess(obj2)==TTRUE); @@ -2585,7 +2585,7 @@ ASObject* obj=th->runtime_stack_pop(); ASObject* f=th->runtime_stack_pop(); - LOG(LOG_CALLS,_("call ") << m << ' ' << f); + LOG_CALL(_("call ") << m << ' ' << f); callImpl(th, f, obj, args, m, called_mi, true); } @@ -2633,12 +2633,12 @@ f->decRef(); throwError<TypeError>(kCallOfNonFunctionError, "Object"); } - LOG(LOG_CALLS,_("End of call ") << m << ' ' << f); + LOG_CALL(_("End of call ") << m << ' ' << f); } bool ABCVm::deleteProperty(ASObject* obj, multiname* name) { - LOG(LOG_CALLS,_("deleteProperty ") << *name<<" "<<obj->toDebugString()); + LOG_CALL(_("deleteProperty ") << *name<<" "<<obj->toDebugString()); if (name->name_type == multiname::NAME_OBJECT && name->name_o) { if (name->name_o->is<XMLList>()) @@ -2652,7 +2652,7 @@ ASObject* ABCVm::newFunction(call_context* th, int n) { - LOG(LOG_CALLS,_("newFunction ") << n); + LOG_CALL(_("newFunction ") << n); method_info* m=&th->context->methods[n]; SyntheticFunction* f=Class<IFunction>::getSyntheticFunction(th->context->root->applicationDomain->getSystemState(),m); @@ -2677,13 +2677,13 @@ assert_and_throw(th->curr_scope_stack > (size_t)n); ASObject* ret=th->scope_stack[(size_t)n]; ret->incRef(); - LOG(LOG_CALLS, _("getScopeObject: ") << ret ); + LOG_CALL( _("getScopeObject: ") << ret ); return ret; } ASObject* ABCVm::pushString(call_context* th, int n) { - LOG(LOG_CALLS, _("pushString ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(n)) ); + LOG_CALL( _("pushString ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(n)) ); return abstract_s(th->context->root->applicationDomain->getSystemState(),th->context->getString(n)); } @@ -2699,7 +2699,7 @@ void ABCVm::newArray(call_context* th, int n) { - LOG(LOG_CALLS, _("newArray ") << n ); + LOG_CALL( _("newArray ") << n ); Array* ret=Class<Array>::getInstanceS(th->context->root->getSystemState()); ret->resize(n); for(int i=0;i<n;i++) @@ -2777,7 +2777,7 @@ { const namespace_info& ns_info=th->context->constant_pool.namespaces[n]; assert(ns_info.kind == NAMESPACE); - LOG(LOG_CALLS, _("pushNamespace ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name)) ); + LOG_CALL( _("pushNamespace ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name)) ); return Class<Namespace>::getInstanceS(th->context->root->getSystemState(),th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name))); }
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -233,15 +233,32 @@ template<> inline ASObject* Class<Number>::coerce(ASObject* o) const { - number_t n = o->toNumber(); - ASObject* res = abstract_d(o->getSystemState(),n); - o->decRef(); - return res; + switch (o->getObjectType()) + { + case T_NUMBER: + return o; + case T_INTEGER: + case T_UINTEGER: + { + ASObject* res = abstract_di(o->getSystemState(),o->toInt64()); + o->decRef(); + return res; + } + default: + { + number_t n = o->toNumber(); + ASObject* res = abstract_d(o->getSystemState(),n); + o->decRef(); + return res; + } + } } template<> inline ASObject* Class<UInteger>::coerce(ASObject* o) const { + if (o->is<UInteger>()) + return o; uint32_t n = o->toUInt(); ASObject* res = abstract_ui(o->getSystemState(),n); o->decRef(); @@ -251,6 +268,8 @@ template<> inline ASObject* Class<Integer>::coerce(ASObject* o) const { + if (o->is<Integer>()) + return o; int32_t n = o->toInt(); ASObject* res = abstract_i(o->getSystemState(),n); o->decRef(); @@ -260,6 +279,8 @@ template<> inline ASObject* Class<Boolean>::coerce(ASObject* o) const { + if (o->is<Boolean>()) + return o; bool n = Boolean_concrete(o); ASObject* res = abstract_b(o->getSystemState(),n); o->decRef();
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp
Changed
@@ -87,7 +87,7 @@ args[1]=o; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::setProperty")); + LOG_CALL(_("Proxy::setProperty")); incRef(); _R<ASObject> ret=_MR( f->call(this,args,2) ); assert_and_throw(ret->is<Undefined>()); @@ -99,7 +99,7 @@ //It seems that various kind of implementation works only with the empty namespace assert_and_throw(name.ns.size()>0); _NR<ASObject> o; - LOG(LOG_CALLS,"Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true)); + LOG_CALL("Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true)); if(ASObject::hasPropertyByMultiname(name, true, true) || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) o = ASObject::getVariableByMultiname(name,opt); if (!o.isNull() || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) @@ -124,7 +124,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString()); + LOG_CALL("Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString()); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -162,7 +162,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::hasProperty")); + LOG_CALL(_("Proxy::hasProperty")); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -198,7 +198,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::deleteProperty")); + LOG_CALL(_("Proxy::deleteProperty")); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -209,7 +209,7 @@ uint32_t Proxy::nextNameIndex(uint32_t cur_index) { assert_and_throw(implEnable); - LOG(LOG_CALLS,"Proxy::nextNameIndex"); + LOG_CALL("Proxy::nextNameIndex"); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameIndexName(NULL); nextNameIndexName.name_type=multiname::NAME_STRING; @@ -229,7 +229,7 @@ _R<ASObject> Proxy::nextName(uint32_t index) { assert_and_throw(implEnable); - LOG(LOG_CALLS, _("Proxy::nextName")); + LOG_CALL( _("Proxy::nextName")); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameName(NULL); nextNameName.name_type=multiname::NAME_STRING; @@ -246,7 +246,7 @@ _R<ASObject> Proxy::nextValue(uint32_t index) { assert_and_throw(implEnable); - LOG(LOG_CALLS, _("Proxy::nextValue")); + LOG_CALL( _("Proxy::nextValue")); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextValueName(NULL); nextValueName.name_type=multiname::NAME_STRING;
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp
Changed
@@ -29,38 +29,32 @@ using namespace std; using namespace lightspark; -ASString::ASString(Class_base* c):ASObject(c),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c):ASObject(c,T_STRING),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const char* s) : ASObject(c),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const char* s) : ASObject(c,T_STRING),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c) +ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c,T_STRING) { data = std::string(s,len); hasId = false; stringId = BUILTIN_STRINGS::EMPTY; datafilled=true; - type=T_STRING; } ASFUNCTIONBODY(ASString,_constructor) @@ -80,7 +74,14 @@ { // fast path if obj is ASString if (obj->is<ASString>()) - return abstract_i(obj->getSystemState(),obj->as<ASString>()->getData().numChars()); + { + ASString* th = obj->as<ASString>(); + if (th->strlength.isNull()) + th->strlength = _MNR(abstract_i(obj->getSystemState(),th->getData().numChars())); + th->strlength->incRef(); + return th->strlength.getPtr(); +// return abstract_i(obj->getSystemState(),th->getData().numChars()); + } return abstract_i(obj->getSystemState(),obj->toString().numChars()); }
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.h
Changed
@@ -40,6 +40,7 @@ private: number_t parseStringInfinite(const char *s, char **end) const; tiny_string data; + _NR<ASObject> strlength; public: ASString(Class_base* c); ASString(Class_base* c, const std::string& s); @@ -47,8 +48,8 @@ ASString(Class_base* c, const Glib::ustring& s); ASString(Class_base* c, const char* s); ASString(Class_base* c, const char* s, uint32_t len); - bool hasId; - bool datafilled; + bool hasId:1; + bool datafilled:1; uint32_t stringId; inline tiny_string& getData() { @@ -106,6 +107,7 @@ inline bool destruct() { data.clear(); + strlength.reset(); hasId = true; datafilled=true; stringId = BUILTIN_STRINGS::EMPTY;
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -28,11 +28,9 @@ using namespace std; using namespace lightspark; -Array::Array(Class_base* c):ASObject(c), +Array::Array(Class_base* c):ASObject(c,T_ARRAY),currentsize(0), data(std::less<arrayType::key_type>(), reporter_allocator<arrayType::value_type>(c->memoryAccount)) { - currentsize=0; - type=T_ARRAY; } void Array::sinit(Class_base* c)
View file
lightspark.tar.xz/src/scripting/toplevel/Boolean.h
Changed
@@ -35,7 +35,7 @@ class Boolean: public ASObject { public: - Boolean(Class_base* c, bool v=false):ASObject(c),val(v) {type=T_BOOLEAN;} + Boolean(Class_base* c, bool v=false):ASObject(c,T_BOOLEAN),val(v) {} static void sinit(Class_base*); static void buildTraits(ASObject* o){}; bool val;
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.h
Changed
@@ -33,7 +33,7 @@ friend class ABCContext; friend ASObject* abstract_i(int32_t i); public: - Integer(Class_base* c,int32_t v=0):ASObject(c),val(v){type=T_INTEGER;} + Integer(Class_base* c,int32_t v=0):ASObject(c,T_INTEGER),val(v){} int32_t val; static void buildTraits(ASObject* o){}; static void sinit(Class_base* c);
View file
lightspark.tar.xz/src/scripting/toplevel/Number.h
Changed
@@ -38,13 +38,13 @@ static tiny_string purgeExponentLeadingZeros(const tiny_string& exponentialForm); static int32_t countSignificantDigits(double v); public: - Number(Class_base* c, double v=Number::NaN):ASObject(c),dval(v),isfloat(true){type=T_NUMBER;} + Number(Class_base* c, double v=Number::NaN):ASObject(c,T_NUMBER),dval(v),isfloat(true){} static const number_t NaN; union { number_t dval; int64_t ival; }; - bool isfloat; + bool isfloat:1; inline number_t toNumber() { return isfloat ? dval : ival; } inline bool destruct() { dval=Number::NaN; isfloat = true; return ASObject::destruct(); } ASFUNCTION(_constructor);
View file
lightspark.tar.xz/src/scripting/toplevel/UInteger.h
Changed
@@ -30,7 +30,7 @@ friend ASObject* abstract_ui(uint32_t i); public: uint32_t val; - UInteger(Class_base* c,uint32_t v=0):ASObject(c),val(v){type=T_UINTEGER;} + UInteger(Class_base* c,uint32_t v=0):ASObject(c,T_UINTEGER),val(v){} static void sinit(Class_base* c); tiny_string toString();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -52,25 +52,23 @@ Any* const Type::anyType = new Any(); Void* const Type::voidType = new Void(); -Null::Null():ASObject((Class_base*)(NULL)) +Null::Null():ASObject((Class_base*)(NULL),T_NULL) { traitsInitialized = true; constructIndicator = true; constructorCallComplete = true; - type=T_NULL; } -Undefined::Undefined():ASObject((Class_base*)(NULL)) +Undefined::Undefined():ASObject((Class_base*)(NULL),T_UNDEFINED) { traitsInitialized = true; constructIndicator = true; constructorCallComplete = true; - type=T_UNDEFINED; } ASFUNCTIONBODY(Undefined,call) { - LOG(LOG_CALLS,_("Undefined function")); + LOG_CALL(_("Undefined function")); return NULL; } @@ -133,9 +131,8 @@ throwError<TypeError>(kConvertUndefinedToObjectError); } -IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL),functionname(0) +IFunction::IFunction(Class_base* c):ASObject(c,T_FUNCTION),length(0),inClass(NULL),functionname(0) { - type=T_FUNCTION; } void IFunction::sinit(Class_base* c) @@ -403,7 +400,7 @@ if(isBound()) { /* closure_this can never been overriden */ - LOG(LOG_CALLS,_("Calling with closure ") << this); + LOG_CALL(_("Calling with closure ") << this); if(obj) obj->decRef(); obj=closure_this.getPtr(); @@ -558,7 +555,7 @@ ASObject* ret; if(isBound()) { /* closure_this can never been overriden */ - LOG(LOG_CALLS,_("Calling with closure ") << this); + LOG_CALL(_("Calling with closure ") << this); if(obj) obj->decRef(); obj=closure_this.getPtr(); @@ -776,12 +773,11 @@ return typeObject ? typeObject->as<Type>() : NULL; } -Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys())),protected_ns(getSys(),"",NAMESPACE),constructor(NULL), +Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys()),T_CLASS),protected_ns(getSys(),"",NAMESPACE),constructor(NULL), freelistsize(0),freelistsize2(0),borrowedVariables(m), context(NULL),class_name(name),memoryAccount(m),length(1),class_index(-1),isFinal(false),isSealed(false),isInterface(false),isReusable(false),isProxy(false),use_protected(false) { setConstant(); - type=T_CLASS; } Class_base::Class_base(const Class_object*):ASObject((MemoryAccount*)NULL),protected_ns(getSys(),BUILTIN_STRINGS::EMPTY,NAMESPACE),constructor(NULL), @@ -1153,7 +1149,7 @@ if(constructor) { - LOG(LOG_CALLS,_("Calling interface init for ") << class_name); + LOG_CALL(_("Calling interface init for ") << class_name); ASObject* ret=constructor->call(c,NULL,0); assert_and_throw(ret==NULL); } @@ -1490,9 +1486,8 @@ return NOT_BINDED; } -ASQName::ASQName(Class_base* c):ASObject(c) +ASQName::ASQName(Class_base* c):ASObject(c,T_QNAME),uri_is_null(false),uri(0),local_name(0) { - type=T_QNAME; uri_is_null=false; } void ASQName::setByXML(XML* node) { @@ -1754,17 +1749,13 @@ } } -Namespace::Namespace(Class_base* c):ASObject(c),nskind(NAMESPACE) +Namespace::Namespace(Class_base* c):ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false) { - type=T_NAMESPACE; - prefix_is_undefined=false; } Namespace::Namespace(Class_base* c, const tiny_string& _uri, const tiny_string& _prefix) - : ASObject(c),nskind(NAMESPACE),uri(_uri),prefix(_prefix) + : ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false),uri(_uri),prefix(_prefix) { - type=T_NAMESPACE; - prefix_is_undefined=false; } void Namespace::sinit(Class_base* c) @@ -2167,7 +2158,7 @@ */ if(ret.isNull() || !context || context->hasRunScriptInit[scriptId]) return ret; - LOG(LOG_CALLS,"Access to " << name << ", running script init"); + LOG_CALL("Access to " << name << ", running script init"); context->runScriptInit(scriptId, this); return ASObject::getVariableByMultiname(name, opt); }
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -175,7 +175,7 @@ } //See BUILTIN_STRINGS enum -static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*" }; +static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*", "http://adobe.com/AS3/2006/builtin" }; extern uint32_t asClassCount; @@ -202,6 +202,10 @@ uint32_t baseId; getUniqueNamespaceId(emptyNs, 0, nsId, baseId); assert(nsId==0 && baseId==0); + //Forge the AS3 namespace and make sure it gets id 1 + nsNameAndKindImpl as3Ns(BUILTIN_STRINGS::STRING_AS3NS, NAMESPACE); + getUniqueNamespaceId(as3Ns, 1, nsId, baseId); + assert(nsId==1 && baseId==1); cookiesFileName = NULL; @@ -1861,8 +1865,7 @@ void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t& nsId, uint32_t& baseId) { - int32_t hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId); - getUniqueNamespaceId(s, hintedId, nsId, baseId); + getUniqueNamespaceId(s, 0xffffffff, nsId, baseId); } void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t hintedId, uint32_t& nsId, uint32_t& baseId) @@ -1871,6 +1874,9 @@ auto it=uniqueNamespaceMap.left.find(s); if(it==uniqueNamespaceMap.left.end()) { + if (hintedId == 0xffffffff) + hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId); + auto ret=uniqueNamespaceMap.left.insert(make_pair(s,hintedId)); assert(ret.second); it=ret.first;
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -1510,21 +1510,18 @@ { nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=_name.empty(); } nsNameAndKind::nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind) { nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=(_name[0]=='\0'); } nsNameAndKind::nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind) { nsNameAndKindImpl tmp(_nameId, _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY; } nsNameAndKind::nsNameAndKind(SystemState* sys, uint32_t _nameId, uint32_t _baseId, NS_KIND _kind) { @@ -1534,7 +1531,6 @@ uint32_t tmpId; sys->getUniqueNamespaceId(tmp, nsRealId, tmpId); assert(tmpId==_baseId); - nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY; } nsNameAndKind::nsNameAndKind(ABCContext* c, uint32_t nsContextIndex) @@ -1547,7 +1543,6 @@ //Special handling for private namespaces, they are always compared by id if(ns.kind==PRIVATE_NAMESPACE) nsId=c->namespaceBaseId+nsContextIndex; - nameIsEmpty=nsNameId==BUILTIN_STRINGS::EMPTY; } const nsNameAndKindImpl& nsNameAndKind::getImpl(SystemState* sys) const
View file
lightspark.tar.xz/src/swftypes.h
Changed
@@ -40,7 +40,7 @@ namespace lightspark { -enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,LAST_BUILTIN_STRING }; +enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,STRING_AS3NS,LAST_BUILTIN_STRING }; enum BUILTIN_NAMESPACES { EMPTY_NS=0 }; @@ -316,8 +316,7 @@ { uint32_t nsId; uint32_t nsRealId; - bool nameIsEmpty; - nsNameAndKind():nsId(0),nsRealId(0),nameIsEmpty(true) {} + nsNameAndKind():nsId(0),nsRealId(0) {} nsNameAndKind(SystemState *sys, const tiny_string& _name, NS_KIND _kind); nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind); nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind); @@ -330,26 +329,26 @@ /* * Special version to create the empty bultin namespace */ - nsNameAndKind(uint32_t id):nsId(id),nsRealId(id),nameIsEmpty(true) + nsNameAndKind(uint32_t id):nsId(id),nsRealId(id) { assert(nsId==0); } - bool operator<(const nsNameAndKind& r) const + inline bool operator<(const nsNameAndKind& r) const { return nsId < r.nsId; } - bool operator>(const nsNameAndKind& r) const + inline bool operator>(const nsNameAndKind& r) const { return nsId > r.nsId; } - bool operator==(const nsNameAndKind& r) const + inline bool operator==(const nsNameAndKind& r) const { return nsId==r.nsId; } const nsNameAndKindImpl& getImpl(SystemState *sys) const; - bool hasEmptyName() const + inline bool hasEmptyName() const { - return nameIsEmpty; + return nsId==0; } };
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ -#include <glibmm/ustring.h> #include "tiny_string.h" #include "exceptions.h" #include "swf.h" @@ -335,14 +334,6 @@ (strncmp(buf+numBytes()-olen,o,olen) == 0); } -/* idx is an index of utf-8 characters */ -uint32_t tiny_string::charAt(uint32_t idx) const -{ - if (isASCII) - return buf[idx]; - return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx)); -} - /* start is an index of characters. * returns index of character */ uint32_t tiny_string::find(const tiny_string& needle, uint32_t start) const
View file
lightspark.tar.xz/src/tiny_string.h
Changed
@@ -26,6 +26,7 @@ #include <list> /* for utf8 handling */ #include <glib.h> +#include <glibmm/ustring.h> #include "compat.h" /* forward declare for tiny_string conversion */ @@ -190,7 +191,12 @@ bool startsWith(const char* o) const; bool endsWith(const char* o) const; /* idx is an index of utf-8 characters */ - uint32_t charAt(uint32_t idx) const; + uint32_t charAt(uint32_t idx) const + { + if (isASCII) + return buf[idx]; + return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx)); + } /* start is an index of characters. * returns index of character */ uint32_t find(const tiny_string& needle, uint32_t start = 0) const;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.