ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags)
    : object(scope.alloc(1))
    , current(scope.alloc(1))
    , arrayNode(0)
    , arrayIndex(0)
    , memberIndex(0)
    , flags(flags)
{
    init(o);
}
ObjectIterator::ObjectIterator(Scope &scope, const ObjectRef o, uint flags)
    : object(ObjectRef::fromValuePointer(scope.alloc(1)))
    , current(ObjectRef::fromValuePointer(scope.alloc(1)))
    , arrayNode(0)
    , arrayIndex(0)
    , memberIndex(0)
    , flags(flags)
{
    object = o;
    current = o;

    if (!!object && object->asArgumentsObject()) {
        Scope scope(object->engine());
        Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate();
    }
}