Changes of Revision 108

lightspark.spec Changed
x
 
1
@@ -20,7 +20,7 @@
2
 %bcond_without librtmp
3
 
4
 Name:           lightspark
5
-Version:        0.7.2.99+git20160529.1025
6
+Version:        0.7.2.99+git20160604.1811
7
 Release:        0
8
 Summary:        Modern, free, open-source flash player implementation
9
 License:        LGPL-3.0+
10
lightspark.tar.xz/src/asobject.cpp Changed
168
 
1
@@ -249,9 +249,7 @@
2
    if (r->is<ObjectConstructor>())
3
        return this == r->getClass();
4
 
5
-   LOG(LOG_CALLS,_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType());
6
-   if(classdef)
7
-       LOG(LOG_CALLS,_("Type ") << classdef->class_name);
8
+   LOG_CALL(_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType());
9
    return false;
10
 }
11
 
12
@@ -526,6 +524,8 @@
13
    {
14
        assert(this->is<Class_base>());
15
        obj=this->as<Class_base>()->borrowedVariables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT);
16
+       if (!this->is<Class_inherit>())
17
+           o->setConstant();
18
    }
19
    else
20
        obj=Variables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT);
21
@@ -676,7 +676,7 @@
22
    if(obj->setter)
23
    {
24
        //Call the setter
25
-       LOG(LOG_CALLS,_("Calling the setter"));
26
+       LOG_CALL(_("Calling the setter"));
27
        //Overriding function is automatically done by using cur_level
28
        IFunction* setter=obj->setter;
29
        //One argument can be passed without creating an array
30
@@ -684,7 +684,7 @@
31
        target->incRef();
32
        _R<ASObject> ret= _MR( setter->call(target,&o,1) );
33
        assert_and_throw(ret->is<Undefined>());
34
-       LOG(LOG_CALLS,_("End of setter"));
35
+       LOG_CALL(_("End of setter"));
36
    }
37
    else
38
    {
39
@@ -885,7 +885,7 @@
40
            if (type == Type::anyType)
41
            {
42
                // type could not be found, so it's stored as an uninitialized variable
43
-               LOG(LOG_CALLS,"add uninitialized var:"<<mname<<" "<<*typemname);
44
+               LOG_CALL("add uninitialized var:"<<mname<<" "<<*typemname);
45
                uninitializedVar v;
46
                mainObj->incRef();
47
                v.mainObj = mainObj;
48
@@ -909,7 +909,7 @@
49
                //if (!((Class_base*)type)->super)
50
                {
51
                    // super type could not be found, so the class is stored as an uninitialized variable
52
-                   LOG(LOG_CALLS,"add uninitialized class var:"<<mname);
53
+                   LOG_CALL("add uninitialized class var:"<<mname);
54
                    uninitializedVar v;
55
                    mainObj->incRef();
56
                    v.mainObj = mainObj;
57
@@ -942,7 +942,7 @@
58
    //By default we assume it's a passthrough cast
59
    if(argslen==1)
60
    {
61
-       LOG(LOG_CALLS,_("Passthrough of ") << args[0]);
62
+       LOG_CALL(_("Passthrough of ") << args[0]);
63
        args[0]->incRef();
64
        return args[0];
65
    }
66
@@ -1184,16 +1184,16 @@
67
        ASObject* target=this;
68
        if(target->classdef)
69
        {
70
-           LOG(LOG_CALLS,_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name);
71
+           LOG_CALL(_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name);
72
        }
73
        else
74
        {
75
-           LOG(LOG_CALLS,_("Calling the getter")<< " for "<<name);
76
+           LOG_CALL(_("Calling the getter")<< " for "<<name);
77
        }
78
        IFunction* getter=obj->getter;
79
        target->incRef();
80
        ASObject* ret=getter->call(target,NULL,0);
81
-       LOG(LOG_CALLS,_("End of getter"));
82
+       LOG_CALL(_("End of getter"));
83
        // No incRef because ret is a new instance
84
        return _MNR(ret);
85
    }
86
@@ -1203,7 +1203,7 @@
87
        assert_and_throw(obj->var);
88
        if(obj->var->getObjectType()==T_FUNCTION && obj->var->as<IFunction>()->isMethod())
89
        {
90
-           LOG(LOG_CALLS,"Attaching this " << this << " to function " << name);
91
+           LOG_CALL("Attaching this " << this << " to function " << name);
92
            //the obj reference is acquired by the smart reference
93
            this->incRef();
94
            IFunction* f=obj->var->as<IFunction>()->bind(_MR(this),-1);
95
@@ -1337,10 +1337,9 @@
96
    }
97
 }
98
 
99
-ASObject::ASObject(Class_base* c):Variables((c)?c->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(c?c->sys:NULL),
100
-   type(T_OBJECT),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true)
101
+ASObject::ASObject(Class_base* c,SWFOBJECT_TYPE t):Variables((c)?c->memoryAccount:NULL),classdef(c),proxyMultiName(NULL),sys(c?c->sys:NULL),
102
+   type(t),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true)
103
 {
104
-   setClass(c);
105
 #ifndef NDEBUG
106
    //Stuff only used in debugging
107
    initialized=false;
108
@@ -1350,43 +1349,20 @@
109
 ASObject::ASObject(const ASObject& o):Variables((o.classdef)?o.classdef->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(o.classdef? o.classdef->sys : NULL),
110
    type(o.type),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true)
111
 {
112
-   if(o.classdef)
113
-       setClass(o.classdef);
114
-
115
 #ifndef NDEBUG
116
    //Stuff only used in debugging
117
    initialized=false;
118
 #endif
119
-
120
-   assert_and_throw(o.Variables.size()==0);
121
+   assert(o.Variables.size()==0);
122
 }
123
 
124
 void ASObject::setClass(Class_base* c)
125
 {
126
    if (classdef == c)
127
        return;
128
-   if(classdef)
129
-   {
130
-       classdef->abandonObject(this);
131
-       classdef->decRef();
132
-   }
133
    classdef=c;
134
-   if(classdef)
135
-   {
136
-       classdef->acquireObject(this);
137
-       classdef->incRef();
138
+   if(c)
139
        this->sys = c->sys;
140
-   }
141
-}
142
-
143
-void ASObject::destroy()
144
-{
145
-   if(classdef)
146
-   {
147
-       classdef->abandonObject(this);
148
-       classdef->decRef();
149
-       classdef=NULL;
150
-   }
151
 }
152
 
153
 bool ASObject::destruct()
154
@@ -1479,11 +1455,11 @@
155
    if(obj->getter)
156
    {
157
        //Call the getter
158
-       LOG(LOG_CALLS,_("Calling the getter"));
159
+       LOG_CALL(_("Calling the getter"));
160
        IFunction* getter=obj->getter;
161
        incRef();
162
        _R<ASObject> ret(getter->call(this,NULL,0));
163
-       LOG(LOG_CALLS,_("End of getter"));
164
+       LOG_CALL(_("End of getter"));
165
        return ret;
166
    }
167
    else
168
lightspark.tar.xz/src/asobject.h Changed
14
 
1
@@ -406,9 +406,10 @@
2
    */
3
    bool destruct();
4
    // called when object is really destroyed
5
-   virtual void destroy();
6
+   virtual void destroy(){}
7
 public:
8
-   ASObject(Class_base* c);
9
+   ASObject(Class_base* c,SWFOBJECT_TYPE t = T_OBJECT);
10
+   
11
 #ifndef NDEBUG
12
    //Stuff only used in debugging
13
    bool initialized:1;
14
lightspark.tar.xz/src/backends/decoder.cpp Changed
10
 
1
@@ -869,7 +869,7 @@
2
    if(ret<0)
3
        return;
4
 
5
-   LOG(LOG_CALLS,_("FFMpeg found ") << formatCtx->nb_streams << _(" streams"));
6
+   LOG_CALL(_("FFMpeg found ") << formatCtx->nb_streams << _(" streams"));
7
    for(uint32_t i=0;i<formatCtx->nb_streams;i++)
8
    {
9
        if(formatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO && videoFound==false)
10
lightspark.tar.xz/src/backends/graphics.cpp Changed
10
 
1
@@ -118,7 +118,7 @@
2
        if(w>allocWidth || h>allocHeight) //Destination texture should be reallocated
3
        {
4
            glBindTexture(GL_TEXTURE_2D,texId);
5
-           LOG(LOG_CALLS,_("Reallocating texture to size ") << w << 'x' << h);
6
+           LOG_CALL(_("Reallocating texture to size ") << w << 'x' << h);
7
            setAllocSize(w,h);
8
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, allocWidth, allocHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
9
            if(GLRenderContext::handleGLErrors())
10
lightspark.tar.xz/src/logger.h Changed
23
 
1
@@ -28,6 +28,21 @@
2
 
3
 enum LOG_LEVEL { LOG_ERROR=0, LOG_INFO=1, LOG_NOT_IMPLEMENTED=2,LOG_CALLS=3,LOG_TRACE=4};
4
 
5
+// LOG_CALL will only generate output in DEBUG builds
6
+// this is done because the LOG(LOG_CALLS...) macro creates measurable perfomance loss 
7
+// when used inside the ABCVm::executeFunction loop even on lower log levels
8
+#ifndef NDEBUG
9
+#define LOG_CALL(esp)                  \
10
+do {                           \
11
+   if(LOG_CALLS<=Log::getLevel())          \
12
+   {                       \
13
+       Log l(level);               \
14
+       l() << esp << std::endl;        \
15
+   }                       \
16
+} while(0)
17
+#else
18
+#define LOG_CALL(esp)
19
+#endif
20
 #define LOG(level,esp)                 \
21
 do {                           \
22
    if(level<=Log::getLevel())          \
23
lightspark.tar.xz/src/scripting/abc.cpp Changed
14
 
1
@@ -1009,10 +1009,10 @@
2
 #endif
3
 
4
 /*
5
- * nextNamespaceBase is set to 1 since 0 is the empty namespace
6
+ * nextNamespaceBase is set to 2 since 0 is the empty namespace and 1 is the AS3 namespace
7
  */
8
 ABCVm::ABCVm(SystemState* s, MemoryAccount* m):m_sys(s),status(CREATED),shuttingdown(false),
9
-   events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(1),currentCallContext(NULL),
10
+   events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(2),currentCallContext(NULL),
11
    vmDataMemory(m),cur_recursion(0)
12
 {
13
    limits.max_recursion = 256;
14
lightspark.tar.xz/src/scripting/abc_fast_interpreter.cpp Changed
299
 
1
@@ -78,7 +78,7 @@
2
            case 0x01:
3
            {
4
                //bkpt
5
-               LOG(LOG_CALLS, _("bkpt") );
6
+               LOG_CALL( _("bkpt") );
7
                break;
8
            }
9
            case 0x02:
10
@@ -124,7 +124,7 @@
11
            {
12
                //kill
13
                uint32_t t=data->uints[0];
14
-               LOG(LOG_CALLS, "kill " << t);
15
+               LOG_CALL( "kill " << t);
16
                instructionPointer+=4;
17
                assert_and_throw(context->locals[t]);
18
                context->locals[t]->decRef();
19
@@ -363,7 +363,7 @@
20
            {
21
                //lookupswitch
22
                uint32_t defaultdest=data->uints[0];
23
-               LOG(LOG_CALLS,_("Switch default dest ") << defaultdest);
24
+               LOG_CALL(_("Switch default dest ") << defaultdest);
25
                uint32_t count=data->uints[1];
26
 
27
                ASObject* index_obj=context->runtime_stack_pop();
28
@@ -553,70 +553,70 @@
29
            case 0x35:
30
            {
31
                //li8
32
-               LOG(LOG_CALLS, "li8");
33
+               LOG_CALL( "li8");
34
                loadIntN<uint8_t>(context);
35
                break;
36
            }
37
            case 0x36:
38
            {
39
                //li16
40
-               LOG(LOG_CALLS, "li16");
41
+               LOG_CALL( "li16");
42
                loadIntN<uint16_t>(context);
43
                break;
44
            }
45
            case 0x37:
46
            {
47
                //li32
48
-               LOG(LOG_CALLS, "li32");
49
+               LOG_CALL( "li32");
50
                loadIntN<uint32_t>(context);
51
                break;
52
            }
53
            case 0x38:
54
            {
55
                //lf32
56
-               LOG(LOG_CALLS, "lf32");
57
+               LOG_CALL( "lf32");
58
                loadFloat(context);
59
                break;
60
            }
61
            case 0x39:
62
            {
63
                //lf32
64
-               LOG(LOG_CALLS, "lf64");
65
+               LOG_CALL( "lf64");
66
                loadDouble(context);
67
                break;
68
            }
69
            case 0x3a:
70
            {
71
                //si8
72
-               LOG(LOG_CALLS, "si8");
73
+               LOG_CALL( "si8");
74
                storeIntN<uint8_t>(context);
75
                break;
76
            }
77
            case 0x3b:
78
            {
79
                //si16
80
-               LOG(LOG_CALLS, "si16");
81
+               LOG_CALL( "si16");
82
                storeIntN<uint16_t>(context);
83
                break;
84
            }
85
            case 0x3c:
86
            {
87
                //si32
88
-               LOG(LOG_CALLS, "si32");
89
+               LOG_CALL( "si32");
90
                storeIntN<uint32_t>(context);
91
                break;
92
            }
93
            case 0x3d:
94
            {
95
                //sf32
96
-               LOG(LOG_CALLS, "sf32");
97
+               LOG_CALL( "sf32");
98
                storeFloat(context);
99
                break;
100
            }
101
            case 0x3e:
102
            {
103
                //sf32
104
-               LOG(LOG_CALLS, "sf64");
105
+               LOG_CALL( "sf64");
106
                storeDouble(context);
107
                break;
108
            }
109
@@ -696,7 +696,7 @@
110
            case 0x47:
111
            {
112
                //returnvoid
113
-               LOG(LOG_CALLS,_("returnVoid"));
114
+               LOG_CALL(_("returnVoid"));
115
                PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime));
116
                return NULL;
117
            }
118
@@ -704,7 +704,7 @@
119
            {
120
                //returnvalue
121
                ASObject* ret=context->runtime_stack_pop();
122
-               LOG(LOG_CALLS,_("returnValue ") << ret);
123
+               LOG_CALL(_("returnValue ") << ret);
124
                PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime));
125
                return ret;
126
            }
127
@@ -757,7 +757,7 @@
128
            case 0x50:
129
            {
130
                //sxi1
131
-               LOG(LOG_CALLS, "sxi1");
132
+               LOG_CALL( "sxi1");
133
                ASObject* arg1=context->runtime_stack_pop();
134
                int32_t ret=arg1->toUInt() & 0x1;
135
                arg1->decRef();
136
@@ -767,7 +767,7 @@
137
            case 0x51:
138
            {
139
                //sxi8
140
-               LOG(LOG_CALLS, "sxi8");
141
+               LOG_CALL( "sxi8");
142
                ASObject* arg1=context->runtime_stack_pop();
143
                int32_t ret=(int8_t)arg1->toUInt();
144
                arg1->decRef();
145
@@ -777,7 +777,7 @@
146
            case 0x52:
147
            {
148
                //sxi16
149
-               LOG(LOG_CALLS, "sxi16");
150
+               LOG_CALL( "sxi16");
151
                ASObject* arg1=context->runtime_stack_pop();
152
                int32_t ret=(int16_t)arg1->toUInt();
153
                arg1->decRef();
154
@@ -893,12 +893,12 @@
155
                instructionPointer+=4;
156
                if (!context->locals[i])
157
                {
158
-                   LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined");
159
+                   LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined");
160
                    context->runtime_stack_push(function->getSystemState()->getUndefinedRef());
161
                    break;
162
                }
163
                context->locals[i]->incRef();
164
-               LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
165
+               LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
166
                context->runtime_stack_push(context->locals[i]);
167
                break;
168
            }
169
@@ -907,7 +907,7 @@
170
                //setlocal
171
                uint32_t i=data->uints[0];
172
                instructionPointer+=4;
173
-               LOG(LOG_CALLS, _("setLocal ") << i );
174
+               LOG_CALL( _("setLocal ") << i );
175
                ASObject* obj=context->runtime_stack_pop();
176
                assert_and_throw(obj);
177
                if ((int)i != context->argarrayposition || obj->is<Array>())
178
@@ -1126,7 +1126,7 @@
179
                rewriteableCode[instructionPointer-1]=0xfc;
180
                rewritableData->types[0]=type;
181
 
182
-               LOG(LOG_CALLS,"coerceOnce " << *name);
183
+               LOG_CALL("coerceOnce " << *name);
184
 
185
                ASObject* o=context->runtime_stack_pop();
186
                o=type->coerce(o);
187
@@ -1274,7 +1274,7 @@
188
                {
189
                    int64_t num1=v1->toInt64();
190
                    int64_t num2=v2->toInt64();
191
-                   LOG(LOG_CALLS,_("subtractI ")  << num1 << '-' << num2);
192
+                   LOG_CALL(_("subtractI ")  << num1 << '-' << num2);
193
                    v1->decRef();
194
                    v2->decRef();
195
                    ret = abstract_di(function->getSystemState(), num1-num2);
196
@@ -1297,7 +1297,7 @@
197
                {
198
                    int64_t num1=v1->toInt64();
199
                    int64_t num2=v2->toInt64();
200
-                   LOG(LOG_CALLS,_("multiplyI ")  << num1 << '*' << num2);
201
+                   LOG_CALL(_("multiplyI ")  << num1 << '*' << num2);
202
                    v1->decRef();
203
                    v2->decRef();
204
                    ret = abstract_di(function->getSystemState(), num1*num2);
205
@@ -1330,7 +1330,7 @@
206
                {
207
                    int64_t num1=v1->toInt64();
208
                    int64_t num2=v2->toInt64();
209
-                   LOG(LOG_CALLS,_("moduloI ")  << num1 << '%' << num2);
210
+                   LOG_CALL(_("moduloI ")  << num1 << '%' << num2);
211
                    v1->decRef();
212
                    v2->decRef();
213
                    if (num2 == 0)
214
@@ -1584,11 +1584,11 @@
215
                int i=opcode&3;
216
                if (!context->locals[i])
217
                {
218
-                   LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined");
219
+                   LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined");
220
                    context->runtime_stack_push(function->getSystemState()->getUndefinedRef());
221
                    break;
222
                }
223
-               LOG(LOG_CALLS, "getLocal " << i << ": " << context->locals[i]->toDebugString() );
224
+               LOG_CALL( "getLocal " << i << ": " << context->locals[i]->toDebugString() );
225
                context->locals[i]->incRef();
226
                context->runtime_stack_push(context->locals[i]);
227
                break;
228
@@ -1600,7 +1600,7 @@
229
            {
230
                //setlocal_n
231
                int i=opcode&3;
232
-               LOG(LOG_CALLS, "setLocal " << i );
233
+               LOG_CALL( "setLocal " << i );
234
                ASObject* obj=context->runtime_stack_pop();
235
                if ((int)i != context->argarrayposition || obj->is<Array>())
236
                {
237
@@ -1613,14 +1613,14 @@
238
            case 0xf2:
239
            {
240
                //bkptline
241
-               LOG(LOG_CALLS, _("bkptline") );
242
+               LOG_CALL( _("bkptline") );
243
                instructionPointer+=4;
244
                break;
245
            }
246
            case 0xf3:
247
            {
248
                //timestamp
249
-               LOG(LOG_CALLS, _("timestamp") );
250
+               LOG_CALL( _("timestamp") );
251
                instructionPointer+=4;
252
                break;
253
            }
254
@@ -1634,7 +1634,7 @@
255
                ASObject* value=context->runtime_stack_pop();
256
                ASObject* obj=context->runtime_stack_pop();
257
 
258
-               LOG(LOG_CALLS,"setSlotNoCoerce " << t);
259
+               LOG_CALL("setSlotNoCoerce " << t);
260
                obj->setSlotNoCoerce(t,value);
261
                obj->decRef();
262
                break;
263
@@ -1643,7 +1643,7 @@
264
            {
265
                //coerceearly
266
                const Type* type = data->types[0];
267
-               LOG(LOG_CALLS,"coerceEarly " << type);
268
+               LOG_CALL("coerceEarly " << type);
269
 
270
                ASObject* o=context->runtime_stack_pop();
271
                o=type->coerce(o);
272
@@ -1658,7 +1658,7 @@
273
                //This opcode is similar to getscopeobject, but it allows access to any
274
                //index of the scope stack
275
                uint32_t t=data->uints[0];
276
-               LOG(LOG_CALLS, "getScopeAtIndex " << t);
277
+               LOG_CALL( "getScopeAtIndex " << t);
278
                ASObject* obj;
279
                uint32_t parentsize = context->parent_scope_stack.isNull() ? 0 :context->parent_scope_stack->scope.size();
280
                if (!context->parent_scope_stack.isNull() && t<parentsize)
281
@@ -1679,7 +1679,7 @@
282
                //This opcode execute a lookup on the application domain
283
                //and rewrites itself to a pushearly
284
                const multiname* name=data->names[0];
285
-               LOG(LOG_CALLS, "getLexOnce " << *name);
286
+               LOG_CALL( "getLexOnce " << *name);
287
                ASObject* target;
288
                ASObject* obj=ABCVm::getCurrentApplicationDomain(context)->getVariableAndTargetByMultiname(*name,target);
289
                //The object must exists, since it was found during optimization
290
@@ -1701,7 +1701,7 @@
291
                //pushearly
292
                ASObject* o=data->objs[0];
293
                instructionPointer+=8;
294
-               LOG(LOG_CALLS, "pushEarly " << o);
295
+               LOG_CALL( "pushEarly " << o);
296
                o->incRef();
297
                context->runtime_stack_push(o);
298
                break;
299
lightspark.tar.xz/src/scripting/abc_interpreter.cpp Changed
277
 
1
@@ -74,7 +74,7 @@
2
            case 0x01:
3
            {
4
                //bkpt
5
-               LOG(LOG_CALLS, _("bkpt") );
6
+               LOG_CALL( _("bkpt") );
7
                break;
8
            }
9
            case 0x02:
10
@@ -120,7 +120,7 @@
11
            {
12
                //kill
13
                uint32_t t = code.readu30();
14
-               LOG(LOG_CALLS, "kill " << t);
15
+               LOG_CALL( "kill " << t);
16
                assert_and_throw(context->locals[t]);
17
                context->locals[t]->decRef();
18
                context->locals[t]=function->getSystemState()->getUndefinedRef();
19
@@ -425,13 +425,13 @@
20
                int here=int(code.tellg())-1; //Base for the jumps is the instruction itself for the switch
21
                int32_t t = code.reads24();
22
                int defaultdest=here+t;
23
-               LOG(LOG_CALLS,_("Switch default dest ") << defaultdest);
24
+               LOG_CALL(_("Switch default dest ") << defaultdest);
25
                uint32_t count = code.readu30();
26
                int32_t* offsets=g_newa(int32_t, count+1);
27
                for(unsigned int i=0;i<count+1;i++)
28
                {
29
                    offsets[i] = code.reads24();
30
-                   LOG(LOG_CALLS,_("Switch dest ") << i << ' ' << offsets[i]);
31
+                   LOG_CALL(_("Switch dest ") << i << ' ' << offsets[i]);
32
                }
33
 
34
                ASObject* index_obj=context->runtime_stack_pop();
35
@@ -679,70 +679,70 @@
36
            case 0x35:
37
            {
38
                //li8
39
-               LOG(LOG_CALLS, "li8");
40
+               LOG_CALL( "li8");
41
                loadIntN<uint8_t>(context);
42
                break;
43
            }
44
            case 0x36:
45
            {
46
                //li16
47
-               LOG(LOG_CALLS, "li16");
48
+               LOG_CALL( "li16");
49
                loadIntN<uint16_t>(context);
50
                break;
51
            }
52
            case 0x37:
53
            {
54
                //li32
55
-               LOG(LOG_CALLS, "li32");
56
+               LOG_CALL( "li32");
57
                loadIntN<uint32_t>(context);
58
                break;
59
            }
60
            case 0x38:
61
            {
62
                //lf32
63
-               LOG(LOG_CALLS, "lf32");
64
+               LOG_CALL( "lf32");
65
                loadFloat(context);
66
                break;
67
            }
68
            case 0x39:
69
            {
70
                //lf32
71
-               LOG(LOG_CALLS, "lf64");
72
+               LOG_CALL( "lf64");
73
                loadDouble(context);
74
                break;
75
            }
76
            case 0x3a:
77
            {
78
                //si8
79
-               LOG(LOG_CALLS, "si8");
80
+               LOG_CALL( "si8");
81
                storeIntN<uint8_t>(context);
82
                break;
83
            }
84
            case 0x3b:
85
            {
86
                //si16
87
-               LOG(LOG_CALLS, "si16");
88
+               LOG_CALL( "si16");
89
                storeIntN<uint16_t>(context);
90
                break;
91
            }
92
            case 0x3c:
93
            {
94
                //si32
95
-               LOG(LOG_CALLS, "si32");
96
+               LOG_CALL( "si32");
97
                storeIntN<uint32_t>(context);
98
                break;
99
            }
100
            case 0x3d:
101
            {
102
                //sf32
103
-               LOG(LOG_CALLS, "sf32");
104
+               LOG_CALL( "sf32");
105
                storeFloat(context);
106
                break;
107
            }
108
            case 0x3e:
109
            {
110
                //sf32
111
-               LOG(LOG_CALLS, "sf64");
112
+               LOG_CALL( "sf64");
113
                storeDouble(context);
114
                break;
115
            }
116
@@ -819,7 +819,7 @@
117
            case 0x47:
118
            {
119
                //returnvoid
120
-               LOG(LOG_CALLS,_("returnVoid"));
121
+               LOG_CALL(_("returnVoid"));
122
                PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime));
123
                return NULL;
124
            }
125
@@ -827,7 +827,7 @@
126
            {
127
                //returnvalue
128
                ASObject* ret=context->runtime_stack_pop();
129
-               LOG(LOG_CALLS,_("returnValue ") << ret);
130
+               LOG_CALL(_("returnValue ") << ret);
131
                PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime));
132
                return ret;
133
            }
134
@@ -877,7 +877,7 @@
135
            case 0x50:
136
            {
137
                //sxi1
138
-               LOG(LOG_CALLS, "sxi1");
139
+               LOG_CALL( "sxi1");
140
                ASObject* arg1=context->runtime_stack_pop();
141
                int32_t ret=arg1->toUInt() >>31;
142
                arg1->decRef();
143
@@ -887,7 +887,7 @@
144
            case 0x51:
145
            {
146
                //sxi8
147
-               LOG(LOG_CALLS, "sxi8");
148
+               LOG_CALL( "sxi8");
149
                ASObject* arg1=context->runtime_stack_pop();
150
                int32_t ret=(int8_t)arg1->toUInt();
151
                arg1->decRef();
152
@@ -897,7 +897,7 @@
153
            case 0x52:
154
            {
155
                //sxi16
156
-               LOG(LOG_CALLS, "sxi16");
157
+               LOG_CALL( "sxi16");
158
                ASObject* arg1=context->runtime_stack_pop();
159
                int32_t ret=(int16_t)arg1->toUInt();
160
                arg1->decRef();
161
@@ -1007,12 +1007,12 @@
162
                uint32_t i = code.readu30();
163
                if (!context->locals[i])
164
                {
165
-                   LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined");
166
+                   LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined");
167
                    context->runtime_stack_push(function->getSystemState()->getUndefinedRef());
168
                    break;
169
                }
170
                context->locals[i]->incRef();
171
-               LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
172
+               LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
173
                context->runtime_stack_push(context->locals[i]);
174
                break;
175
            }
176
@@ -1020,7 +1020,7 @@
177
            {
178
                //setlocal
179
                uint32_t i = code.readu30();
180
-               LOG(LOG_CALLS, _("setLocal ") << i );
181
+               LOG_CALL( _("setLocal ") << i );
182
                ASObject* obj=context->runtime_stack_pop();
183
                assert_and_throw(obj);
184
                if ((int)i != context->argarrayposition || obj->is<Array>())
185
@@ -1363,7 +1363,7 @@
186
                {
187
                    int64_t num1=v1->toInt64();
188
                    int64_t num2=v2->toInt64();
189
-                   LOG(LOG_CALLS,_("subtractI ")  << num1 << '-' << num2);
190
+                   LOG_CALL(_("subtractI ")  << num1 << '-' << num2);
191
                    v1->decRef();
192
                    v2->decRef();
193
                    ret = abstract_di(function->getSystemState(), num1-num2);
194
@@ -1386,7 +1386,7 @@
195
                {
196
                    int64_t num1=v1->toInt64();
197
                    int64_t num2=v2->toInt64();
198
-                   LOG(LOG_CALLS,_("multiplyI ")  << num1 << '*' << num2);
199
+                   LOG_CALL(_("multiplyI ")  << num1 << '*' << num2);
200
                    v1->decRef();
201
                    v2->decRef();
202
                    ret = abstract_di(function->getSystemState(), num1*num2);
203
@@ -1419,7 +1419,7 @@
204
                {
205
                    int64_t num1=v1->toInt64();
206
                    int64_t num2=v2->toInt64();
207
-                   LOG(LOG_CALLS,_("moduloI ")  << num1 << '%' << num2);
208
+                   LOG_CALL(_("moduloI ")  << num1 << '%' << num2);
209
                    v1->decRef();
210
                    v2->decRef();
211
                    if (num2 == 0)
212
@@ -1670,11 +1670,11 @@
213
                int i=opcode&3;
214
                if (!context->locals[i])
215
                {
216
-                   LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined");
217
+                   LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined");
218
                    context->runtime_stack_push(function->getSystemState()->getUndefinedRef());
219
                    break;
220
                }
221
-               LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
222
+               LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() );
223
                context->locals[i]->incRef();
224
                context->runtime_stack_push(context->locals[i]);
225
                break;
226
@@ -1686,7 +1686,7 @@
227
            {
228
                //setlocal_n
229
                int i=opcode&3;
230
-               LOG(LOG_CALLS, _("setLocal ") << i);
231
+               LOG_CALL( _("setLocal ") << i);
232
                ASObject* obj=context->runtime_stack_pop();
233
                if ((int)i != context->argarrayposition || obj->is<Array>())
234
                {
235
@@ -1699,7 +1699,7 @@
236
            case 0xef:
237
            {
238
                //debug
239
-               LOG(LOG_CALLS, _("debug") );
240
+               LOG_CALL( _("debug") );
241
                code.readbyte();
242
                code.readu30();
243
                code.readbyte();
244
@@ -1709,28 +1709,28 @@
245
            case 0xf0:
246
            {
247
                //debugline
248
-               LOG(LOG_CALLS, _("debugline") );
249
+               LOG_CALL( _("debugline") );
250
                code.readu30();
251
                break;
252
            }
253
            case 0xf1:
254
            {
255
                //debugfile
256
-               LOG(LOG_CALLS, _("debugfile") );
257
+               LOG_CALL( _("debugfile") );
258
                code.readu30();
259
                break;
260
            }
261
            case 0xf2:
262
            {
263
                //bkptline
264
-               LOG(LOG_CALLS, _("bkptline") );
265
+               LOG_CALL( _("bkptline") );
266
                code.readu30();
267
                break;
268
            }
269
            case 0xf3:
270
            {
271
                //timestamp
272
-               LOG(LOG_CALLS, _("timestamp") );
273
+               LOG_CALL( _("timestamp") );
274
                break;
275
            }
276
            default:
277
lightspark.tar.xz/src/scripting/abc_opcodes.cpp Changed
1467
 
1
@@ -38,7 +38,7 @@
2
    int32_t i2=val2->toInt();
3
    val1->decRef();
4
    val2->decRef();
5
-   LOG(LOG_CALLS,_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec);
6
+   LOG_CALL(_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec);
7
    return i1&i2;
8
 }
9
 
10
@@ -47,13 +47,13 @@
11
    int32_t i1=val1->toInt();
12
    int32_t i2=val2;
13
    val1->decRef();
14
-   LOG(LOG_CALLS,_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec);
15
+   LOG_CALL(_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec);
16
    return i1&i2;
17
 }
18
 
19
 void ABCVm::setProperty(ASObject* value,ASObject* obj,multiname* name)
20
 {
21
-   LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value);
22
+   LOG_CALL(_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value);
23
 
24
    if(obj->is<Null>())
25
    {
26
@@ -72,7 +72,7 @@
27
 
28
 void ABCVm::setProperty_i(int32_t value,ASObject* obj,multiname* name)
29
 {
30
-   LOG(LOG_CALLS,_("setProperty_i ") << *name << ' ' <<obj);
31
+   LOG_CALL(_("setProperty_i ") << *name << ' ' <<obj);
32
    if(obj->is<Null>())
33
    {
34
        LOG(LOG_ERROR,"calling setProperty_i on null:" << *name << ' ' << obj->toDebugString()<<" " << value);
35
@@ -89,7 +89,7 @@
36
 
37
 number_t ABCVm::convert_d(ASObject* o)
38
 {
39
-   LOG(LOG_CALLS, _("convert_d") );
40
+   LOG_CALL( _("convert_d") );
41
    number_t ret=o->toNumber();
42
    o->decRef();
43
    return ret;
44
@@ -97,7 +97,7 @@
45
 
46
 bool ABCVm::convert_b(ASObject* o)
47
 {
48
-   LOG(LOG_CALLS, _("convert_b") );
49
+   LOG_CALL( _("convert_b") );
50
    bool ret=Boolean_concrete(o);
51
    o->decRef();
52
    return ret;
53
@@ -105,7 +105,7 @@
54
 
55
 uint32_t ABCVm::convert_u(ASObject* o)
56
 {
57
-   LOG(LOG_CALLS, _("convert_u") );
58
+   LOG_CALL( _("convert_u") );
59
    uint32_t ret=o->toUInt();
60
    o->decRef();
61
    return ret;
62
@@ -113,7 +113,7 @@
63
 
64
 int32_t ABCVm::convert_i(ASObject* o)
65
 {
66
-   LOG(LOG_CALLS, _("convert_i") );
67
+   LOG_CALL( _("convert_i") );
68
    int32_t ret=o->toInt();
69
    o->decRef();
70
    return ret;
71
@@ -121,7 +121,7 @@
72
 
73
 int64_t ABCVm::convert_di(ASObject* o)
74
 {
75
-   LOG(LOG_CALLS, _("convert_di") );
76
+   LOG_CALL( _("convert_di") );
77
    int64_t ret=o->toInt64();
78
    o->decRef();
79
    return ret;
80
@@ -129,7 +129,7 @@
81
 
82
 ASObject* ABCVm::convert_s(ASObject* o)
83
 {
84
-   LOG(LOG_CALLS, _("convert_s") );
85
+   LOG_CALL( _("convert_s") );
86
    ASObject* ret=o;
87
    if(o->getObjectType()!=T_STRING)
88
    {
89
@@ -141,34 +141,34 @@
90
 
91
 void ABCVm::label()
92
 {
93
-   LOG(LOG_CALLS, _("label") );
94
+   LOG_CALL( _("label") );
95
 }
96
 
97
 void ABCVm::lookupswitch()
98
 {
99
-   LOG(LOG_CALLS, _("lookupswitch") );
100
+   LOG_CALL( _("lookupswitch") );
101
 }
102
 
103
 ASObject* ABCVm::pushUndefined()
104
 {
105
-   LOG(LOG_CALLS, _("pushUndefined") );
106
+   LOG_CALL( _("pushUndefined") );
107
    return getSys()->getUndefinedRef();
108
 }
109
 
110
 ASObject* ABCVm::pushNull()
111
 {
112
-   LOG(LOG_CALLS, _("pushNull") );
113
+   LOG_CALL( _("pushNull") );
114
    return getSys()->getNullRef();
115
 }
116
 
117
 void ABCVm::coerce_a()
118
 {
119
-   LOG(LOG_CALLS, _("coerce_a") );
120
+   LOG_CALL( _("coerce_a") );
121
 }
122
 
123
 ASObject* ABCVm::checkfilter(ASObject* o)
124
 {
125
-   LOG(LOG_CALLS, _("checkfilter") );
126
+   LOG_CALL( _("checkfilter") );
127
    if (!o->is<XML>() && !o->is<XMLList>())
128
        throwError<TypeError>(kFilterError, o->getClassName());
129
    return o;
130
@@ -182,7 +182,7 @@
131
 void ABCVm::coerce(call_context* th, int n)
132
 {
133
    multiname* mn = th->context->getMultiname(n,NULL);
134
-   LOG(LOG_CALLS,"coerce " << *mn);
135
+   LOG_CALL("coerce " << *mn);
136
 
137
    const Type* type = Type::getTypeFromMultiname(mn, th->context);
138
 
139
@@ -193,48 +193,48 @@
140
 
141
 void ABCVm::pop()
142
 {
143
-   LOG(LOG_CALLS, _("pop: DONE") );
144
+   LOG_CALL( _("pop: DONE") );
145
 }
146
 
147
 void ABCVm::getLocal_int(int n, int v)
148
 {
149
-   LOG(LOG_CALLS,_("getLocal[") << n << _("] (int)= ") << dec << v);
150
+   LOG_CALL(_("getLocal[") << n << _("] (int)= ") << dec << v);
151
 }
152
 
153
 void ABCVm::getLocal(ASObject* o, int n)
154
 {
155
-   LOG(LOG_CALLS,_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString());
156
+   LOG_CALL(_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString());
157
 }
158
 
159
 void ABCVm::getLocal_short(int n)
160
 {
161
-   LOG(LOG_CALLS,_("getLocal[") << n << _("]"));
162
+   LOG_CALL(_("getLocal[") << n << _("]"));
163
 }
164
 
165
 void ABCVm::setLocal(int n)
166
 {
167
-   LOG(LOG_CALLS,_("setLocal[") << n << _("]"));
168
+   LOG_CALL(_("setLocal[") << n << _("]"));
169
 }
170
 
171
 void ABCVm::setLocal_int(int n, int v)
172
 {
173
-   LOG(LOG_CALLS,_("setLocal[") << n << _("] (int)= ") << dec << v);
174
+   LOG_CALL(_("setLocal[") << n << _("] (int)= ") << dec << v);
175
 }
176
 
177
 void ABCVm::setLocal_obj(int n, ASObject* v)
178
 {
179
-   LOG(LOG_CALLS,_("setLocal[") << n << _("] = ") << v->toDebugString());
180
+   LOG_CALL(_("setLocal[") << n << _("] = ") << v->toDebugString());
181
 }
182
 
183
 int32_t ABCVm::pushShort(intptr_t n)
184
 {
185
-   LOG(LOG_CALLS, _("pushShort ") << n );
186
+   LOG_CALL( _("pushShort ") << n );
187
    return n;
188
 }
189
 
190
 void ABCVm::setSlot(ASObject* value, ASObject* obj, int n)
191
 {
192
-   LOG(LOG_CALLS,"setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value);
193
+   LOG_CALL("setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value);
194
    obj->setSlot(n,value);
195
    obj->decRef();
196
 }
197
@@ -242,7 +242,7 @@
198
 ASObject* ABCVm::getSlot(ASObject* obj, int n)
199
 {
200
    ASObject* ret=obj->getSlot(n);
201
-   LOG(LOG_CALLS,"getSlot " << n << " " << ret << "=" << ret->toDebugString());
202
+   LOG_CALL("getSlot " << n << " " << ret << "=" << ret->toDebugString());
203
    //getSlot can only access properties defined in the current
204
    //script, so they should already be defind by this script
205
    ret->incRef();
206
@@ -252,7 +252,7 @@
207
 
208
 number_t ABCVm::negate(ASObject* v)
209
 {
210
-   LOG(LOG_CALLS, _("negate") );
211
+   LOG_CALL( _("negate") );
212
    number_t ret=-(v->toNumber());
213
    v->decRef();
214
    return ret;
215
@@ -260,7 +260,7 @@
216
 
217
 int32_t ABCVm::negate_i(ASObject* o)
218
 {
219
-   LOG(LOG_CALLS,_("negate_i"));
220
+   LOG_CALL(_("negate_i"));
221
 
222
    int n=o->toInt();
223
    o->decRef();
224
@@ -271,7 +271,7 @@
225
 {
226
    int32_t i1=val->toInt();
227
    val->decRef();
228
-   LOG(LOG_CALLS,_("bitNot ") << hex << i1 << dec);
229
+   LOG_CALL(_("bitNot ") << hex << i1 << dec);
230
    return ~i1;
231
 }
232
 
233
@@ -281,7 +281,7 @@
234
    int32_t i2=val2->toInt();
235
    val1->decRef();
236
    val2->decRef();
237
-   LOG(LOG_CALLS,_("bitXor ") << hex << i1 << '^' << i2 << dec);
238
+   LOG_CALL(_("bitXor ") << hex << i1 << '^' << i2 << dec);
239
    return i1^i2;
240
 }
241
 
242
@@ -290,7 +290,7 @@
243
    int32_t i1=val1;
244
    int32_t i2=val2->toInt();
245
    val2->decRef();
246
-   LOG(LOG_CALLS,_("bitOr ") << hex << i1 << '|' << i2 << dec);
247
+   LOG_CALL(_("bitOr ") << hex << i1 << '|' << i2 << dec);
248
    return i1|i2;
249
 }
250
 
251
@@ -300,7 +300,7 @@
252
    int32_t i2=val2->toInt();
253
    val1->decRef();
254
    val2->decRef();
255
-   LOG(LOG_CALLS,_("bitOr ") << hex << i1 << '|' << i2 << dec);
256
+   LOG_CALL(_("bitOr ") << hex << i1 << '|' << i2 << dec);
257
    return i1|i2;
258
 }
259
 
260
@@ -311,7 +311,7 @@
261
        args[m-i-1]=th->runtime_stack_pop();
262
 
263
    multiname* name=th->context->getMultiname(n,th);
264
-   LOG(LOG_CALLS, (keepReturn ? "callProperty " : "callPropVoid") << *name << ' ' << m);
265
+   LOG_CALL( (keepReturn ? "callProperty " : "callPropVoid") << *name << ' ' << m);
266
 
267
    ASObject* obj=th->runtime_stack_pop();
268
    checkDeclaredTraits(obj);
269
@@ -379,7 +379,7 @@
270
                        proxyArgs[i+1]=args[i];
271
                    
272
                    //We now suppress special handling
273
-                   LOG(LOG_CALLS,_("Proxy::callProperty"));
274
+                   LOG_CALL(_("Proxy::callProperty"));
275
                    f->incRef();
276
                    obj->incRef();
277
                    ASObject* ret=f->call(obj,proxyArgs,m+1);
278
@@ -394,14 +394,14 @@
279
                    
280
                    obj->decRef();
281
                }
282
-               LOG(LOG_CALLS,_("End of calling ") << *name);
283
+               LOG_CALL(_("End of calling ") << *name);
284
                return;
285
            }
286
            else if(!o.isNull())
287
            {
288
                o->incRef();
289
                callImpl(th, o.getPtr(), obj, args, m, called_mi, keepReturn);
290
-               LOG(LOG_CALLS,_("End of calling ") << *name);
291
+               LOG_CALL(_("End of calling ") << *name);
292
                return;
293
            }
294
        }
295
@@ -438,7 +438,7 @@
296
            th->runtime_stack_push(th->context->root->getSystemState()->getUndefinedRef());
297
 
298
    }
299
-   LOG(LOG_CALLS,_("End of calling ") << *name);
300
+   LOG_CALL(_("End of calling ") << *name);
301
 }
302
 void ABCVm::checkDeclaredTraits(ASObject* obj)
303
 {
304
@@ -455,7 +455,7 @@
305
 
306
 int32_t ABCVm::getProperty_i(ASObject* obj, multiname* name)
307
 {
308
-   LOG(LOG_CALLS, _("getProperty_i ") << *name );
309
+   LOG_CALL( _("getProperty_i ") << *name );
310
    checkDeclaredTraits(obj);
311
 
312
    //TODO: implement exception handling to find out if no integer can be returned
313
@@ -467,7 +467,7 @@
314
 
315
 ASObject* ABCVm::getProperty(ASObject* obj, multiname* name)
316
 {
317
-   LOG(LOG_CALLS, _("getProperty ") << *name << ' ' << obj->toDebugString() << ' '<<obj->isInitialized());
318
+   LOG_CALL( _("getProperty ") << *name << ' ' << obj->toDebugString() << ' '<<obj->isInitialized());
319
    checkDeclaredTraits(obj);
320
        
321
    _NR<ASObject> prop=obj->getVariableByMultiname(*name);
322
@@ -487,8 +487,8 @@
323
    }
324
    else
325
    {
326
-       prop->incRef();
327
        ret=prop.getPtr();
328
+       ret->incRef();
329
    }
330
    obj->decRef();
331
    return ret;
332
@@ -501,14 +501,14 @@
333
 
334
    val1->decRef();
335
    val2->decRef();
336
-   LOG(LOG_CALLS,_("divide ")  << num1 << '/' << num2);
337
+   LOG_CALL(_("divide ")  << num1 << '/' << num2);
338
    return num1/num2;
339
 }
340
 
341
 void ABCVm::pushWith(call_context* th)
342
 {
343
    ASObject* t=th->runtime_stack_pop();
344
-   LOG(LOG_CALLS, _("pushWith ") << t );
345
+   LOG_CALL( _("pushWith ") << t );
346
    t->incRef();
347
    assert_and_throw(th->curr_scope_stack < th->max_scope_stack);
348
    th->scope_stack[th->curr_scope_stack] = t;
349
@@ -519,7 +519,7 @@
350
 void ABCVm::pushScope(call_context* th)
351
 {
352
    ASObject* t=th->runtime_stack_pop();
353
-   LOG(LOG_CALLS, _("pushScope ") << t );
354
+   LOG_CALL( _("pushScope ") << t );
355
    t->incRef();
356
    assert_and_throw(th->curr_scope_stack < th->max_scope_stack);
357
    th->scope_stack[th->curr_scope_stack] = t;
358
@@ -538,14 +538,14 @@
359
        ret =th->scope_stack[0];
360
    }
361
    assert_and_throw(ret->is<Global>());
362
-   LOG(LOG_CALLS,_("getGlobalScope: ") << ret);
363
+   LOG_CALL(_("getGlobalScope: ") << ret);
364
    ret->incRef();
365
    return ret->as<Global>();
366
 }
367
 
368
 number_t ABCVm::decrement(ASObject* o)
369
 {
370
-   LOG(LOG_CALLS,_("decrement"));
371
+   LOG_CALL(_("decrement"));
372
 
373
    number_t n=o->toNumber();
374
    o->decRef();
375
@@ -554,7 +554,7 @@
376
 
377
 uint32_t ABCVm::decrement_i(ASObject* o)
378
 {
379
-   LOG(LOG_CALLS,_("decrement_i"));
380
+   LOG_CALL(_("decrement_i"));
381
 
382
    int32_t n=o->toInt();
383
    o->decRef();
384
@@ -563,7 +563,7 @@
385
 
386
 uint64_t ABCVm::decrement_di(ASObject* o)
387
 {
388
-   LOG(LOG_CALLS,_("decrement_di"));
389
+   LOG_CALL(_("decrement_di"));
390
 
391
    int64_t n=o->toInt64();
392
    o->decRef();
393
@@ -574,7 +574,7 @@
394
 {
395
    //Real comparision demanded to object
396
    bool ret=!(obj1->isLess(obj2)==TTRUE);
397
-   LOG(LOG_CALLS,_("ifNLT (") << ((ret)?_("taken)"):_("not taken)")));
398
+   LOG_CALL(_("ifNLT (") << ((ret)?_("taken)"):_("not taken)")));
399
 
400
    obj2->decRef();
401
    obj1->decRef();
402
@@ -585,7 +585,7 @@
403
 {
404
    //Real comparision demanded to object
405
    bool ret=(obj1->isLess(obj2)==TTRUE);
406
-   LOG(LOG_CALLS,_("ifLT (") << ((ret)?_("taken)"):_("not taken)")));
407
+   LOG_CALL(_("ifLT (") << ((ret)?_("taken)"):_("not taken)")));
408
 
409
    obj2->decRef();
410
    obj1->decRef();
411
@@ -594,7 +594,7 @@
412
 
413
 bool ABCVm::ifLT_oi(ASObject* obj2, int32_t val1)
414
 {
415
-   LOG(LOG_CALLS,_("ifLT_oi"));
416
+   LOG_CALL(_("ifLT_oi"));
417
 
418
    //As ECMA said, on NaN return undefined... and undefined means not jump
419
    bool ret;
420
@@ -609,7 +609,7 @@
421
 
422
 bool ABCVm::ifLT_io(int32_t val2, ASObject* obj1)
423
 {
424
-   LOG(LOG_CALLS,_("ifLT_io "));
425
+   LOG_CALL(_("ifLT_io "));
426
 
427
    bool ret=obj1->toInt()<val2;
428
 
429
@@ -621,7 +621,7 @@
430
 {
431
    //Real comparision demanded to object
432
    bool ret=!(obj1->isEqual(obj2));
433
-   LOG(LOG_CALLS,_("ifNE (") << ((ret)?_("taken)"):_("not taken)")));
434
+   LOG_CALL(_("ifNE (") << ((ret)?_("taken)"):_("not taken)")));
435
 
436
    obj2->decRef();
437
    obj1->decRef();
438
@@ -634,7 +634,7 @@
439
    if(obj1->getObjectType()==T_UNDEFINED)
440
        return false;
441
    bool ret=obj1->toInt()!=val2;
442
-   LOG(LOG_CALLS,_("ifNE (") << ((ret)?_("taken)"):_("not taken)")));
443
+   LOG_CALL(_("ifNE (") << ((ret)?_("taken)"):_("not taken)")));
444
 
445
    obj1->decRef();
446
    return ret;
447
@@ -642,7 +642,7 @@
448
 
449
 int32_t ABCVm::pushByte(intptr_t n)
450
 {
451
-   LOG(LOG_CALLS, _("pushByte ") << n );
452
+   LOG_CALL( _("pushByte ") << n );
453
    return n;
454
 }
455
 
456
@@ -651,7 +651,7 @@
457
    double num1=val1;
458
    double num2=val2->toNumber();
459
    val2->decRef();
460
-   LOG(LOG_CALLS,_("multiply_oi ")  << num1 << '*' << num2);
461
+   LOG_CALL(_("multiply_oi ")  << num1 << '*' << num2);
462
    return num1*num2;
463
 }
464
 
465
@@ -661,7 +661,7 @@
466
    double num2=val2->toNumber();
467
    val1->decRef();
468
    val2->decRef();
469
-   LOG(LOG_CALLS,_("multiply ")  << num1 << '*' << num2);
470
+   LOG_CALL(_("multiply ")  << num1 << '*' << num2);
471
    return num1*num2;
472
 }
473
 
474
@@ -671,13 +671,13 @@
475
    int num2=val2->toInt();
476
    val1->decRef();
477
    val2->decRef();
478
-   LOG(LOG_CALLS,_("multiply ")  << num1 << '*' << num2);
479
+   LOG_CALL(_("multiply ")  << num1 << '*' << num2);
480
    return num1*num2;
481
 }
482
 
483
 void ABCVm::incLocal(call_context* th, int n)
484
 {
485
-   LOG(LOG_CALLS, _("incLocal ") << n );
486
+   LOG_CALL( _("incLocal ") << n );
487
    number_t tmp=th->locals[n]->toNumber();
488
    th->locals[n]->decRef();
489
    th->locals[n]=abstract_d(th->context->root->getSystemState(),tmp+1);
490
@@ -685,7 +685,7 @@
491
 
492
 void ABCVm::incLocal_i(call_context* th, int n)
493
 {
494
-   LOG(LOG_CALLS, _("incLocal_i ") << n );
495
+   LOG_CALL( _("incLocal_i ") << n );
496
    int32_t tmp=th->locals[n]->toInt();
497
    th->locals[n]->decRef();
498
    th->locals[n]=abstract_i(th->context->root->getSystemState(),tmp+1);
499
@@ -693,7 +693,7 @@
500
 
501
 void ABCVm::decLocal(call_context* th, int n)
502
 {
503
-   LOG(LOG_CALLS, _("decLocal ") << n );
504
+   LOG_CALL( _("decLocal ") << n );
505
    number_t tmp=th->locals[n]->toNumber();
506
    th->locals[n]->decRef();
507
    th->locals[n]=abstract_d(th->context->root->getSystemState(),tmp-1);
508
@@ -701,7 +701,7 @@
509
 
510
 void ABCVm::decLocal_i(call_context* th, int n)
511
 {
512
-   LOG(LOG_CALLS, _("decLocal_i ") << n );
513
+   LOG_CALL( _("decLocal_i ") << n );
514
    int32_t tmp=th->locals[n]->toInt();
515
    th->locals[n]->decRef();
516
    th->locals[n]=abstract_i(th->context->root->getSystemState(),tmp-1);
517
@@ -727,7 +727,7 @@
518
        SyntheticFunction* sf=f->as<SyntheticFunction>();
519
        if (sf->mi->body && !sf->mi->needsActivation())
520
        {
521
-           LOG(LOG_CALLS,_("Building method traits"));
522
+           LOG_CALL(_("Building method traits"));
523
            for(unsigned int i=0;i<sf->mi->body->trait_count;i++)
524
                th->context->buildTrait(ret,&sf->mi->body->traits[i],false);
525
        }
526
@@ -759,14 +759,14 @@
527
 
528
 void ABCVm::construct(call_context* th, int m)
529
 {
530
-   LOG(LOG_CALLS, _("construct ") << m);
531
+   LOG_CALL( _("construct ") << m);
532
    ASObject** args=g_newa(ASObject*, m);
533
    for(int i=0;i<m;i++)
534
        args[m-i-1]=th->runtime_stack_pop();
535
 
536
    ASObject* obj=th->runtime_stack_pop();
537
 
538
-   LOG(LOG_CALLS,_("Constructing"));
539
+   LOG_CALL(_("Constructing"));
540
 
541
    ASObject* ret;
542
    switch(obj->getObjectType())
543
@@ -799,13 +799,13 @@
544
    }
545
    ret->setConstructorCallComplete();
546
    obj->decRef();
547
-   LOG(LOG_CALLS,_("End of constructing ") << ret);
548
+   LOG_CALL(_("End of constructing ") << ret);
549
    th->runtime_stack_push(ret);
550
 }
551
 
552
 void ABCVm::constructGenericType(call_context* th, int m)
553
 {
554
-   LOG(LOG_CALLS, _("constructGenericType ") << m);
555
+   LOG_CALL( _("constructGenericType ") << m);
556
    if (m != 1)
557
        throwError<TypeError>(kWrongTypeArgCountError, "function", "1", Integer::toString(m));
558
    ASObject** args=g_newa(ASObject*, m);
559
@@ -867,7 +867,7 @@
560
 
561
 ASObject* ABCVm::typeOf(ASObject* obj)
562
 {
563
-   LOG(LOG_CALLS,_("typeOf"));
564
+   LOG_CALL(_("typeOf"));
565
    string ret;
566
    switch(obj->getObjectType())
567
    {
568
@@ -912,13 +912,13 @@
569
 
570
 void ABCVm::jump(int offset)
571
 {
572
-   LOG(LOG_CALLS,_("jump ") << offset);
573
+   LOG_CALL(_("jump ") << offset);
574
 }
575
 
576
 bool ABCVm::ifTrue(ASObject* obj1)
577
 {
578
    bool ret=Boolean_concrete(obj1);
579
-   LOG(LOG_CALLS,_("ifTrue (") << ((ret)?_("taken)"):_("not taken)")));
580
+   LOG_CALL(_("ifTrue (") << ((ret)?_("taken)"):_("not taken)")));
581
 
582
    obj1->decRef();
583
    return ret;
584
@@ -931,7 +931,7 @@
585
 
586
    val1->decRef();
587
    val2->decRef();
588
-   LOG(LOG_CALLS,_("modulo ")  << num1 << '%' << num2);
589
+   LOG_CALL(_("modulo ")  << num1 << '%' << num2);
590
    /* fmod returns NaN if num2 == 0 as the spec mandates */
591
    return ::fmod(num1,num2);
592
 }
593
@@ -942,7 +942,7 @@
594
    int num1=val1;
595
 
596
    val2->decRef();
597
-   LOG(LOG_CALLS,_("subtract_oi ") << num1 << '-' << num2);
598
+   LOG_CALL(_("subtract_oi ") << num1 << '-' << num2);
599
    return num1-num2;
600
 }
601
 
602
@@ -952,7 +952,7 @@
603
    number_t num1=val1->toNumber();
604
 
605
    val1->decRef();
606
-   LOG(LOG_CALLS,_("subtract_do ") << num1 << '-' << num2);
607
+   LOG_CALL(_("subtract_do ") << num1 << '-' << num2);
608
    return num1-num2;
609
 }
610
 
611
@@ -968,7 +968,7 @@
612
    int num1=val1->toInt();
613
 
614
    val1->decRef();
615
-   LOG(LOG_CALLS,_("subtract_io ") << dec << num1 << '-' << num2);
616
+   LOG_CALL(_("subtract_io ") << dec << num1 << '-' << num2);
617
    return num1-num2;
618
 }
619
 
620
@@ -986,7 +986,7 @@
621
 
622
    val1->decRef();
623
    val2->decRef();
624
-   LOG(LOG_CALLS,_("subtract_i ") << num1 << '-' << num2);
625
+   LOG_CALL(_("subtract_i ") << num1 << '-' << num2);
626
    return num1-num2;
627
 }
628
 
629
@@ -997,28 +997,28 @@
630
 
631
    val1->decRef();
632
    val2->decRef();
633
-   LOG(LOG_CALLS,_("subtract ") << num1 << '-' << num2);
634
+   LOG_CALL(_("subtract ") << num1 << '-' << num2);
635
    return num1-num2;
636
 }
637
 
638
 void ABCVm::pushUInt(call_context* th, uint32_t i)
639
 {
640
-   LOG(LOG_CALLS, "pushUInt " << i);
641
+   LOG_CALL( "pushUInt " << i);
642
 }
643
 
644
 void ABCVm::pushInt(call_context* th, int32_t i)
645
 {
646
-   LOG(LOG_CALLS, "pushInt " << i);
647
+   LOG_CALL( "pushInt " << i);
648
 }
649
 
650
 void ABCVm::pushDouble(call_context* th, double d)
651
 {
652
-   LOG(LOG_CALLS, "pushDouble " << d);
653
+   LOG_CALL( "pushDouble " << d);
654
 }
655
 
656
 void ABCVm::kill(int n)
657
 {
658
-   LOG(LOG_CALLS, _("kill ") << n );
659
+   LOG_CALL( _("kill ") << n );
660
 }
661
 
662
 ASObject* ABCVm::add(ASObject* val2, ASObject* val1)
663
@@ -1032,7 +1032,7 @@
664
    {
665
        int64_t num1=val1->toInt64();
666
        int64_t num2=val2->toInt64();
667
-       LOG(LOG_CALLS,"addI " << num1 << '+' << num2);
668
+       LOG_CALL("addI " << num1 << '+' << num2);
669
        res = abstract_di(val1->getSystemState(), num1+num2);
670
        val1->decRef();
671
        val2->decRef();
672
@@ -1042,7 +1042,7 @@
673
    {
674
        double num1=val1->as<Number>()->toNumber();
675
        double num2=val2->as<Number>()->toNumber();
676
-       LOG(LOG_CALLS,"addN " << num1 << '+' << num2);
677
+       LOG_CALL("addN " << num1 << '+' << num2);
678
        res = abstract_d(val1->getSystemState(), num1+num2);
679
        val1->decRef();
680
        val2->decRef();
681
@@ -1052,7 +1052,7 @@
682
    {
683
        tiny_string a = val1->toString();
684
        tiny_string b = val2->toString();
685
-       LOG(LOG_CALLS,"add " << a << '+' << b);
686
+       LOG_CALL("add " << a << '+' << b);
687
        res = abstract_s(val1->getSystemState(),a + b);
688
        val1->decRef();
689
        val2->decRef();
690
@@ -1086,7 +1086,7 @@
691
        {//If one is String, convert both to strings and concat
692
            string a(val1p->toString().raw_buf());
693
            string b(val2p->toString().raw_buf());
694
-           LOG(LOG_CALLS,"add " << a << '+' << b);
695
+           LOG_CALL("add " << a << '+' << b);
696
            res = abstract_s(val1->getSystemState(),a+b);
697
            val1->decRef();
698
            val2->decRef();
699
@@ -1096,7 +1096,7 @@
700
        {//Convert both to numbers and add
701
            number_t num1=val1p->toNumber();
702
            number_t num2=val2p->toNumber();
703
-           LOG(LOG_CALLS,"addN " << num1 << '+' << num2);
704
+           LOG_CALL("addN " << num1 << '+' << num2);
705
            number_t result = num1 + num2;
706
            res = abstract_d(val1->getSystemState(),result);
707
            val1->decRef();
708
@@ -1121,7 +1121,7 @@
709
 
710
    val1->decRef();
711
    val2->decRef();
712
-   LOG(LOG_CALLS,_("add_i ") << num1 << '+' << num2);
713
+   LOG_CALL(_("add_i ") << num1 << '+' << num2);
714
    return num1+num2;
715
 }
716
 
717
@@ -1136,7 +1136,7 @@
718
        int32_t num1=val1;
719
        res = abstract_i(val2->getSystemState(),num1+num2);
720
        val2->decRef();
721
-       LOG(LOG_CALLS,_("add ") << num1 << '+' << num2);
722
+       LOG_CALL(_("add ") << num1 << '+' << num2);
723
        return res;
724
    }
725
    else if(val2->getObjectType()==T_NUMBER)
726
@@ -1145,7 +1145,7 @@
727
        double num1=val1;
728
        res = abstract_d(val2->getSystemState(),num1+num2);
729
        val2->decRef();
730
-       LOG(LOG_CALLS,_("add ") << num1 << '+' << num2);
731
+       LOG_CALL(_("add ") << num1 << '+' << num2);
732
        return res;
733
    }
734
    else if(val2->getObjectType()==T_STRING)
735
@@ -1155,7 +1155,7 @@
736
        const tiny_string& b=val2->toString();
737
        res = abstract_s(val2->getSystemState(), a+b);
738
        val2->decRef();
739
-       LOG(LOG_CALLS,_("add ") << a << '+' << b);
740
+       LOG_CALL(_("add ") << a << '+' << b);
741
        return res;
742
    }
743
    else
744
@@ -1175,7 +1175,7 @@
745
        double num1=val1;
746
        res = abstract_d(val2->getSystemState(),num1+num2);
747
        val2->decRef();
748
-       LOG(LOG_CALLS,_("add ") << num1 << '+' << num2);
749
+       LOG_CALL(_("add ") << num1 << '+' << num2);
750
        return res;
751
    }
752
    else if(val2->getObjectType()==T_INTEGER)
753
@@ -1184,7 +1184,7 @@
754
        double num1=val1;
755
        res = abstract_d(val2->getSystemState(),num1+num2);
756
        val2->decRef();
757
-       LOG(LOG_CALLS,_("add ") << num1 << '+' << num2);
758
+       LOG_CALL(_("add ") << num1 << '+' << num2);
759
        return res;
760
    }
761
    else if(val2->getObjectType()==T_STRING)
762
@@ -1193,7 +1193,7 @@
763
        const tiny_string& b=val2->toString();
764
        res = abstract_s(val2->getSystemState(),a+b);
765
        val2->decRef();
766
-       LOG(LOG_CALLS,_("add ") << a << '+' << b);
767
+       LOG_CALL(_("add ") << a << '+' << b);
768
        return res;
769
    }
770
    else
771
@@ -1209,7 +1209,7 @@
772
    uint32_t i1=val1->toUInt()&0x1f;
773
    val1->decRef();
774
    val2->decRef();
775
-   LOG(LOG_CALLS,_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec);
776
+   LOG_CALL(_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec);
777
    //Left shift are supposed to always work in 32bit
778
    int32_t ret=i2<<i1;
779
    return ret;
780
@@ -1220,7 +1220,7 @@
781
    int32_t i2=val2->toInt();
782
    uint32_t i1=val1&0x1f;
783
    val2->decRef();
784
-   LOG(LOG_CALLS,_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec);
785
+   LOG_CALL(_("lShift ")<<hex<<i2<<_("<<")<<i1<<dec);
786
    //Left shift are supposed to always work in 32bit
787
    int32_t ret=i2<<i1;
788
    return ret;
789
@@ -1232,7 +1232,7 @@
790
    uint32_t i1=val1->toUInt()&0x1f;
791
    val1->decRef();
792
    val2->decRef();
793
-   LOG(LOG_CALLS,_("rShift ")<<hex<<i2<<_(">>")<<i1<<dec);
794
+   LOG_CALL(_("rShift ")<<hex<<i2<<_(">>")<<i1<<dec);
795
    return i2>>i1;
796
 }
797
 
798
@@ -1242,7 +1242,7 @@
799
    uint32_t i1=val1->toUInt()&0x1f;
800
    val1->decRef();
801
    val2->decRef();
802
-   LOG(LOG_CALLS,_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec);
803
+   LOG_CALL(_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec);
804
    return i2>>i1;
805
 }
806
 
807
@@ -1251,13 +1251,13 @@
808
    uint32_t i2=val2->toUInt();
809
    uint32_t i1=val1&0x1f;
810
    val2->decRef();
811
-   LOG(LOG_CALLS,_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec);
812
+   LOG_CALL(_("urShift ")<<hex<<i2<<_(">>")<<i1<<dec);
813
    return i2>>i1;
814
 }
815
 
816
 bool ABCVm::_not(ASObject* v)
817
 {
818
-   LOG(LOG_CALLS, _("not") );
819
+   LOG_CALL( _("not") );
820
    bool ret=!Boolean_concrete(v);
821
    v->decRef();
822
    return ret;
823
@@ -1266,7 +1266,7 @@
824
 bool ABCVm::equals(ASObject* val2, ASObject* val1)
825
 {
826
    bool ret=val1->isEqual(val2);
827
-   LOG(LOG_CALLS, _("equals ") << ret);
828
+   LOG_CALL( _("equals ") << ret);
829
    val1->decRef();
830
    val2->decRef();
831
    return ret;
832
@@ -1311,7 +1311,7 @@
833
 
834
 bool ABCVm::strictEquals(ASObject* obj2, ASObject* obj1)
835
 {
836
-   LOG(LOG_CALLS, _("strictEquals") );
837
+   LOG_CALL( _("strictEquals") );
838
    bool ret=strictEqualImpl(obj1, obj2);
839
    obj1->decRef();
840
    obj2->decRef();
841
@@ -1320,24 +1320,24 @@
842
 
843
 void ABCVm::dup()
844
 {
845
-   LOG(LOG_CALLS, _("dup: DONE") );
846
+   LOG_CALL( _("dup: DONE") );
847
 }
848
 
849
 bool ABCVm::pushTrue()
850
 {
851
-   LOG(LOG_CALLS, _("pushTrue") );
852
+   LOG_CALL( _("pushTrue") );
853
    return true;
854
 }
855
 
856
 bool ABCVm::pushFalse()
857
 {
858
-   LOG(LOG_CALLS, _("pushFalse") );
859
+   LOG_CALL( _("pushFalse") );
860
    return false;
861
 }
862
 
863
 ASObject* ABCVm::pushNaN()
864
 {
865
-   LOG(LOG_CALLS, _("pushNaN") );
866
+   LOG_CALL( _("pushNaN") );
867
    return abstract_d(getSys(),Number::NaN);
868
 }
869
 
870
@@ -1345,7 +1345,7 @@
871
 {
872
    //Real comparision demanded to object
873
    bool ret=(obj2->isLess(obj1)==TTRUE);
874
-   LOG(LOG_CALLS,_("ifGT (") << ((ret)?_("taken)"):_("not taken)")));
875
+   LOG_CALL(_("ifGT (") << ((ret)?_("taken)"):_("not taken)")));
876
 
877
    obj2->decRef();
878
    obj1->decRef();
879
@@ -1357,7 +1357,7 @@
880
 
881
    //Real comparision demanded to object
882
    bool ret=!(obj2->isLess(obj1)==TTRUE);
883
-   LOG(LOG_CALLS,_("ifNGT (") << ((ret)?_("taken)"):_("not taken)")));
884
+   LOG_CALL(_("ifNGT (") << ((ret)?_("taken)"):_("not taken)")));
885
 
886
    obj2->decRef();
887
    obj1->decRef();
888
@@ -1368,7 +1368,7 @@
889
 {
890
    //Real comparision demanded to object
891
    bool ret=(obj2->isLess(obj1)==TFALSE);
892
-   LOG(LOG_CALLS,_("ifLE (") << ((ret)?_("taken)"):_("not taken)")));
893
+   LOG_CALL(_("ifLE (") << ((ret)?_("taken)"):_("not taken)")));
894
    obj1->decRef();
895
    obj2->decRef();
896
    return ret;
897
@@ -1378,7 +1378,7 @@
898
 {
899
    //Real comparision demanded to object
900
    bool ret=!(obj2->isLess(obj1)==TFALSE);
901
-   LOG(LOG_CALLS,_("ifNLE (") << ((ret)?_("taken)"):_("not taken)")));
902
+   LOG_CALL(_("ifNLE (") << ((ret)?_("taken)"):_("not taken)")));
903
    obj1->decRef();
904
    obj2->decRef();
905
    return ret;
906
@@ -1388,7 +1388,7 @@
907
 {
908
    //Real comparision demanded to object
909
    bool ret=(obj1->isLess(obj2)==TFALSE);
910
-   LOG(LOG_CALLS,_("ifGE (") << ((ret)?_("taken)"):_("not taken)")));
911
+   LOG_CALL(_("ifGE (") << ((ret)?_("taken)"):_("not taken)")));
912
    obj1->decRef();
913
    obj2->decRef();
914
    return ret;
915
@@ -1398,7 +1398,7 @@
916
 {
917
    //Real comparision demanded to object
918
    bool ret=!(obj1->isLess(obj2)==TFALSE);
919
-   LOG(LOG_CALLS,_("ifNGE (") << ((ret)?_("taken)"):_("not taken)")));
920
+   LOG_CALL(_("ifNGE (") << ((ret)?_("taken)"):_("not taken)")));
921
    obj1->decRef();
922
    obj2->decRef();
923
    return ret;
924
@@ -1406,7 +1406,7 @@
925
 
926
 void ABCVm::_throw(call_context* th)
927
 {
928
-   LOG(LOG_CALLS,_("throw"));
929
+   LOG_CALL(_("throw"));
930
    throw th->runtime_stack_pop();
931
 }
932
 
933
@@ -1414,7 +1414,7 @@
934
 {
935
    ASObject* value=th->runtime_stack_pop();
936
    multiname* name=th->context->getMultiname(n,th);
937
-   LOG(LOG_CALLS,_("setSuper ") << *name);
938
+   LOG_CALL(_("setSuper ") << *name);
939
 
940
    ASObject* obj=th->runtime_stack_pop();
941
 
942
@@ -1431,7 +1431,7 @@
943
 void ABCVm::getSuper(call_context* th, int n)
944
 {
945
    multiname* name=th->context->getMultiname(n,th);
946
-   LOG(LOG_CALLS,_("getSuper ") << *name);
947
+   LOG_CALL(_("getSuper ") << *name);
948
 
949
    ASObject* obj=th->runtime_stack_pop();
950
 
951
@@ -1469,7 +1469,7 @@
952
    //getlex is specified not to allow runtime multinames
953
    assert_and_throw(th->context->getMultinameRTData(n)==0);
954
    multiname* name=th->context->getMultiname(n,NULL);
955
-   LOG(LOG_CALLS, "getLex: " << *name );
956
+   LOG_CALL( "getLex: " << *name );
957
    vector<scope_entry>::reverse_iterator it;
958
    // o will be a reference owned by this function (or NULL). At
959
    // the end the reference will be handed over to the runtime
960
@@ -1541,7 +1541,7 @@
961
 
962
 void ABCVm::constructSuper(call_context* th, int m)
963
 {
964
-   LOG(LOG_CALLS, _("constructSuper ") << m);
965
+   LOG_CALL( _("constructSuper ") << m);
966
    ASObject** args=g_newa(ASObject*, m);
967
    for(int i=0;i<m;i++)
968
        args[m-i-1]=th->runtime_stack_pop();
969
@@ -1552,16 +1552,16 @@
970
    assert_and_throw(th->inClass->super);
971
    assert_and_throw(obj->getClass());
972
    assert_and_throw(obj->getClass()->isSubClass(th->inClass));
973
-   LOG(LOG_CALLS,_("Super prototype name ") << th->inClass->super->class_name);
974
+   LOG_CALL(_("Super prototype name ") << th->inClass->super->class_name);
975
 
976
    th->inClass->super->handleConstruction(obj,args, m, false);
977
    obj->decRef();
978
-   LOG(LOG_CALLS,_("End super construct "));
979
+   LOG_CALL(_("End super construct "));
980
 }
981
 
982
 ASObject* ABCVm::findProperty(call_context* th, multiname* name)
983
 {
984
-   LOG(LOG_CALLS, _("findProperty ") << *name );
985
+   LOG_CALL( _("findProperty ") << *name );
986
 
987
    vector<scope_entry>::reverse_iterator it;
988
    bool found=false;
989
@@ -1618,7 +1618,7 @@
990
 
991
 ASObject* ABCVm::findPropStrict(call_context* th, multiname* name)
992
 {
993
-   LOG(LOG_CALLS, "findPropStrict " << *name );
994
+   LOG_CALL( "findPropStrict " << *name );
995
 
996
    vector<scope_entry>::reverse_iterator it;
997
    bool found=false;
998
@@ -1680,7 +1680,7 @@
999
 
1000
 bool ABCVm::greaterThan(ASObject* obj1, ASObject* obj2)
1001
 {
1002
-   LOG(LOG_CALLS,_("greaterThan"));
1003
+   LOG_CALL(_("greaterThan"));
1004
 
1005
    //Real comparision demanded to object
1006
    bool ret=(obj2->isLess(obj1)==TTRUE);
1007
@@ -1691,7 +1691,7 @@
1008
 
1009
 bool ABCVm::greaterEquals(ASObject* obj1, ASObject* obj2)
1010
 {
1011
-   LOG(LOG_CALLS,_("greaterEquals"));
1012
+   LOG_CALL(_("greaterEquals"));
1013
 
1014
    //Real comparision demanded to object
1015
    bool ret=(obj1->isLess(obj2)==TFALSE);
1016
@@ -1702,7 +1702,7 @@
1017
 
1018
 bool ABCVm::lessEquals(ASObject* obj1, ASObject* obj2)
1019
 {
1020
-   LOG(LOG_CALLS,_("lessEquals"));
1021
+   LOG_CALL(_("lessEquals"));
1022
 
1023
    //Real comparision demanded to object
1024
    bool ret=(obj2->isLess(obj1)==TFALSE);
1025
@@ -1755,7 +1755,7 @@
1026
            args[i]->decRef();
1027
        throwError<ReferenceError>(kCallNotFoundError, "?", clsname);
1028
    }
1029
-   LOG(LOG_CALLS,"End of callStatic ");
1030
+   LOG_CALL("End of callStatic ");
1031
 }
1032
 
1033
 void ABCVm::callSuper(call_context* th, int n, int m, method_info** called_mi, bool keepReturn)
1034
@@ -1765,7 +1765,7 @@
1035
        args[m-i-1]=th->runtime_stack_pop();
1036
 
1037
    multiname* name=th->context->getMultiname(n,th);
1038
-   LOG(LOG_CALLS,(keepReturn ? "callSuper " : "callSuperVoid ") << *name << ' ' << m);
1039
+   LOG_CALL((keepReturn ? "callSuper " : "callSuperVoid ") << *name << ' ' << m);
1040
 
1041
    ASObject* obj=th->runtime_stack_pop();
1042
    if(obj->is<Null>())
1043
@@ -1799,7 +1799,7 @@
1044
        //LOG(LOG_ERROR,_("Calling an undefined function ") << th->context->root->getSystemState()->getStringFromUniqueId(name->name_s_id));
1045
        throwError<ReferenceError>(kCallNotFoundError, name->qualifiedString(th->context->root->getSystemState()), clsname);
1046
    }
1047
-   LOG(LOG_CALLS,_("End of callSuper ") << *name);
1048
+   LOG_CALL(_("End of callSuper ") << *name);
1049
 }
1050
 
1051
 bool ABCVm::isType(ABCContext* context, ASObject* obj, multiname* name)
1052
@@ -1811,7 +1811,7 @@
1053
 
1054
 bool ABCVm::isTypelate(ASObject* type, ASObject* obj)
1055
 {
1056
-   LOG(LOG_CALLS,_("isTypelate"));
1057
+   LOG_CALL(_("isTypelate"));
1058
    bool real_ret=false;
1059
 
1060
    Class_base* objc=NULL;
1061
@@ -1855,7 +1855,7 @@
1062
            real_ret=(obj->toNumber()==obj->toUInt());
1063
        else
1064
            real_ret=false;
1065
-       LOG(LOG_CALLS,_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name);
1066
+       LOG_CALL(_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name);
1067
        obj->decRef();
1068
        type->decRef();
1069
        return real_ret;
1070
@@ -1870,14 +1870,14 @@
1071
    else
1072
    {
1073
        real_ret=obj->getObjectType()==type->getObjectType();
1074
-       LOG(LOG_CALLS,_("isTypelate on non classed object ") << real_ret);
1075
+       LOG_CALL(_("isTypelate on non classed object ") << real_ret);
1076
        obj->decRef();
1077
        type->decRef();
1078
        return real_ret;
1079
    }
1080
 
1081
    real_ret=objc->isSubClass(c);
1082
-   LOG(LOG_CALLS,_("Type ") << objc->class_name << _(" is ") << ((real_ret)?"":_("not ")) 
1083
+   LOG_CALL(_("Type ") << objc->class_name << _(" is ") << ((real_ret)?"":_("not ")) 
1084
            << "subclass of " << c->class_name);
1085
    obj->decRef();
1086
    type->decRef();
1087
@@ -1887,7 +1887,7 @@
1088
 ASObject* ABCVm::asType(ABCContext* context, ASObject* obj, multiname* name)
1089
 {
1090
    bool ret = context->isinstance(obj, name);
1091
-   LOG(LOG_CALLS,_("asType"));
1092
+   LOG_CALL(_("asType"));
1093
    
1094
    if(ret)
1095
        return obj;
1096
@@ -1901,7 +1901,7 @@
1097
 
1098
 ASObject* ABCVm::asTypelate(ASObject* type, ASObject* obj)
1099
 {
1100
-   LOG(LOG_CALLS,_("asTypelate"));
1101
+   LOG_CALL(_("asTypelate"));
1102
 
1103
    if(!type->is<Class_base>())
1104
    {
1105
@@ -1923,7 +1923,7 @@
1106
            real_ret=(obj->toNumber()==obj->toUInt());
1107
        else
1108
            real_ret=false;
1109
-       LOG(LOG_CALLS,_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name);
1110
+       LOG_CALL(_("Numeric type is ") << ((real_ret)?"":_("not ")) << _("subclass of ") << c->class_name);
1111
        type->decRef();
1112
        if(real_ret)
1113
            return obj;
1114
@@ -1947,7 +1947,7 @@
1115
    }
1116
 
1117
    bool real_ret=objc->isSubClass(c);
1118
-   LOG(LOG_CALLS,_("Type ") << objc->class_name << _(" is ") << ((real_ret)?_(" "):_("not ")) 
1119
+   LOG_CALL(_("Type ") << objc->class_name << _(" is ") << ((real_ret)?_(" "):_("not ")) 
1120
            << _("subclass of ") << c->class_name);
1121
    type->decRef();
1122
    if(real_ret)
1123
@@ -1963,7 +1963,7 @@
1124
 bool ABCVm::ifEq(ASObject* obj1, ASObject* obj2)
1125
 {
1126
    bool ret=obj1->isEqual(obj2);
1127
-   LOG(LOG_CALLS,_("ifEq (") << ((ret)?_("taken)"):_("not taken)")));
1128
+   LOG_CALL(_("ifEq (") << ((ret)?_("taken)"):_("not taken)")));
1129
 
1130
    //Real comparision demanded to object
1131
    obj1->decRef();
1132
@@ -1974,7 +1974,7 @@
1133
 bool ABCVm::ifStrictEq(ASObject* obj2, ASObject* obj1)
1134
 {
1135
    bool ret=strictEqualImpl(obj1,obj2);
1136
-   LOG(LOG_CALLS,_("ifStrictEq ")<<ret);
1137
+   LOG_CALL(_("ifStrictEq ")<<ret);
1138
    obj1->decRef();
1139
    obj2->decRef();
1140
    return ret;
1141
@@ -1983,7 +1983,7 @@
1142
 bool ABCVm::ifStrictNE(ASObject* obj2, ASObject* obj1)
1143
 {
1144
    bool ret=!strictEqualImpl(obj1,obj2);
1145
-   LOG(LOG_CALLS,_("ifStrictNE ")<<ret);
1146
+   LOG_CALL(_("ifStrictNE ")<<ret);
1147
    obj1->decRef();
1148
    obj2->decRef();
1149
    return ret;
1150
@@ -1991,7 +1991,7 @@
1151
 
1152
 bool ABCVm::in(ASObject* val2, ASObject* val1)
1153
 {
1154
-   LOG(LOG_CALLS, _("in") );
1155
+   LOG_CALL( _("in") );
1156
    if(val2->is<Null>())
1157
        throwError<TypeError>(kConvertNullToObjectError);
1158
 
1159
@@ -2010,7 +2010,7 @@
1160
 bool ABCVm::ifFalse(ASObject* obj1)
1161
 {
1162
    bool ret=!Boolean_concrete(obj1);
1163
-   LOG(LOG_CALLS,_("ifFalse (") << ((ret)?_("taken"):_("not taken")) << ')');
1164
+   LOG_CALL(_("ifFalse (") << ((ret)?_("taken"):_("not taken")) << ')');
1165
 
1166
    obj1->decRef();
1167
    return ret;
1168
@@ -2024,7 +2024,7 @@
1169
 
1170
    multiname* name=th->context->getMultiname(n,th);
1171
 
1172
-   LOG(LOG_CALLS,_("constructProp ")<< *name << ' ' << m);
1173
+   LOG_CALL(_("constructProp ")<< *name << ' ' << m);
1174
 
1175
    ASObject* obj=th->runtime_stack_pop();
1176
 
1177
@@ -2050,7 +2050,7 @@
1178
 
1179
    name->resetNameIfObject();
1180
 
1181
-   LOG(LOG_CALLS,_("Constructing"));
1182
+   LOG_CALL(_("Constructing"));
1183
    ASObject* ret;
1184
    try
1185
    {
1186
@@ -2068,7 +2068,7 @@
1187
    }
1188
    catch(ASObject* exc)
1189
    {
1190
-       LOG(LOG_CALLS,_("Exception during object construction. Returning Undefined"));
1191
+       LOG_CALL(_("Exception during object construction. Returning Undefined"));
1192
        //Handle eventual exceptions from the constructor, to fix the stack
1193
        th->runtime_stack_push(obj->getSystemState()->getUndefinedRef());
1194
        obj->decRef();
1195
@@ -2079,12 +2079,12 @@
1196
    ret->setConstructorCallComplete();
1197
 
1198
    obj->decRef();
1199
-   LOG(LOG_CALLS,_("End of constructing ") << ret->toDebugString());
1200
+   LOG_CALL(_("End of constructing ") << ret->toDebugString());
1201
 }
1202
 
1203
 bool ABCVm::hasNext2(call_context* th, int n, int m)
1204
 {
1205
-   LOG(LOG_CALLS,"hasNext2 " << n << ' ' << m);
1206
+   LOG_CALL("hasNext2 " << n << ' ' << m);
1207
    ASObject* obj=th->locals[n];
1208
    //If the local is not assigned bail out
1209
    if(obj==NULL)
1210
@@ -2106,7 +2106,7 @@
1211
 
1212
 void ABCVm::newObject(call_context* th, int n)
1213
 {
1214
-   LOG(LOG_CALLS,_("newObject ") << n);
1215
+   LOG_CALL(_("newObject ") << n);
1216
    ASObject* ret=Class<ASObject>::getInstanceS(th->context->root->getSystemState());
1217
    //Duplicated keys overwrite the previous value
1218
    multiname propertyName(NULL);
1219
@@ -2128,7 +2128,7 @@
1220
 {
1221
    multiname* name=th->context->getMultiname(n,th);
1222
    ASObject* obj=th->runtime_stack_pop();
1223
-   LOG(LOG_CALLS,"getDescendants " << *name << " " <<name->isAttribute<< " "<<obj->getClassName());
1224
+   LOG_CALL("getDescendants " << *name << " " <<name->isAttribute<< " "<<obj->getClassName());
1225
    XML::XMLVector ret;
1226
    XMLList* targetobject = NULL;
1227
    if(obj->getClass()==Class<XML>::getClass(obj->getSystemState()))
1228
@@ -2177,7 +2177,7 @@
1229
            proxyArgs[0]=namearg;
1230
 
1231
            //We now suppress special handling
1232
-           LOG(LOG_CALLS,_("Proxy::getDescendants"));
1233
+           LOG_CALL(_("Proxy::getDescendants"));
1234
            f->incRef();
1235
            obj->incRef();
1236
            ASObject* ret=f->call(obj,proxyArgs,1);
1237
@@ -2185,7 +2185,7 @@
1238
            th->runtime_stack_push(ret);
1239
            
1240
            obj->decRef();
1241
-           LOG(LOG_CALLS,_("End of calling ") << *name);
1242
+           LOG_CALL(_("End of calling ") << *name);
1243
            return;
1244
        }
1245
        else
1246
@@ -2208,7 +2208,7 @@
1247
 
1248
 number_t ABCVm::increment(ASObject* o)
1249
 {
1250
-   LOG(LOG_CALLS,"increment");
1251
+   LOG_CALL("increment");
1252
 
1253
    number_t n=o->toNumber();
1254
    o->decRef();
1255
@@ -2217,7 +2217,7 @@
1256
 
1257
 uint32_t ABCVm::increment_i(ASObject* o)
1258
 {
1259
-   LOG(LOG_CALLS,_("increment_i"));
1260
+   LOG_CALL(_("increment_i"));
1261
 
1262
    int n=o->toInt();
1263
    o->decRef();
1264
@@ -2226,7 +2226,7 @@
1265
 
1266
 uint64_t ABCVm::increment_di(ASObject* o)
1267
 {
1268
-   LOG(LOG_CALLS,_("increment_di"));
1269
+   LOG_CALL(_("increment_di"));
1270
 
1271
    int64_t n=o->toInt64();
1272
    o->decRef();
1273
@@ -2235,7 +2235,7 @@
1274
 
1275
 ASObject* ABCVm::nextValue(ASObject* index, ASObject* obj)
1276
 {
1277
-   LOG(LOG_CALLS,"nextValue");
1278
+   LOG_CALL("nextValue");
1279
    if(index->getObjectType()!=T_INTEGER)
1280
        throw UnsupportedException("Type mismatch in nextValue");
1281
 
1282
@@ -2248,7 +2248,7 @@
1283
 
1284
 ASObject* ABCVm::nextName(ASObject* index, ASObject* obj)
1285
 {
1286
-   LOG(LOG_CALLS,"nextName");
1287
+   LOG_CALL("nextName");
1288
    if(index->getObjectType()!=T_INTEGER)
1289
        throw UnsupportedException("Type mismatch in nextName");
1290
 
1291
@@ -2290,7 +2290,7 @@
1292
    }
1293
    for(unsigned int i=0;i<interfaces.size();i++)
1294
    {
1295
-       LOG(LOG_CALLS,_("Linking with interface ") << interfaces[i]->class_name);
1296
+       LOG_CALL(_("Linking with interface ") << interfaces[i]->class_name);
1297
        interfaces[i]->linkInterface(target);
1298
    }
1299
    return true;
1300
@@ -2301,7 +2301,7 @@
1301
    int name_index=th->context->instances[n].name;
1302
    assert_and_throw(name_index);
1303
    const multiname* mname=th->context->getMultiname(name_index,NULL);
1304
-   LOG(LOG_CALLS, "newClass " << *mname );
1305
+   LOG_CALL( "newClass " << *mname );
1306
 
1307
    ASObject* baseClass=th->runtime_stack_pop();
1308
 
1309
@@ -2329,7 +2329,7 @@
1310
        ASObject* oldDefinition=domain->getVariableAndTargetByMultiname(*mname, target);
1311
        if(oldDefinition && oldDefinition->getObjectType()==T_CLASS)
1312
        {
1313
-           LOG(LOG_CALLS,_("Class ") << className << _(" already defined. Pushing previous definition"));
1314
+           LOG_CALL(_("Class ") << className << _(" already defined. Pushing previous definition"));
1315
            baseClass->decRef();
1316
            oldDefinition->incRef();
1317
            th->runtime_stack_push(oldDefinition);
1318
@@ -2341,7 +2341,7 @@
1319
        
1320
        ret=new (th->context->root->getSystemState()->unaccountedMemory) Class_inherit(className, th->context->root->getSystemState()->unaccountedMemory);
1321
 
1322
-       LOG(LOG_CALLS,"add classes defined:"<<*mname<<" "<<th->context);
1323
+       LOG_CALL("add classes defined:"<<*mname<<" "<<th->context);
1324
        //Add the class to the ones being currently defined in this context
1325
        th->context->root->applicationDomain->classesBeingDefined.insert(make_pair(mname, ret));
1326
    }
1327
@@ -2398,11 +2398,11 @@
1328
        ret->class_scope.push_back(scope_entry(_MR(th->scope_stack[i]),th->scope_stack_dynamic[i]));
1329
    }
1330
 
1331
-   LOG(LOG_CALLS,_("Building class traits"));
1332
+   LOG_CALL(_("Building class traits"));
1333
    for(unsigned int i=0;i<th->context->classes[n].trait_count;i++)
1334
        th->context->buildTrait(ret,&th->context->classes[n].traits[i],false);
1335
 
1336
-   LOG(LOG_CALLS,_("Adding immutable object traits to class"));
1337
+   LOG_CALL(_("Adding immutable object traits to class"));
1338
    //Class objects also contains all the methods/getters/setters declared for instances
1339
    instance_info* cur=&th->context->instances[n];
1340
    for(unsigned int i=0;i<cur->trait_count;i++)
1341
@@ -2478,7 +2478,7 @@
1342
    if (th->context->instances[n].isInterface())
1343
        ABCVm::SetAllClassLinks();
1344
    
1345
-   LOG(LOG_CALLS,_("Calling Class init ") << ret);
1346
+   LOG_CALL(_("Calling Class init ") << ret);
1347
    ret->incRef();
1348
    //Class init functions are called with global as this
1349
    method_info* m=&th->context->methods[th->context->classes[n].cinit];
1350
@@ -2499,7 +2499,7 @@
1351
    }
1352
    catch(ASObject* exc)
1353
    {
1354
-       LOG(LOG_CALLS,_("Exception during class initialization. Returning Undefined"));
1355
+       LOG_CALL(_("Exception during class initialization. Returning Undefined"));
1356
        //Handle eventual exceptions from the constructor, to fix the stack
1357
        th->runtime_stack_push(th->context->root->applicationDomain->getSystemState()->getUndefinedRef());
1358
        cinit->decRef();
1359
@@ -2510,7 +2510,7 @@
1360
    }
1361
    assert_and_throw(ret2->is<Undefined>());
1362
    ret2->decRef();
1363
-   LOG(LOG_CALLS,_("End of Class init ") << *mname <<" " <<ret);
1364
+   LOG_CALL(_("End of Class init ") << *mname <<" " <<ret);
1365
    th->runtime_stack_push(ret);
1366
    cinit->decRef();
1367
 
1368
@@ -2531,12 +2531,12 @@
1369
 
1370
 void ABCVm::swap()
1371
 {
1372
-   LOG(LOG_CALLS,_("swap"));
1373
+   LOG_CALL(_("swap"));
1374
 }
1375
 
1376
 ASObject* ABCVm::newActivation(call_context* th, method_info* mi, ASObject* caller)
1377
 {
1378
-   LOG(LOG_CALLS,"newActivation");
1379
+   LOG_CALL("newActivation");
1380
    //TODO: Should create a real activation object
1381
    //TODO: Should method traits be added to the activation context?
1382
    ASObject* act= NULL;
1383
@@ -2561,14 +2561,14 @@
1384
 
1385
 void ABCVm::popScope(call_context* th)
1386
 {
1387
-   LOG(LOG_CALLS,_("popScope"));
1388
+   LOG_CALL(_("popScope"));
1389
    assert_and_throw(th->curr_scope_stack);
1390
    th->curr_scope_stack--;
1391
 }
1392
 
1393
 bool ABCVm::lessThan(ASObject* obj1, ASObject* obj2)
1394
 {
1395
-   LOG(LOG_CALLS,_("lessThan"));
1396
+   LOG_CALL(_("lessThan"));
1397
 
1398
    //Real comparision demanded to object
1399
    bool ret=(obj1->isLess(obj2)==TTRUE);
1400
@@ -2585,7 +2585,7 @@
1401
 
1402
    ASObject* obj=th->runtime_stack_pop();
1403
    ASObject* f=th->runtime_stack_pop();
1404
-   LOG(LOG_CALLS,_("call ") << m << ' ' << f);
1405
+   LOG_CALL(_("call ") << m << ' ' << f);
1406
    callImpl(th, f, obj, args, m, called_mi, true);
1407
 }
1408
 
1409
@@ -2633,12 +2633,12 @@
1410
        f->decRef();
1411
        throwError<TypeError>(kCallOfNonFunctionError, "Object");
1412
    }
1413
-   LOG(LOG_CALLS,_("End of call ") << m << ' ' << f);
1414
+   LOG_CALL(_("End of call ") << m << ' ' << f);
1415
 }
1416
 
1417
 bool ABCVm::deleteProperty(ASObject* obj, multiname* name)
1418
 {
1419
-   LOG(LOG_CALLS,_("deleteProperty ") << *name<<" "<<obj->toDebugString());
1420
+   LOG_CALL(_("deleteProperty ") << *name<<" "<<obj->toDebugString());
1421
    if (name->name_type == multiname::NAME_OBJECT && name->name_o)
1422
    {
1423
        if (name->name_o->is<XMLList>())
1424
@@ -2652,7 +2652,7 @@
1425
 
1426
 ASObject* ABCVm::newFunction(call_context* th, int n)
1427
 {
1428
-   LOG(LOG_CALLS,_("newFunction ") << n);
1429
+   LOG_CALL(_("newFunction ") << n);
1430
 
1431
    method_info* m=&th->context->methods[n];
1432
    SyntheticFunction* f=Class<IFunction>::getSyntheticFunction(th->context->root->applicationDomain->getSystemState(),m);
1433
@@ -2677,13 +2677,13 @@
1434
    assert_and_throw(th->curr_scope_stack > (size_t)n);
1435
    ASObject* ret=th->scope_stack[(size_t)n];
1436
    ret->incRef();
1437
-   LOG(LOG_CALLS, _("getScopeObject: ") << ret );
1438
+   LOG_CALL( _("getScopeObject: ") << ret );
1439
    return ret;
1440
 }
1441
 
1442
 ASObject* ABCVm::pushString(call_context* th, int n)
1443
 {
1444
-   LOG(LOG_CALLS, _("pushString ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(n)) );
1445
+   LOG_CALL( _("pushString ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(n)) );
1446
    return abstract_s(th->context->root->applicationDomain->getSystemState(),th->context->getString(n));
1447
 }
1448
 
1449
@@ -2699,7 +2699,7 @@
1450
 
1451
 void ABCVm::newArray(call_context* th, int n)
1452
 {
1453
-   LOG(LOG_CALLS, _("newArray ") << n );
1454
+   LOG_CALL( _("newArray ") << n );
1455
    Array* ret=Class<Array>::getInstanceS(th->context->root->getSystemState());
1456
    ret->resize(n);
1457
    for(int i=0;i<n;i++)
1458
@@ -2777,7 +2777,7 @@
1459
 {
1460
    const namespace_info& ns_info=th->context->constant_pool.namespaces[n];
1461
    assert(ns_info.kind == NAMESPACE);
1462
-   LOG(LOG_CALLS, _("pushNamespace ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name)) );
1463
+   LOG_CALL( _("pushNamespace ") << th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name)) );
1464
    return Class<Namespace>::getInstanceS(th->context->root->getSystemState(),th->context->root->getSystemState()->getStringFromUniqueId(th->context->getString(ns_info.name)));
1465
 }
1466
 
1467
lightspark.tar.xz/src/scripting/class.h Changed
56
 
1
@@ -233,15 +233,32 @@
2
 template<>
3
 inline ASObject* Class<Number>::coerce(ASObject* o) const
4
 {
5
-   number_t n = o->toNumber();
6
-   ASObject* res = abstract_d(o->getSystemState(),n);
7
-   o->decRef();
8
-   return res;
9
+   switch (o->getObjectType())
10
+   {
11
+       case T_NUMBER:
12
+           return o;
13
+       case T_INTEGER:
14
+       case T_UINTEGER:
15
+       {
16
+           ASObject* res = abstract_di(o->getSystemState(),o->toInt64());
17
+           o->decRef();
18
+           return res;
19
+       }
20
+       default:
21
+       {
22
+           number_t n = o->toNumber();
23
+           ASObject* res = abstract_d(o->getSystemState(),n);
24
+           o->decRef();
25
+           return res;
26
+       }
27
+   }
28
 }
29
 
30
 template<>
31
 inline ASObject* Class<UInteger>::coerce(ASObject* o) const
32
 {
33
+   if (o->is<UInteger>())
34
+       return o;
35
    uint32_t n = o->toUInt();
36
    ASObject* res = abstract_ui(o->getSystemState(),n);
37
    o->decRef();
38
@@ -251,6 +268,8 @@
39
 template<>
40
 inline ASObject* Class<Integer>::coerce(ASObject* o) const
41
 {
42
+   if (o->is<Integer>())
43
+       return o;
44
    int32_t n = o->toInt();
45
    ASObject* res = abstract_i(o->getSystemState(),n);
46
    o->decRef();
47
@@ -260,6 +279,8 @@
48
 template<>
49
 inline ASObject* Class<Boolean>::coerce(ASObject* o) const
50
 {
51
+   if (o->is<Boolean>())
52
+       return o;
53
    bool n = Boolean_concrete(o);
54
    ASObject* res = abstract_b(o->getSystemState(),n);
55
    o->decRef();
56
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp Changed
73
 
1
@@ -87,7 +87,7 @@
2
    args[1]=o;
3
    //We now suppress special handling
4
    implEnable=false;
5
-   LOG(LOG_CALLS,_("Proxy::setProperty"));
6
+   LOG_CALL(_("Proxy::setProperty"));
7
    incRef();
8
    _R<ASObject> ret=_MR( f->call(this,args,2) );
9
    assert_and_throw(ret->is<Undefined>());
10
@@ -99,7 +99,7 @@
11
    //It seems that various kind of implementation works only with the empty namespace
12
    assert_and_throw(name.ns.size()>0);
13
    _NR<ASObject> o;
14
-   LOG(LOG_CALLS,"Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true));
15
+   LOG_CALL("Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true));
16
    if(ASObject::hasPropertyByMultiname(name, true, true) || !implEnable || (opt & ASObject::SKIP_IMPL)!=0)
17
        o = ASObject::getVariableByMultiname(name,opt);
18
    if (!o.isNull() || !implEnable || (opt & ASObject::SKIP_IMPL)!=0)
19
@@ -124,7 +124,7 @@
20
    ASObject* arg = namearg;
21
    //We now suppress special handling
22
    implEnable=false;
23
-   LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString());
24
+   LOG_CALL("Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString());
25
    incRef();
26
    _NR<ASObject> ret=_MNR(f->call(this,&arg,1));
27
    implEnable=true;
28
@@ -162,7 +162,7 @@
29
    ASObject* arg = namearg;
30
    //We now suppress special handling
31
    implEnable=false;
32
-   LOG(LOG_CALLS,_("Proxy::hasProperty"));
33
+   LOG_CALL(_("Proxy::hasProperty"));
34
    incRef();
35
    _NR<ASObject> ret=_MNR(f->call(this,&arg,1));
36
    implEnable=true;
37
@@ -198,7 +198,7 @@
38
    ASObject* arg = namearg;
39
    //We now suppress special handling
40
    implEnable=false;
41
-   LOG(LOG_CALLS,_("Proxy::deleteProperty"));
42
+   LOG_CALL(_("Proxy::deleteProperty"));
43
    incRef();
44
    _NR<ASObject> ret=_MNR(f->call(this,&arg,1));
45
    implEnable=true;
46
@@ -209,7 +209,7 @@
47
 uint32_t Proxy::nextNameIndex(uint32_t cur_index)
48
 {
49
    assert_and_throw(implEnable);
50
-   LOG(LOG_CALLS,"Proxy::nextNameIndex");
51
+   LOG_CALL("Proxy::nextNameIndex");
52
    //Check if there is a custom enumerator, skipping implementation to avoid recursive calls
53
    multiname nextNameIndexName(NULL);
54
    nextNameIndexName.name_type=multiname::NAME_STRING;
55
@@ -229,7 +229,7 @@
56
 _R<ASObject> Proxy::nextName(uint32_t index)
57
 {
58
    assert_and_throw(implEnable);
59
-   LOG(LOG_CALLS, _("Proxy::nextName"));
60
+   LOG_CALL( _("Proxy::nextName"));
61
    //Check if there is a custom enumerator, skipping implementation to avoid recursive calls
62
    multiname nextNameName(NULL);
63
    nextNameName.name_type=multiname::NAME_STRING;
64
@@ -246,7 +246,7 @@
65
 _R<ASObject> Proxy::nextValue(uint32_t index)
66
 {
67
    assert_and_throw(implEnable);
68
-   LOG(LOG_CALLS, _("Proxy::nextValue"));
69
+   LOG_CALL( _("Proxy::nextValue"));
70
    //Check if there is a custom enumerator, skipping implementation to avoid recursive calls
71
    multiname nextValueName(NULL);
72
    nextValueName.name_type=multiname::NAME_STRING;
73
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp Changed
62
 
1
@@ -29,38 +29,32 @@
2
 using namespace std;
3
 using namespace lightspark;
4
 
5
-ASString::ASString(Class_base* c):ASObject(c),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
6
+ASString::ASString(Class_base* c):ASObject(c,T_STRING),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
7
 {
8
-   type=T_STRING;
9
 }
10
 
11
-ASString::ASString(Class_base* c,const string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
12
+ASString::ASString(Class_base* c,const string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
13
 {
14
-   type=T_STRING;
15
 }
16
 
17
-ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
18
+ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
19
 {
20
-   type=T_STRING;
21
 }
22
 
23
-ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
24
+ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
25
 {
26
-   type=T_STRING;
27
 }
28
 
29
-ASString::ASString(Class_base* c,const char* s) : ASObject(c),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
30
+ASString::ASString(Class_base* c,const char* s) : ASObject(c,T_STRING),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY)
31
 {
32
-   type=T_STRING;
33
 }
34
 
35
-ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c)
36
+ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c,T_STRING)
37
 {
38
    data = std::string(s,len);
39
    hasId = false;
40
    stringId = BUILTIN_STRINGS::EMPTY;
41
    datafilled=true;
42
-   type=T_STRING;
43
 }
44
 
45
 ASFUNCTIONBODY(ASString,_constructor)
46
@@ -80,7 +74,14 @@
47
 {
48
    // fast path if obj is ASString
49
    if (obj->is<ASString>())
50
-       return abstract_i(obj->getSystemState(),obj->as<ASString>()->getData().numChars());
51
+   {
52
+       ASString* th = obj->as<ASString>();
53
+       if (th->strlength.isNull())
54
+           th->strlength = _MNR(abstract_i(obj->getSystemState(),th->getData().numChars()));
55
+       th->strlength->incRef();
56
+       return th->strlength.getPtr();
57
+//     return abstract_i(obj->getSystemState(),th->getData().numChars());
58
+   }
59
    return abstract_i(obj->getSystemState(),obj->toString().numChars());
60
 }
61
 
62
lightspark.tar.xz/src/scripting/toplevel/ASString.h Changed
28
 
1
@@ -40,6 +40,7 @@
2
 private:
3
    number_t parseStringInfinite(const char *s, char **end) const;
4
    tiny_string data;
5
+   _NR<ASObject> strlength;
6
 public:
7
    ASString(Class_base* c);
8
    ASString(Class_base* c, const std::string& s);
9
@@ -47,8 +48,8 @@
10
    ASString(Class_base* c, const Glib::ustring& s);
11
    ASString(Class_base* c, const char* s);
12
    ASString(Class_base* c, const char* s, uint32_t len);
13
-   bool hasId;
14
-   bool datafilled;
15
+   bool hasId:1;
16
+   bool datafilled:1;
17
    uint32_t stringId;
18
    inline tiny_string& getData()
19
    {
20
@@ -106,6 +107,7 @@
21
    inline bool destruct() 
22
    { 
23
        data.clear(); 
24
+       strlength.reset();
25
        hasId = true;
26
        datafilled=true; 
27
        stringId = BUILTIN_STRINGS::EMPTY; 
28
lightspark.tar.xz/src/scripting/toplevel/Array.cpp Changed
14
 
1
@@ -28,11 +28,9 @@
2
 using namespace std;
3
 using namespace lightspark;
4
 
5
-Array::Array(Class_base* c):ASObject(c),
6
+Array::Array(Class_base* c):ASObject(c,T_ARRAY),currentsize(0),
7
    data(std::less<arrayType::key_type>(), reporter_allocator<arrayType::value_type>(c->memoryAccount))
8
 {
9
-   currentsize=0;
10
-   type=T_ARRAY;
11
 }
12
 
13
 void Array::sinit(Class_base* c)
14
lightspark.tar.xz/src/scripting/toplevel/Boolean.h Changed
10
 
1
@@ -35,7 +35,7 @@
2
 class Boolean: public ASObject
3
 {
4
 public:
5
-   Boolean(Class_base* c, bool v=false):ASObject(c),val(v) {type=T_BOOLEAN;}
6
+   Boolean(Class_base* c, bool v=false):ASObject(c,T_BOOLEAN),val(v) {}
7
    static void sinit(Class_base*);
8
    static void buildTraits(ASObject* o){};
9
    bool val;
10
lightspark.tar.xz/src/scripting/toplevel/Integer.h Changed
10
 
1
@@ -33,7 +33,7 @@
2
 friend class ABCContext;
3
 friend ASObject* abstract_i(int32_t i);
4
 public:
5
-   Integer(Class_base* c,int32_t v=0):ASObject(c),val(v){type=T_INTEGER;}
6
+   Integer(Class_base* c,int32_t v=0):ASObject(c,T_INTEGER),val(v){}
7
    int32_t val;
8
    static void buildTraits(ASObject* o){};
9
    static void sinit(Class_base* c);
10
lightspark.tar.xz/src/scripting/toplevel/Number.h Changed
17
 
1
@@ -38,13 +38,13 @@
2
    static tiny_string purgeExponentLeadingZeros(const tiny_string& exponentialForm);
3
    static int32_t countSignificantDigits(double v);
4
 public:
5
-   Number(Class_base* c, double v=Number::NaN):ASObject(c),dval(v),isfloat(true){type=T_NUMBER;}
6
+   Number(Class_base* c, double v=Number::NaN):ASObject(c,T_NUMBER),dval(v),isfloat(true){}
7
    static const number_t NaN;
8
    union {
9
        number_t dval;
10
        int64_t ival;
11
    };
12
-   bool isfloat;
13
+   bool isfloat:1;
14
    inline number_t toNumber() { return isfloat ? dval : ival; }
15
    inline bool destruct() { dval=Number::NaN; isfloat = true; return ASObject::destruct(); }
16
    ASFUNCTION(_constructor);
17
lightspark.tar.xz/src/scripting/toplevel/UInteger.h Changed
10
 
1
@@ -30,7 +30,7 @@
2
 friend ASObject* abstract_ui(uint32_t i);
3
 public:
4
    uint32_t val;
5
-   UInteger(Class_base* c,uint32_t v=0):ASObject(c),val(v){type=T_UINTEGER;}
6
+   UInteger(Class_base* c,uint32_t v=0):ASObject(c,T_UINTEGER),val(v){}
7
 
8
    static void sinit(Class_base* c);
9
    tiny_string toString();
10
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp Changed
122
 
1
@@ -52,25 +52,23 @@
2
 Any* const Type::anyType = new Any();
3
 Void* const Type::voidType = new Void();
4
 
5
-Null::Null():ASObject((Class_base*)(NULL))
6
+Null::Null():ASObject((Class_base*)(NULL),T_NULL)
7
 {
8
    traitsInitialized = true;
9
    constructIndicator = true;
10
    constructorCallComplete = true;
11
-   type=T_NULL;
12
 }
13
 
14
-Undefined::Undefined():ASObject((Class_base*)(NULL))
15
+Undefined::Undefined():ASObject((Class_base*)(NULL),T_UNDEFINED)
16
 {
17
    traitsInitialized = true;
18
    constructIndicator = true;
19
    constructorCallComplete = true;
20
-   type=T_UNDEFINED;
21
 }
22
 
23
 ASFUNCTIONBODY(Undefined,call)
24
 {
25
-   LOG(LOG_CALLS,_("Undefined function"));
26
+   LOG_CALL(_("Undefined function"));
27
    return NULL;
28
 }
29
 
30
@@ -133,9 +131,8 @@
31
    throwError<TypeError>(kConvertUndefinedToObjectError);
32
 }
33
 
34
-IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL),functionname(0)
35
+IFunction::IFunction(Class_base* c):ASObject(c,T_FUNCTION),length(0),inClass(NULL),functionname(0)
36
 {
37
-   type=T_FUNCTION;
38
 }
39
 
40
 void IFunction::sinit(Class_base* c)
41
@@ -403,7 +400,7 @@
42
 
43
    if(isBound())
44
    { /* closure_this can never been overriden */
45
-       LOG(LOG_CALLS,_("Calling with closure ") << this);
46
+       LOG_CALL(_("Calling with closure ") << this);
47
        if(obj)
48
            obj->decRef();
49
        obj=closure_this.getPtr();
50
@@ -558,7 +555,7 @@
51
    ASObject* ret;
52
    if(isBound())
53
    { /* closure_this can never been overriden */
54
-       LOG(LOG_CALLS,_("Calling with closure ") << this);
55
+       LOG_CALL(_("Calling with closure ") << this);
56
        if(obj)
57
            obj->decRef();
58
        obj=closure_this.getPtr();
59
@@ -776,12 +773,11 @@
60
    return typeObject ? typeObject->as<Type>() : NULL;
61
 }
62
 
63
-Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys())),protected_ns(getSys(),"",NAMESPACE),constructor(NULL),
64
+Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys()),T_CLASS),protected_ns(getSys(),"",NAMESPACE),constructor(NULL),
65
    freelistsize(0),freelistsize2(0),borrowedVariables(m),
66
    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)
67
 {
68
    setConstant();
69
-   type=T_CLASS;
70
 }
71
 
72
 Class_base::Class_base(const Class_object*):ASObject((MemoryAccount*)NULL),protected_ns(getSys(),BUILTIN_STRINGS::EMPTY,NAMESPACE),constructor(NULL),
73
@@ -1153,7 +1149,7 @@
74
 
75
    if(constructor)
76
    {
77
-       LOG(LOG_CALLS,_("Calling interface init for ") << class_name);
78
+       LOG_CALL(_("Calling interface init for ") << class_name);
79
        ASObject* ret=constructor->call(c,NULL,0);
80
        assert_and_throw(ret==NULL);
81
    }
82
@@ -1490,9 +1486,8 @@
83
        return NOT_BINDED;
84
 }
85
 
86
-ASQName::ASQName(Class_base* c):ASObject(c)
87
+ASQName::ASQName(Class_base* c):ASObject(c,T_QNAME),uri_is_null(false),uri(0),local_name(0)
88
 {
89
-   type=T_QNAME; uri_is_null=false;
90
 }
91
 void ASQName::setByXML(XML* node)
92
 {
93
@@ -1754,17 +1749,13 @@
94
    }
95
 }
96
 
97
-Namespace::Namespace(Class_base* c):ASObject(c),nskind(NAMESPACE)
98
+Namespace::Namespace(Class_base* c):ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false)
99
 {
100
-   type=T_NAMESPACE;
101
-   prefix_is_undefined=false;
102
 }
103
 
104
 Namespace::Namespace(Class_base* c, const tiny_string& _uri, const tiny_string& _prefix)
105
-  : ASObject(c),nskind(NAMESPACE),uri(_uri),prefix(_prefix)
106
+  : ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false),uri(_uri),prefix(_prefix)
107
 {
108
-   type=T_NAMESPACE;
109
-   prefix_is_undefined=false;
110
 }
111
 
112
 void Namespace::sinit(Class_base* c)
113
@@ -2167,7 +2158,7 @@
114
     */
115
    if(ret.isNull() || !context || context->hasRunScriptInit[scriptId])
116
        return ret;
117
-   LOG(LOG_CALLS,"Access to " << name << ", running script init");
118
+   LOG_CALL("Access to " << name << ", running script init");
119
    context->runScriptInit(scriptId, this);
120
    return ASObject::getVariableByMultiname(name, opt);
121
 }
122
lightspark.tar.xz/src/swf.cpp Changed
41
 
1
@@ -175,7 +175,7 @@
2
 }
3
 
4
 //See BUILTIN_STRINGS enum
5
-static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*" };
6
+static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*", "http://adobe.com/AS3/2006/builtin" };
7
 
8
 extern uint32_t asClassCount;
9
 
10
@@ -202,6 +202,10 @@
11
    uint32_t baseId;
12
    getUniqueNamespaceId(emptyNs, 0, nsId, baseId);
13
    assert(nsId==0 && baseId==0);
14
+   //Forge the AS3 namespace and make sure it gets id 1
15
+   nsNameAndKindImpl as3Ns(BUILTIN_STRINGS::STRING_AS3NS, NAMESPACE);
16
+   getUniqueNamespaceId(as3Ns, 1, nsId, baseId);
17
+   assert(nsId==1 && baseId==1);
18
 
19
    cookiesFileName = NULL;
20
 
21
@@ -1861,8 +1865,7 @@
22
 
23
 void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t& nsId, uint32_t& baseId)
24
 {
25
-   int32_t hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId);
26
-   getUniqueNamespaceId(s, hintedId, nsId, baseId);
27
+   getUniqueNamespaceId(s, 0xffffffff, nsId, baseId);
28
 }
29
 
30
 void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t hintedId, uint32_t& nsId, uint32_t& baseId)
31
@@ -1871,6 +1874,9 @@
32
    auto it=uniqueNamespaceMap.left.find(s);
33
    if(it==uniqueNamespaceMap.left.end())
34
    {
35
+       if (hintedId == 0xffffffff)
36
+           hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId);
37
+
38
        auto ret=uniqueNamespaceMap.left.insert(make_pair(s,hintedId));
39
        assert(ret.second);
40
        it=ret.first;
41
lightspark.tar.xz/src/swftypes.cpp Changed
39
 
1
@@ -1510,21 +1510,18 @@
2
 {
3
    nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind);
4
    sys->getUniqueNamespaceId(tmp, nsRealId, nsId);
5
-   nameIsEmpty=_name.empty();
6
 }
7
 
8
 nsNameAndKind::nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind)
9
 {
10
    nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind);
11
    sys->getUniqueNamespaceId(tmp, nsRealId, nsId);
12
-   nameIsEmpty=(_name[0]=='\0');
13
 }
14
 
15
 nsNameAndKind::nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind)
16
 {
17
    nsNameAndKindImpl tmp(_nameId, _kind);
18
    sys->getUniqueNamespaceId(tmp, nsRealId, nsId);
19
-   nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY;
20
 }
21
 nsNameAndKind::nsNameAndKind(SystemState* sys, uint32_t _nameId, uint32_t _baseId, NS_KIND _kind)
22
 {
23
@@ -1534,7 +1531,6 @@
24
    uint32_t tmpId;
25
    sys->getUniqueNamespaceId(tmp, nsRealId, tmpId);
26
    assert(tmpId==_baseId);
27
-   nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY;
28
 }
29
 
30
 nsNameAndKind::nsNameAndKind(ABCContext* c, uint32_t nsContextIndex)
31
@@ -1547,7 +1543,6 @@
32
    //Special handling for private namespaces, they are always compared by id
33
    if(ns.kind==PRIVATE_NAMESPACE)
34
        nsId=c->namespaceBaseId+nsContextIndex;
35
-   nameIsEmpty=nsNameId==BUILTIN_STRINGS::EMPTY;
36
 }
37
 
38
 const nsNameAndKindImpl& nsNameAndKind::getImpl(SystemState* sys) const
39
lightspark.tar.xz/src/swftypes.h Changed
53
 
1
@@ -40,7 +40,7 @@
2
 
3
 namespace lightspark
4
 {
5
-enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,LAST_BUILTIN_STRING };
6
+enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,STRING_AS3NS,LAST_BUILTIN_STRING };
7
 enum BUILTIN_NAMESPACES { EMPTY_NS=0 };
8
 
9
 
10
@@ -316,8 +316,7 @@
11
 {
12
    uint32_t nsId;
13
    uint32_t nsRealId;
14
-   bool nameIsEmpty;
15
-   nsNameAndKind():nsId(0),nsRealId(0),nameIsEmpty(true) {}
16
+   nsNameAndKind():nsId(0),nsRealId(0) {}
17
    nsNameAndKind(SystemState *sys, const tiny_string& _name, NS_KIND _kind);
18
    nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind);
19
    nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind);
20
@@ -330,26 +329,26 @@
21
    /*
22
     * Special version to create the empty bultin namespace
23
     */
24
-   nsNameAndKind(uint32_t id):nsId(id),nsRealId(id),nameIsEmpty(true)
25
+   nsNameAndKind(uint32_t id):nsId(id),nsRealId(id)
26
    {
27
        assert(nsId==0);
28
    }
29
-   bool operator<(const nsNameAndKind& r) const
30
+   inline bool operator<(const nsNameAndKind& r) const
31
    {
32
        return nsId < r.nsId;
33
    }
34
-   bool operator>(const nsNameAndKind& r) const
35
+   inline bool operator>(const nsNameAndKind& r) const
36
    {
37
        return nsId > r.nsId;
38
    }
39
-   bool operator==(const nsNameAndKind& r) const
40
+   inline bool operator==(const nsNameAndKind& r) const
41
    {
42
        return nsId==r.nsId;
43
    }
44
    const nsNameAndKindImpl& getImpl(SystemState *sys) const;
45
-   bool hasEmptyName() const
46
+   inline bool hasEmptyName() const
47
    {
48
-       return nameIsEmpty;
49
+       return nsId==0;
50
    }
51
 };
52
 
53
lightspark.tar.xz/src/tiny_string.cpp Changed
24
 
1
@@ -17,7 +17,6 @@
2
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
3
 **************************************************************************/
4
 
5
-#include <glibmm/ustring.h>
6
 #include "tiny_string.h"
7
 #include "exceptions.h"
8
 #include "swf.h"
9
@@ -335,14 +334,6 @@
10
        (strncmp(buf+numBytes()-olen,o,olen) == 0);
11
 }
12
 
13
-/* idx is an index of utf-8 characters */
14
-uint32_t tiny_string::charAt(uint32_t idx) const
15
-{
16
-   if (isASCII)
17
-       return buf[idx];
18
-   return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx));
19
-}
20
-
21
 /* start is an index of characters.
22
  * returns index of character */
23
 uint32_t tiny_string::find(const tiny_string& needle, uint32_t start) const
24
lightspark.tar.xz/src/tiny_string.h Changed
23
 
1
@@ -26,6 +26,7 @@
2
 #include <list>
3
 /* for utf8 handling */
4
 #include <glib.h>
5
+#include <glibmm/ustring.h>
6
 #include "compat.h"
7
 
8
 /* forward declare for tiny_string conversion */
9
@@ -190,7 +191,12 @@
10
    bool startsWith(const char* o) const;
11
         bool endsWith(const char* o) const;
12
    /* idx is an index of utf-8 characters */
13
-   uint32_t charAt(uint32_t idx) const;
14
+   uint32_t charAt(uint32_t idx) const
15
+   {
16
+       if (isASCII)
17
+           return buf[idx];
18
+       return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx));
19
+   }
20
    /* start is an index of characters.
21
     * returns index of character */
22
    uint32_t find(const tiny_string& needle, uint32_t start = 0) const;
23