diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-06-21 22:04:54 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-22 21:05:40 +0200 |
commit | 957fe59e2b4f0fcb258fcd48d27ed98a1ed2a18b (patch) | |
tree | b97914b23e3340625531c6f84beb544f6e6302a2 | |
parent | f6297f355bf5e573ee10e2a156bde164e4ad744d (diff) |
Remove the execution context from most lookup calls.
Change-Id: I6f2bdfa233ebda1596a5a1d2b9d418cd45033d23
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/qml/v4/qv4isel_masm.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v4/qv4isel_masm_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/v4/qv4lookup.cpp | 54 | ||||
-rw-r--r-- | src/qml/qml/v4/qv4lookup_p.h | 22 |
4 files changed, 42 insertions, 38 deletions
diff --git a/src/qml/qml/v4/qv4isel_masm.cpp b/src/qml/qml/v4/qv4isel_masm.cpp index 240b162ce9..fce02526bc 100644 --- a/src/qml/qml/v4/qv4isel_masm.cpp +++ b/src/qml/qml/v4/qv4isel_masm.cpp @@ -931,7 +931,7 @@ void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::T String *propertyName = identifier(*name->id); if (useFastLookups && name->global) { uint index = addGlobalLookup(propertyName); - generateLookupCall(index, offsetof(QV4::Lookup, globalGetter), Assembler::PointerToValue(temp)); + generateLookupCall(index, offsetof(QV4::Lookup, globalGetter), Assembler::ContextRegister, Assembler::PointerToValue(temp)); return; } generateFunctionCall(Assembler::Void, __qmljs_get_activation_property, Assembler::ContextRegister, Assembler::PointerToValue(temp), propertyName); diff --git a/src/qml/qml/v4/qv4isel_masm_p.h b/src/qml/qml/v4/qv4isel_masm_p.h index dc0299a2da..3b7ef81483 100644 --- a/src/qml/qml/v4/qv4isel_masm_p.h +++ b/src/qml/qml/v4/qv4isel_masm_p.h @@ -879,7 +879,7 @@ private: Assembler::Address getterSetter = lookupAddr; getterSetter.offset += getterSetterOffset; - _as->generateFunctionCallImp(Assembler::Void, "lookup getter/setter", getterSetter, lookupAddr, Assembler::ContextRegister, arg1, arg2); + _as->generateFunctionCallImp(Assembler::Void, "lookup getter/setter", getterSetter, lookupAddr, arg1, arg2); } template <typename Arg1> diff --git a/src/qml/qml/v4/qv4lookup.cpp b/src/qml/qml/v4/qv4lookup.cpp index 61e2b8b87b..2292908936 100644 --- a/src/qml/qml/v4/qv4lookup.cpp +++ b/src/qml/qml/v4/qv4lookup.cpp @@ -86,7 +86,7 @@ Property *Lookup::lookup(Object *obj, PropertyAttributes *attrs) } -void Lookup::getterGeneric(QV4::Lookup *l, ExecutionContext *ctx, QV4::Value *result, const QV4::Value &object) +void Lookup::getterGeneric(QV4::Lookup *l, QV4::Value *result, const QV4::Value &object) { if (Object *o = object.asObject()) { o->getLookup(l, result); @@ -95,8 +95,9 @@ void Lookup::getterGeneric(QV4::Lookup *l, ExecutionContext *ctx, QV4::Value *re Value res; if (Managed *m = object.asManaged()) { - res = m->get(ctx, l->name); + res = m->get(m->engine()->current, l->name); } else { + ExecutionContext *ctx = l->name->engine()->current; Object *o = __qmljs_convert_to_object(ctx, object); res = o->get(ctx, l->name); } @@ -104,7 +105,7 @@ void Lookup::getterGeneric(QV4::Lookup *l, ExecutionContext *ctx, QV4::Value *re *result = res; } -void Lookup::getter0(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getter0(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass) { @@ -114,10 +115,10 @@ void Lookup::getter0(Lookup *l, ExecutionContext *ctx, Value *result, const Valu } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } -void Lookup::getter1(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getter1(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass && @@ -128,10 +129,10 @@ void Lookup::getter1(Lookup *l, ExecutionContext *ctx, Value *result, const Valu } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } -void Lookup::getter2(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getter2(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass) { @@ -147,10 +148,10 @@ void Lookup::getter2(Lookup *l, ExecutionContext *ctx, Value *result, const Valu } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } -void Lookup::getterAccessor0(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getterAccessor0(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass) { @@ -159,17 +160,17 @@ void Lookup::getterAccessor0(Lookup *l, ExecutionContext *ctx, Value *result, co if (!getter) res = Value::undefinedValue(); else - res = getter->call(ctx, object, 0, 0); + res = getter->call(getter->engine()->current, object, 0, 0); if (result) *result = res; return; } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } -void Lookup::getterAccessor1(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getterAccessor1(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass && @@ -179,17 +180,17 @@ void Lookup::getterAccessor1(Lookup *l, ExecutionContext *ctx, Value *result, co if (!getter) res = Value::undefinedValue(); else - res = getter->call(ctx, object, 0, 0); + res = getter->call(getter->engine()->current, object, 0, 0); if (result) *result = res; return; } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } -void Lookup::getterAccessor2(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object) +void Lookup::getterAccessor2(Lookup *l, Value *result, const Value &object) { if (Object *o = object.asObject()) { if (l->classList[0] == o->internalClass) { @@ -202,7 +203,7 @@ void Lookup::getterAccessor2(Lookup *l, ExecutionContext *ctx, Value *result, co if (!getter) res = Value::undefinedValue(); else - res = getter->call(ctx, object, 0, 0); + res = getter->call(getter->engine()->current, object, 0, 0); if (result) *result = res; return; @@ -211,7 +212,7 @@ void Lookup::getterAccessor2(Lookup *l, ExecutionContext *ctx, Value *result, co } } l->getter = getterGeneric; - getterGeneric(l, ctx, result, object); + getterGeneric(l, result, object); } @@ -338,24 +339,27 @@ void Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx, Value *resu globalGetterGeneric(l, ctx, result); } -void Lookup::setterGeneric(Lookup *l, ExecutionContext *ctx, const Value &object, const Value &value) +void Lookup::setterGeneric(Lookup *l, const Value &object, const Value &value) { - Object *o = object.toObject(ctx); + Object *o = object.asObject(); + if (!o) { + o = __qmljs_convert_to_object(l->name->engine()->current, object); + o->put(l->name, value); + return; + } o->setLookup(l, value); - return; } -void Lookup::setter0(Lookup *l, ExecutionContext *ctx, const Value &object, const Value &value) +void Lookup::setter0(Lookup *l, const Value &object, const Value &value) { - Object *o = object.toObject(ctx); - - if (o->internalClass == l->classList[0]) { + Object *o = object.asObject(); + if (o && o->internalClass == l->classList[0]) { o->memberData[l->index].value = value; return; } l->setter = setterGeneric; - setterGeneric(l, ctx, object, value); + setterGeneric(l, object, value); } QT_END_NAMESPACE diff --git a/src/qml/qml/v4/qv4lookup_p.h b/src/qml/qml/v4/qv4lookup_p.h index 80fbff2372..e6cc894009 100644 --- a/src/qml/qml/v4/qv4lookup_p.h +++ b/src/qml/qml/v4/qv4lookup_p.h @@ -55,22 +55,22 @@ namespace QV4 { struct Lookup { enum { Size = 3 }; union { - void (*getter)(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); + void (*getter)(Lookup *l, Value *result, const Value &object); void (*globalGetter)(Lookup *l, ExecutionContext *ctx, Value *result); - void (*setter)(Lookup *l, ExecutionContext *ctx, const Value &object, const Value &v); + void (*setter)(Lookup *l, const Value &object, const Value &v); }; InternalClass *classList[Size]; int level; uint index; String *name; - static void getterGeneric(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getter0(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getter1(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getter2(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getterAccessor0(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getterAccessor1(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); - static void getterAccessor2(Lookup *l, ExecutionContext *ctx, Value *result, const Value &object); + static void getterGeneric(Lookup *l, Value *result, const Value &object); + static void getter0(Lookup *l, Value *result, const Value &object); + static void getter1(Lookup *l, Value *result, const Value &object); + static void getter2(Lookup *l, Value *result, const Value &object); + static void getterAccessor0(Lookup *l, Value *result, const Value &object); + static void getterAccessor1(Lookup *l, Value *result, const Value &object); + static void getterAccessor2(Lookup *l, Value *result, const Value &object); static void globalGetterGeneric(Lookup *l, ExecutionContext *ctx, Value *result); static void globalGetter0(Lookup *l, ExecutionContext *ctx, Value *result); @@ -80,8 +80,8 @@ struct Lookup { static void globalGetterAccessor1(Lookup *l, ExecutionContext *ctx, Value *result); static void globalGetterAccessor2(Lookup *l, ExecutionContext *ctx, Value *result); - static void setterGeneric(Lookup *l, ExecutionContext *ctx, const Value &object, const Value &value); - static void setter0(Lookup *l, ExecutionContext *ctx, const Value &object, const Value &value); + static void setterGeneric(Lookup *l, const Value &object, const Value &value); + static void setter0(Lookup *l, const Value &object, const Value &value); Property *lookup(Object *obj, PropertyAttributes *attrs); |