void GlobalContext::initGlobalContext(ExecutionEngine *eng)
{
- initBaseContext(Type_GlobalContext, eng);
+ initBaseContext(Type_GlobalContext, eng, /*parentContext*/0);
thisObject = Value::fromObject(eng->globalObject);
global = 0;
}
void WithContext::initWithContext(ExecutionContext *p, Object *with)
{
- initBaseContext(Type_WithContext, p->engine);
+ initBaseContext(Type_WithContext, p->engine, p);
thisObject = p->thisObject;
outer = p;
lookups = p->lookups;
void CatchContext::initCatchContext(ExecutionContext *p, String *exceptionVarName, const Value &exceptionValue)
{
- initBaseContext(Type_CatchContext, p->engine);
+ initBaseContext(Type_CatchContext, p->engine, p);
strictMode = p->strictMode;
thisObject = p->thisObject;
outer = p;
this->exceptionValue = exceptionValue;
}
-void CallContext::initCallContext(ExecutionEngine *engine, FunctionObject *function, Value *_arguments, int _argumentCount, const Value &_thisObject)
+void CallContext::initCallContext(ExecutionContext *parentContext, FunctionObject *function, Value *_arguments, int _argumentCount, const Value &_thisObject)
{
- initBaseContext(Type_CallContext, engine);
+ initBaseContext(Type_CallContext, parentContext->engine, parentContext);
this->function = function;
this->arguments = _arguments;
}
}
-void CallContext::initQmlContext(ExecutionEngine *engine, Object *qml, FunctionObject *function)
+void CallContext::initQmlContext(ExecutionContext *parentContext, Object *qml, FunctionObject *function)
{
- initBaseContext(Type_QmlContext, engine);
+ initBaseContext(Type_QmlContext, parentContext->engine, parentContext);
this->function = function;
this->arguments = 0;
{
throwError(Value::fromObject(engine->newURIErrorObject(msg)));
}
+
+
+void SimpleCallContext::initSimpleCallContext(ExecutionEngine *engine)
+{
+ initBaseContext(Type_SimpleCallContext, engine, engine->current);
+ function = 0;
+ arguments = 0;
+ argumentCount = 0;
+}
const uchar **interpreterInstructionPointer;
- void initBaseContext(Type type, ExecutionEngine *engine)
+ void initBaseContext(Type type, ExecutionEngine *engine, ExecutionContext *parentContext)
{
this->type = type;
strictMode = false;
marked = false;
thisObject = Value::undefinedValue();
this->engine = engine;
- parent = 0;
+ parent = parentContext;
outer = 0;
lookups = 0;
currentEvalCode = 0;
struct SimpleCallContext : public ExecutionContext
{
- void initSimpleCallContext(ExecutionEngine *engine)
- {
- initBaseContext(Type_SimpleCallContext, engine);
- function = 0;
- arguments = 0;
- argumentCount = 0;
- }
+ void initSimpleCallContext(ExecutionEngine *engine);
FunctionObject *function;
Value *arguments;
unsigned int argumentCount;
struct CallContext : public SimpleCallContext
{
- void initCallContext(QV4::ExecutionEngine *engine, FunctionObject *function, Value *args, int argc,
+ void initCallContext(ExecutionContext *parentContext, FunctionObject *function, Value *args, int argc,
const Value &thisObject);
- void initQmlContext(QV4::ExecutionEngine *engine, Object *qml, QV4::FunctionObject *function);
+ void initQmlContext(ExecutionContext *parentContext, Object *qml, QV4::FunctionObject *function);
bool needsOwnArguments() const;
Value *locals;
WithContext *ExecutionEngine::newWithContext(Object *with)
{
- ExecutionContext *p = current;
WithContext *w = static_cast<WithContext *>(memoryManager->allocContext(sizeof(WithContext)));
- w->initWithContext(p, with);
- w->parent = current;
+ ExecutionContext *p = current;
current = w;
+ w->initWithContext(p, with);
return w;
}
CatchContext *ExecutionEngine::newCatchContext(String *exceptionVarName, const Value &exceptionValue)
{
- ExecutionContext *p = current;
CatchContext *c = static_cast<CatchContext *>(memoryManager->allocContext(sizeof(CatchContext)));
- c->initCatchContext(p, exceptionVarName, exceptionValue);
- c->parent = current;
+ ExecutionContext *p = current;
current = c;
+ c->initCatchContext(p, exceptionVarName, exceptionValue);
return c;
}
CallContext *ExecutionEngine::newCallContext(FunctionObject *f, const Value &thisObject, Value *args, int argc)
{
CallContext *c = static_cast<CallContext *>(memoryManager->allocContext(requiredMemoryForExecutionContect(f, argc)));
-
- c->initCallContext(this, f, args, argc, thisObject);
- c->parent = current;
+ ExecutionContext *p = current;
current = c;
+ c->initCallContext(p, f, args, argc, thisObject);
return c;
}
{
CallContext *c = static_cast<CallContext *>(memoryManager->allocContext(requiredMemoryForExecutionContect(f, 0)));
- c->initQmlContext(this, qml, f);
- c->parent = current;
+ ExecutionContext *p = current;
current = c;
+ c->initQmlContext(p, qml, f);
return c;
}
#endif
}
- c->initCallContext(this, f, args, argc, thisObject);
- c->parent = current;
+ ExecutionContext *p = current;
current = c;
+ c->initCallContext(p, f, args, argc, thisObject);
return c;
}
for (int i = 0; i < argumentsAccessors.size(); ++i) {
const Property &pd = argumentsAccessors.at(i);
- pd.getter()->mark();
- pd.setter()->mark();
+ if (FunctionObject *getter = pd.getter())
+ getter->mark();
+ if (FunctionObject *setter = pd.setter())
+ setter->mark();
}
ExecutionContext *c = current;