aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-05 13:27:38 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-05 16:06:30 +0200
commit9a3fa22611de9bc1de0b5a7a5e6600e716e50755 (patch)
treec8d86bc2abe56060692e96193e3b40e798778bf6 /src
parente739486290c7ae1e7390a043e29c716a3e23dd03 (diff)
Split out the Context for With/Catch into their own classes
Change-Id: I8e7d2fe649eb2c8119f9a787d54b8e92c0e9684f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/llvm_runtime.cpp3
-rw-r--r--src/v4/qv4context.cpp251
-rw-r--r--src/v4/qv4context.h89
-rw-r--r--src/v4/qv4engine.cpp65
-rw-r--r--src/v4/qv4engine.h10
-rw-r--r--src/v4/qv4globalobject.cpp4
6 files changed, 225 insertions, 197 deletions
diff --git a/src/v4/llvm_runtime.cpp b/src/v4/llvm_runtime.cpp
index f2a48c3cb3..cd0789c2b3 100644
--- a/src/v4/llvm_runtime.cpp
+++ b/src/v4/llvm_runtime.cpp
@@ -56,7 +56,8 @@ Value __qmljs_llvm_return(ExecutionContext */*ctx*/, Value *result)
Value *__qmljs_llvm_get_argument(ExecutionContext *ctx, int index)
{
- return &ctx->arguments[index];
+ assert(ctx->type == ExecutionContext::Type_CallContext);
+ return &static_cast<CallContext *>(ctx)->arguments[index];
}
void __qmljs_llvm_init_undefined(Value *result)
diff --git a/src/v4/qv4context.cpp b/src/v4/qv4context.cpp
index 61f75570ca..202acc8153 100644
--- a/src/v4/qv4context.cpp
+++ b/src/v4/qv4context.cpp
@@ -98,7 +98,7 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
bool ExecutionContext::setMutableBinding(ExecutionContext *scope, String *name, const Value &value)
{
// ### throw if scope->strict is true, and it would change an immutable binding
- if (type == CallContext) {
+ if (type == Type_CallContext) {
assert(function);
for (unsigned int i = 0; i < function->varCount; ++i)
if (function->varList[i]->isEqualTo(name)) {
@@ -112,7 +112,7 @@ bool ExecutionContext::setMutableBinding(ExecutionContext *scope, String *name,
}
}
- if (activation && (type == QmlContext || activation->__hasProperty__(scope, name))) {
+ if (activation && (type == Type_QmlContext || activation->__hasProperty__(scope, name))) {
activation->put(scope, name, value);
return true;
}
@@ -125,7 +125,7 @@ Value ExecutionContext::getBindingValue(ExecutionContext *scope, String *name, b
Q_UNUSED(strict);
assert(function);
- if (type == CallContext) {
+ if (type == Type_CallContext) {
assert(function);
for (unsigned int i = 0; i < function->varCount; ++i)
if (function->varList[i]->isEqualTo(name))
@@ -156,104 +156,149 @@ bool ExecutionContext::deleteBinding(ExecutionContext *scope, String *name)
String * const *ExecutionContext::formals() const
{
- return function ? function->formalParameterList : 0;
+ return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterList : 0;
}
unsigned int ExecutionContext::formalCount() const
{
- return function ? function->formalParameterCount : 0;
+ return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->formalParameterCount : 0;
}
String * const *ExecutionContext::variables() const
{
- return function ? function->varList : 0;
+ return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->varList : 0;
}
unsigned int ExecutionContext::variableCount() const
{
- return function ? function->varCount : 0;
+ return type == Type_CallContext ? static_cast<const CallContext *>(this)->function->varCount : 0;
}
-void ExecutionContext::init(ExecutionEngine *eng)
+void GlobalContext::init(ExecutionEngine *eng)
{
- type = GlobalContext;
+ type = Type_GlobalContext;
+ strictMode = false;
marked = false;
+ thisObject = eng->globalObject;
engine = eng;
outer = 0;
- thisObject = eng->globalObject;
-
- function = 0;
lookups = 0;
- locals = 0;
+ // ### remove
arguments = 0;
argumentCount = 0;
- locals = 0;
- exceptionVarName = 0;
- exceptionValue = Value::undefinedValue();
- strictMode = false;
activation = 0;
- withObject = 0;
+ function = 0;
+ locals = 0;
}
-void ExecutionContext::init(ExecutionContext *p, Object *with)
+void WithContext::init(ExecutionContext *p, Object *with)
{
- type = WithContext;
+ type = Type_WithContext;
+ strictMode = false;
marked = false;
+ thisObject = p->thisObject;
engine = p->engine;
outer = p;
- thisObject = p->thisObject;
-
- function = 0;
lookups = p->lookups;
- locals = 0;
+ withObject = with;
+
+ // ### remove
arguments = 0;
argumentCount = 0;
- locals = 0;
- exceptionVarName = 0;
- exceptionValue = Value::undefinedValue();
- strictMode = false;
activation = 0;
- withObject = with;
+ function = 0;
+ locals = 0;
}
-void ExecutionContext::initForCatch(ExecutionContext *p, String *exceptionVarName, const Value &exceptionValue)
+void CatchContext::init(ExecutionContext *p, String *exceptionVarName, const Value &exceptionValue)
{
- type = CatchContext;
+ type = Type_CatchContext;
+ strictMode = p->strictMode;
marked = false;
+ thisObject = p->thisObject;
engine = p->engine;
outer = p;
- thisObject = p->thisObject;
-
- function = 0;
lookups = p->lookups;
+
+ this->exceptionVarName = exceptionVarName;
+ this->exceptionValue = exceptionValue;
+
+ // ### remove
arguments = 0;
argumentCount = 0;
+ activation = 0;
+ function = 0;
locals = 0;
- this->exceptionVarName = exceptionVarName;
- this->exceptionValue = exceptionValue;
- strictMode = p->strictMode;
+}
+
+void CallContext::initCallContext(ExecutionEngine *engine)
+{
+ type = Type_CallContext;
+ strictMode = function->strictMode;
+ marked = false;
+ this->engine = engine;
+ outer = function->scope;
+#ifndef QT_NO_DEBUG
+ assert(outer->next != (ExecutionContext *)0x1);
+#endif
+
activation = 0;
- withObject = 0;
+
+ if (function->function)
+ lookups = function->function->lookups;
+
+ uint argc = argumentCount;
+
+ locals = (Value *)(this + 1);
+ if (function->varCount)
+ std::fill(locals, locals + function->varCount, Value::undefinedValue());
+
+ if (needsOwnArguments()) {
+ Value *args = arguments;
+ argumentCount = qMax(argc, function->formalParameterCount);
+ arguments = locals + function->varCount;
+ if (argc)
+ ::memcpy(arguments, args, argc * sizeof(Value));
+ if (argc < function->formalParameterCount)
+ std::fill(arguments + argc, arguments + function->formalParameterCount, Value::undefinedValue());
+
+ }
+
+ if (function->usesArgumentsObject) {
+ ArgumentsObject *args = new (engine->memoryManager) ArgumentsObject(this, function->formalParameterCount, argc);
+ args->prototype = engine->objectPrototype;
+ Value arguments = Value::fromObject(args);
+ createMutableBinding(engine->id_arguments, false);
+ setMutableBinding(this, engine->id_arguments, arguments);
+ }
+
+ if (engine->debugger)
+ engine->debugger->aboutToCall(function, this);
}
+
bool ExecutionContext::deleteProperty(String *name)
{
bool hasWith = false;
for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == WithContext) {
+ if (ctx->type == Type_WithContext) {
hasWith = true;
- if (ctx->withObject->__hasProperty__(this, name))
- return ctx->withObject->deleteProperty(this, name);
+ WithContext *w = static_cast<WithContext *>(ctx);
+ if (w->withObject->__hasProperty__(this, name))
+ return w->withObject->deleteProperty(this, name);
} else {
if (ctx->activation && ctx->activation->__hasProperty__(this, name))
return ctx->activation->deleteProperty(this, name);
}
- if (ctx->type == CatchContext && ctx->exceptionVarName->isEqualTo(name))
- return false;
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CatchContext) {
+ CatchContext *c = static_cast<CatchContext *>(ctx);
+ if (c->exceptionVarName->isEqualTo(name))
+ return false;
+ }
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->needsActivation || hasWith) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -293,24 +338,29 @@ void ExecutionContext::mark()
locals[local].mark();
if (activation)
activation->mark();
- if (withObject)
- withObject->mark();
- if (exceptionVarName)
- exceptionVarName->mark();
- exceptionValue.mark();
+ if (type == Type_WithContext) {
+ WithContext *w = static_cast<WithContext *>(this);
+ w->withObject->mark();
+ }
+ if (type == Type_CatchContext) {
+ CatchContext *c = static_cast<CatchContext *>(this);
+ if (c->exceptionVarName)
+ c->exceptionVarName->mark();
+ c->exceptionValue.mark();
+ }
}
void ExecutionContext::setProperty(String *name, const Value& value)
{
for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == WithContext) {
- Object *w = ctx->withObject;
+ if (ctx->type == Type_WithContext) {
+ Object *w = static_cast<WithContext *>(ctx)->withObject;
if (w->__hasProperty__(ctx, name)) {
w->put(ctx, name, value);
return;
}
- } else if (ctx->type == CatchContext && ctx->exceptionVarName->isEqualTo(name)) {
- ctx->exceptionValue = value;
+ } else if (ctx->type == Type_CatchContext && static_cast<CatchContext *>(ctx)->exceptionVarName->isEqualTo(name)) {
+ static_cast<CatchContext *>(ctx)->exceptionValue = value;
return;
} else {
if (ctx->setMutableBinding(this, name, value))
@@ -332,8 +382,8 @@ Value ExecutionContext::getProperty(String *name)
bool hasWith = false;
bool hasCatchScope = false;
for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == WithContext) {
- Object *w = ctx->withObject;
+ if (ctx->type == Type_WithContext) {
+ Object *w = static_cast<WithContext *>(ctx)->withObject;
hasWith = true;
bool hasProperty = false;
Value v = w->get(ctx, name, &hasProperty);
@@ -343,13 +393,14 @@ Value ExecutionContext::getProperty(String *name)
continue;
}
- if (ctx->type == CatchContext) {
+ if (ctx->type == Type_CatchContext) {
hasCatchScope = true;
- if (ctx->exceptionVarName->isEqualTo(name))
- return ctx->exceptionValue;
+ CatchContext *c = static_cast<CatchContext *>(ctx);
+ if (c->exceptionVarName->isEqualTo(name))
+ return c->exceptionValue;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -366,7 +417,7 @@ Value ExecutionContext::getProperty(String *name)
if (hasProperty)
return v;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->function && f->function->isNamedExpression
&& name->isEqualTo(f->function->name))
@@ -387,8 +438,8 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
bool hasWith = false;
bool hasCatchScope = false;
for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == WithContext) {
- Object *w = ctx->withObject;
+ if (ctx->type == Type_WithContext) {
+ Object *w = static_cast<WithContext *>(ctx)->withObject;
hasWith = true;
bool hasProperty = false;
Value v = w->get(ctx, name, &hasProperty);
@@ -398,13 +449,14 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
continue;
}
- if (ctx->type == CatchContext) {
+ if (ctx->type == Type_CatchContext) {
hasCatchScope = true;
- if (ctx->exceptionVarName->isEqualTo(name))
- return ctx->exceptionValue;
+ CatchContext *c = static_cast<CatchContext *>(ctx);
+ if (c->exceptionVarName->isEqualTo(name))
+ return c->exceptionValue;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -421,7 +473,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
if (hasProperty)
return v;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->function && f->function->isNamedExpression
&& name->isEqualTo(f->function->name))
@@ -442,8 +494,8 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
bool hasWith = false;
bool hasCatchScope = false;
for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer) {
- if (ctx->type == WithContext) {
- Object *w = ctx->withObject;
+ if (ctx->type == Type_WithContext) {
+ Object *w = static_cast<WithContext *>(ctx)->withObject;
hasWith = true;
bool hasProperty = false;
Value v = w->get(ctx, name, &hasProperty);
@@ -454,13 +506,14 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
continue;
}
- if (ctx->type == CatchContext) {
+ if (ctx->type == Type_CatchContext) {
hasCatchScope = true;
- if (ctx->exceptionVarName->isEqualTo(name))
- return ctx->exceptionValue;
+ CatchContext *c = static_cast<CatchContext *>(ctx);
+ if (c->exceptionVarName->isEqualTo(name))
+ return c->exceptionValue;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -477,7 +530,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
if (hasProperty)
return v;
}
- if (ctx->type == CallContext) {
+ if (ctx->type == Type_CallContext) {
FunctionObject *f = ctx->function;
if (f->function && f->function->isNamedExpression
&& name->isEqualTo(f->function->name))
@@ -544,56 +597,6 @@ void ExecutionContext::throwURIError(Value msg)
throwError(Value::fromObject(engine->newURIErrorObject(this, msg)));
}
-void ExecutionContext::initCallContext(ExecutionEngine *engine)
-{
- type = CallContext;
- marked = false;
- this->engine = engine;
- outer = function->scope;
-#ifndef QT_NO_DEBUG
- assert(outer->next != (ExecutionContext *)0x1);
-#endif
-
- exceptionVarName = 0;
- exceptionValue = Value::undefinedValue();
-
- activation = 0;
- withObject = 0;
-
- strictMode = function->strictMode;
-
- if (function->function)
- lookups = function->function->lookups;
-
- uint argc = argumentCount;
-
- locals = (Value *)(this + 1);
- if (function->varCount)
- std::fill(locals, locals + function->varCount, Value::undefinedValue());
-
- if (needsOwnArguments()) {
- Value *args = arguments;
- argumentCount = qMax(argc, function->formalParameterCount);
- arguments = locals + function->varCount;
- if (argc)
- ::memcpy(arguments, args, argc * sizeof(Value));
- if (argc < function->formalParameterCount)
- std::fill(arguments + argc, arguments + function->formalParameterCount, Value::undefinedValue());
-
- }
-
- if (function->usesArgumentsObject) {
- ArgumentsObject *args = new (engine->memoryManager) ArgumentsObject(this, function->formalParameterCount, argc);
- args->prototype = engine->objectPrototype;
- Value arguments = Value::fromObject(args);
- createMutableBinding(engine->id_arguments, false);
- setMutableBinding(this, engine->id_arguments, arguments);
- }
-
- if (engine->debugger)
- engine->debugger->aboutToCall(function, this);
-}
-
void ExecutionContext::wireUpPrototype()
{
assert(thisObject.isObject());
diff --git a/src/v4/qv4context.h b/src/v4/qv4context.h
index 0eec77687d..b97d8be9e0 100644
--- a/src/v4/qv4context.h
+++ b/src/v4/qv4context.h
@@ -76,48 +76,37 @@ struct Q_V4_EXPORT DiagnosticMessage
struct ExecutionContext
{
enum Type {
- GlobalContext = 0x1,
- SimpleCallContext = 0x2,
- CallContext = 0x3,
- CatchContext = 0x4,
- WithContext = 0x5,
- QmlContext = 0x6
+ Type_GlobalContext = 0x1,
+ Type_SimpleCallContext = 0x2,
+ Type_CallContext = 0x3,
+ Type_CatchContext = 0x4,
+ Type_WithContext = 0x5,
+ Type_QmlContext = 0x6
};
+ Type type;
+ bool strictMode;
+ bool marked;
+
+ Value thisObject;
+
ExecutionEngine *engine;
ExecutionContext *outer;
- Value thisObject;
+ Lookup *lookups;
+ ExecutionContext *next; // used in the GC
+
+ // ### move to CallContext
Value *arguments;
unsigned int argumentCount;
- Type type;
-
- // ### remove me
Object *activation;
-
FunctionObject *function;
- Lookup *lookups;
-
Value *locals;
- ExecutionContext *next; // used in the GC
- String *exceptionVarName;
- Value exceptionValue;
-
- bool strictMode;
- bool marked;
-
- Object *withObject;
-
String * const *formals() const;
unsigned int formalCount() const;
String * const *variables() const;
unsigned int variableCount() const;
- void init(ExecutionEngine *e);
- void init(ExecutionContext *p, Object *with);
- void initForCatch(ExecutionContext *p, String *exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
- void initCallContext(QQmlJS::VM::ExecutionEngine *engine);
-
void createMutableBinding(String *name, bool deletable);
bool setMutableBinding(ExecutionContext *scope, String *name, const Value &value);
Value getBindingValue(ExecutionContext *scope, String *name, bool strict) const;
@@ -141,22 +130,52 @@ struct ExecutionContext
void inplaceBitOp(String *name, const QQmlJS::VM::Value &value, BinOp op);
bool deleteProperty(String *name);
- inline Value argument(unsigned int index = 0)
- {
- if (index < argumentCount)
- return arguments[index];
- return Value::undefinedValue();
- }
+ inline Value argument(unsigned int index = 0);
bool needsOwnArguments() const;
void mark();
};
+struct CallContext : public ExecutionContext
+{
+ void initCallContext(QQmlJS::VM::ExecutionEngine *engine);
+};
+
+struct GlobalContext : public ExecutionContext
+{
+ void init(ExecutionEngine *e);
+};
+
+struct CatchContext : public ExecutionContext
+{
+ void init(ExecutionContext *p, String *exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
+
+ String *exceptionVarName;
+ Value exceptionValue;
+};
+
+struct WithContext : public ExecutionContext
+{
+ Object *withObject;
+
+ void init(ExecutionContext *p, Object *with);
+};
+
+inline Value ExecutionContext::argument(unsigned int index)
+{
+ if (type == Type_CallContext) {
+ CallContext *ctx = static_cast<CallContext *>(this);
+ if (index < ctx->argumentCount)
+ return ctx->arguments[index];
+ }
+ return Value::undefinedValue();
+}
+
/* Function *f, int argc */
#define requiredMemoryForExecutionContect(f, argc) \
- sizeof(ExecutionContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount))
-#define stackContextSize (sizeof(ExecutionContext) + 32*sizeof(Value))
+ sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount))
+#define stackContextSize (sizeof(CallContext) + 32*sizeof(Value))
} // namespace VM
} // namespace QQmlJS
diff --git a/src/v4/qv4engine.cpp b/src/v4/qv4engine.cpp
index f23ce33b53..44b57244d5 100644
--- a/src/v4/qv4engine.cpp
+++ b/src/v4/qv4engine.cpp
@@ -253,10 +253,10 @@ ExecutionEngine::~ExecutionEngine()
void ExecutionEngine::initRootContext()
{
ensureContextStackSize();
- rootContext = memoryManager->allocContext(sizeof(ExecutionContext));
+ rootContext = static_cast<GlobalContext *>(memoryManager->allocContext(sizeof(GlobalContext)));
current = rootContext;
contextStack[0] = rootContext;
- current->init(this);
+ rootContext->init(this);
}
void ExecutionEngine::ensureContextStackSize()
@@ -274,73 +274,78 @@ void ExecutionEngine::ensureContextStackSize()
contextStack = newStack;
}
-ExecutionContext *ExecutionEngine::newWithContext(Object *with)
+WithContext *ExecutionEngine::newWithContext(Object *with)
{
ensureContextStackSize();
assert(contextStack[contextStackPosition + 1] == 0);
- ExecutionContext *c = current;
- current = memoryManager->allocContext(sizeof(ExecutionContext));
+ ExecutionContext *p = current;
+ WithContext *w = static_cast<WithContext *>(memoryManager->allocContext(sizeof(WithContext)));
+ current = w;
contextStack[++contextStackPosition] = current;
- current->init(c, with);
- return current;
+ w->init(p, with);
+ return w;
}
-ExecutionContext *ExecutionEngine::newCatchContext(String *exceptionVarName, const Value &exceptionValue)
+CatchContext *ExecutionEngine::newCatchContext(String *exceptionVarName, const Value &exceptionValue)
{
ensureContextStackSize();
assert(contextStack[contextStackPosition + 1] == 0);
- ExecutionContext *c = current;
- current = memoryManager->allocContext(sizeof(ExecutionContext));
+ ExecutionContext *p = current;
+ CatchContext *c = static_cast<CatchContext *>(memoryManager->allocContext(sizeof(CatchContext)));
+ current = c;
contextStack[++contextStackPosition] = current;
- current->initForCatch(c, exceptionVarName, exceptionValue);
- return current;
+ c->init(p, exceptionVarName, exceptionValue);
+ return c;
}
-ExecutionContext *ExecutionEngine::newCallContext(FunctionObject *f, const Value &thisObject, Value *args, int argc)
+CallContext *ExecutionEngine::newCallContext(FunctionObject *f, const Value &thisObject, Value *args, int argc)
{
ensureContextStackSize();
assert(contextStack[contextStackPosition + 1] == 0);
- current = memoryManager->allocContext(requiredMemoryForExecutionContect(f, argc));
+ CallContext *c = static_cast<CallContext *>(memoryManager->allocContext(requiredMemoryForExecutionContect(f, argc)));
+ current = c;
contextStack[++contextStackPosition] = current;
- current->function = f;
- current->thisObject = thisObject;
- current->arguments = args;
- current->argumentCount = argc;
- current->initCallContext(this);
+ c->function = f;
+ c->thisObject = thisObject;
+ c->arguments = args;
+ c->argumentCount = argc;
+ c->initCallContext(this);
- return current;
+ return c;
}
-ExecutionContext *ExecutionEngine::newCallContext(void *stackSpace, FunctionObject *f, const Value &thisObject, Value *args, int argc)
+CallContext *ExecutionEngine::newCallContext(void *stackSpace, FunctionObject *f, const Value &thisObject, Value *args, int argc)
{
ensureContextStackSize();
assert(contextStack[contextStackPosition + 1] == 0);
+ CallContext *c;
uint memory = requiredMemoryForExecutionContect(f, argc);
if (f->needsActivation || memory > stackContextSize) {
- current = memoryManager->allocContext(memory);
+ c = static_cast<CallContext *>(memoryManager->allocContext(memory));
} else {
- current = (ExecutionContext *)stackSpace;
+ c = (CallContext *)stackSpace;
#ifndef QT_NO_DEBUG
- current->next = (ExecutionContext *)0x1;
+ c->next = (CallContext *)0x1;
#endif
}
+ current = c;
contextStack[++contextStackPosition] = current;
- current->function = f;
- current->thisObject = thisObject;
- current->arguments = args;
- current->argumentCount = argc;
- current->initCallContext(this);
+ c->function = f;
+ c->thisObject = thisObject;
+ c->arguments = args;
+ c->argumentCount = argc;
+ c->initCallContext(this);
- return current;
+ return c;
}
diff --git a/src/v4/qv4engine.h b/src/v4/qv4engine.h
index b3dd3dc060..d63691c4f9 100644
--- a/src/v4/qv4engine.h
+++ b/src/v4/qv4engine.h
@@ -114,7 +114,7 @@ struct Q_V4_EXPORT ExecutionEngine
int contextStackSize;
ExecutionContext *current;
- ExecutionContext *rootContext;
+ GlobalContext *rootContext;
WTF::BumpPointerAllocator bumperPointerAllocator; // Used by Yarr Regex engine.
@@ -198,10 +198,10 @@ struct Q_V4_EXPORT ExecutionEngine
ExecutionEngine(EvalISelFactory *iselFactory = 0);
~ExecutionEngine();
- ExecutionContext *newWithContext(Object *with);
- ExecutionContext *newCatchContext(String* exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
- ExecutionContext *newCallContext(FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
- ExecutionContext *newCallContext(void *stackSpace, FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
+ WithContext *newWithContext(Object *with);
+ CatchContext *newCatchContext(String* exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
+ CallContext *newCallContext(FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
+ CallContext *newCallContext(void *stackSpace, FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
ExecutionContext *pushGlobalContext();
ExecutionContext *popContext();
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp
index 7e033542c7..f93d125229 100644
--- a/src/v4/qv4globalobject.cpp
+++ b/src/v4/qv4globalobject.cpp
@@ -394,10 +394,10 @@ Value EvalFunction::evalCall(ExecutionContext *parentContext, Value /*thisObject
needsActivation = f->needsActivation();
if (strictMode) {
- ExecutionContext *k = ctx->engine->newCallContext(this, ctx->thisObject, 0, 0);
+ CallContext *k = ctx->engine->newCallContext(this, ctx->thisObject, 0, 0);
if (qmlActivation) {
k->activation = qmlActivation;
- k->type = ExecutionContext::QmlContext;
+ k->type = ExecutionContext::Type_QmlContext;
}
ctx = k;
}