diff options
author | Lars Knoll <[email protected]> | 2014-11-27 08:56:03 +0100 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2014-12-17 11:01:10 +0100 |
commit | 9d2a5ea28adf8ab35212ca8a71b479bc50960e3d (patch) | |
tree | c59e0799ccf55f832f1e2bde02e256ef62ac2d19 /src/qml/jsruntime/qv4objectiterator.cpp | |
parent | a58893eeda6bd48f41bdfa19eda147343be5f81e (diff) |
Return a Heap::Object in Object::prototype()
Change-Id: Ice0265ae558ba14497421a5bbf25ee9db76adab5
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4objectiterator.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectiterator.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index dfe37dfd53..338f756208 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -38,8 +38,9 @@ using namespace QV4; -ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags) - : object(scratch1) +ObjectIterator::ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags) + : engine(e) + , object(scratch1) , current(scratch2) , arrayNode(0) , arrayIndex(0) @@ -50,7 +51,8 @@ ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint } ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags) - : object(scope.alloc(1)) + : engine(scope.engine) + , object(scope.alloc(1)) , current(scope.alloc(1)) , arrayNode(0) , arrayIndex(0) @@ -60,19 +62,6 @@ ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags) init(o); } -ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, uint flags) - : object(scratch1) - , current(scratch2) - , arrayNode(0) - , arrayIndex(0) - , memberIndex(0) - , flags(flags) -{ - object->m = 0; - current->m = 0; - // Caller needs to call init! -} - void ObjectIterator::init(Object *o) { object->m = o ? &o->data : 0; @@ -98,6 +87,8 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr *attrs = PropertyAttributes(); return; } + Scope scope(engine); + ScopedObject o(scope); while (1) { if (!current->asObject()) @@ -109,7 +100,7 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr break; // check the property is not already defined earlier in the proto chain if (current->asObject() != object->asObject()) { - Object *o = object->asObject(); + o = object->asObject(); bool shadowed = false; while (o != current->asObject()) { if ((!!name && o->hasOwnProperty(name)) || @@ -125,10 +116,9 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr return; } - if (flags & WithProtoChain) { - Object *proto = current->objectValue()->prototype(); - current->m = proto ? &proto->data : 0; - } else + if (flags & WithProtoChain) + current->m = current->objectValue()->prototype(); + else current->m = (Heap::Base *)0; arrayIndex = 0; |