aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-11-12 16:07:56 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-21 13:08:28 +0100
commitf58b5229a31e9fec49b4eb055c56f9a78e423866 (patch)
tree6214fb89929fd9482c2154b0fe17c7cba0f509cb /src/qml/jsruntime/qv4object.cpp
parente6db292366fa6ad25536fee08b2a972ea617d968 (diff)
Fix run-time string handling with regards to the new heap
Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 29c2528d95..d95c8cf444 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -458,9 +458,10 @@ void Object::setLookup(Managed *m, Lookup *l, const ValueRef value)
{
Scope scope(m->engine());
ScopedObject o(scope, static_cast<Object *>(m));
+ ScopedString name(scope, scope.engine->currentContext()->d()->compilationUnit->runtimeStrings[l->nameIndex]);
InternalClass *c = o->internalClass();
- uint idx = c->find(l->name);
+ uint idx = c->find(name);
if (!o->isArrayObject() || idx != Heap::ArrayObject::LengthPropertyIndex) {
if (idx != UINT_MAX && o->internalClass()->propertyData[idx].isData() && o->internalClass()->propertyData[idx].isWritable()) {
l->classList[0] = o->internalClass();
@@ -476,12 +477,11 @@ void Object::setLookup(Managed *m, Lookup *l, const ValueRef value)
}
}
- ScopedString s(scope, l->name);
- o->put(s.getPointer(), value);
+ o->put(name, value);
if (o->internalClass() == c)
return;
- idx = o->internalClass()->find(l->name);
+ idx = o->internalClass()->find(name);
if (idx == UINT_MAX)
return;
l->classList[0] = c;
@@ -1150,7 +1150,9 @@ Heap::ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
ReturnedValue ArrayObject::getLookup(Managed *m, Lookup *l)
{
- if (l->name->equals(m->engine()->id_length)) {
+ Scope scope(m->engine());
+ ScopedString name(scope, m->engine()->currentContext()->d()->compilationUnit->runtimeStrings[l->nameIndex]);
+ if (name->equals(m->engine()->id_length)) {
// special case, as the property is on the object itself
l->getter = Lookup::arrayLengthGetter;
ArrayObject *a = static_cast<ArrayObject *>(m);