aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_objects.h
blob: 9645ea701bcf5a56e4a1eca91c4929997fa195aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the V4VM module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJS_OBJECTS_H
#define QMLJS_OBJECTS_H

#include "qmljs_runtime.h"
#include "qmljs_engine.h"
#include "qmljs_environment.h"
#include "qv4array_p.h"
#include "qv4codegen_p.h"
#include "qv4isel_p.h"
#include "qv4managed.h"

#include <QtCore/QString>
#include <QtCore/QHash>
#include <QtCore/QRegularExpression>
#include <QtCore/QScopedPointer>
#include <cstdio>
#include <cassert>

namespace QQmlJS {

namespace VM {

struct Value;
struct Function;
struct Object;
struct BooleanObject;
struct NumberObject;
struct StringObject;
struct ArrayObject;
struct DateObject;
struct FunctionObject;
struct RegExpObject;
struct ErrorObject;
struct ArgumentsObject;
struct ExecutionContext;
struct ExecutionEngine;
class MemoryManager;

struct ObjectPrototype;
struct StringPrototype;
struct NumberPrototype;
struct BooleanPrototype;
struct ArrayPrototype;
struct FunctionPrototype;
struct DatePrototype;
struct RegExpPrototype;
struct ErrorPrototype;
struct EvalErrorPrototype;
struct RangeErrorPrototype;
struct ReferenceErrorPrototype;
struct SyntaxErrorPrototype;
struct TypeErrorPrototype;
struct URIErrorPrototype;

struct String {
    inline bool isEqualTo(const String *other) const {
        if (this == other)
            return true;
        else if (other && hashValue() == other->hashValue())
            return toQString() == other->toQString();
        return false;
    }

    inline const QString &toQString() const {
        return _text;
    }

    inline unsigned hashValue() const {
        if (! _hashValue)
            _hashValue = qHash(_text);

        return _hashValue;
    }
    enum { InvalidArrayIndex = 0xffffffff };
    uint asArrayIndex() const;

private:
    friend class StringPool;
    String(const QString &text)
        : _text(text), _hashValue(0) {}

private:
    QString _text;
    mutable unsigned _hashValue;
};

struct PropertyDescriptor {
    enum Type {
        Generic,
        Data,
        Accessor
    };
    enum State {
        Undefined,
        Disabled,
        Enabled
    };
    union {
        Value value;
        struct {
            FunctionObject *get;
            FunctionObject *set;
        };
    };
    uint type : 8;
    uint writable : 8;
    uint enumberable : 8;
    uint configurable : 8;

    static inline PropertyDescriptor fromValue(Value v) {
        PropertyDescriptor pd;
        pd.value = v;
        pd.type = Data;
        pd.writable = Undefined;
        pd.enumberable = Undefined;
        pd.configurable = Undefined;
        return pd;
    }
    static inline PropertyDescriptor fromAccessor(FunctionObject *getter, FunctionObject *setter) {
        PropertyDescriptor pd;
        pd.get = getter;
        pd.set = setter;
        pd.type = Accessor;
        pd.writable = Undefined;
        pd.enumberable = Undefined;
        pd.configurable = Undefined;
        return pd;
    }

    // Section 8.10
    inline void fullyPopulated() {
        if (type == Generic) {
            type = Data;
            value = Value::undefinedValue();
        }
        if (type == Data) {
            if (writable == Undefined)
                writable = Disabled;
        } else {
            writable = Undefined;
        }
        if (enumberable == Undefined)
            enumberable = Disabled;
        if (configurable == Undefined)
            configurable = Disabled;
    }

    inline bool isData() const { return type == Data; }
    inline bool isAccessor() const { return type == Accessor; }
    inline bool isGeneric() const { return type == Generic; }

    inline bool isWritable() const { return writable == Enabled; }
    inline bool isEnumerable() const { return enumberable == Enabled; }
    inline bool isConfigurable() const { return configurable == Enabled; }

    inline bool isEmpty() {
        return type == Generic && writable == Undefined && enumberable == Undefined && configurable == Undefined;
    }
    inline bool isSubset(PropertyDescriptor *other) {
        if (type != other->type)
            return false;
        if (enumberable != Undefined && enumberable != other->enumberable)
            return false;
        if (configurable != Undefined && configurable != other->configurable)
            return false;
        if (writable != Undefined && writable != other->writable)
            return false;
        if (type == Data && !value.sameValue(other->value))
            return false;
        if (type == Accessor && (get != other->get || set != other->set))
            return false;
        return true;
    }
    inline void operator+=(const PropertyDescriptor &other) {
        type = other.type;
        if (other.enumberable != Undefined)
            enumberable = other.enumberable;
        if (other.configurable != Undefined)
            configurable = other.configurable;
        if (other.writable != Undefined)
            writable = other.writable;
        if (type == Accessor) {
            if (other.get)
                get = other.get;
            if (other.set)
                set = other.set;
        } else {
            value = other.value;
        }
    }
};

struct PropertyTableEntry {
    PropertyDescriptor descriptor;
    String *name;
    PropertyTableEntry *next;
    int index;

    inline PropertyTableEntry(String *name)
        : name(name),
          next(0),
          index(-1)
    { }

    inline bool hasName(String *n) const { return name->isEqualTo(n); }
    inline unsigned hashValue() const { return name->hashValue(); }
};

class PropertyTable
{
    Q_DISABLE_COPY(PropertyTable)

public:
    PropertyTable()
        : _properties(0)
        , _buckets(0)
        , _freeList(0)
        , _propertyCount(-1)
        , _bucketCount(0)
        , _primeIdx(-1)
        , _allocated(0)
    {}

    ~PropertyTable()
    {
        qDeleteAll(_properties, _properties + _propertyCount + 1);
        delete[] _properties;
        delete[] _buckets;
    }

    inline bool isEmpty() const { return _propertyCount == -1; }

    typedef PropertyTableEntry **iterator;
    inline iterator begin() const { return _properties; }
    inline iterator end() const { return _properties + (_propertyCount + 1); }

    void remove(PropertyTableEntry *prop)
    {
        PropertyTableEntry **bucket = _buckets + (prop->hashValue() % _bucketCount);
        if (*bucket == prop) {
            *bucket = prop->next;
        } else {
            for (PropertyTableEntry *it = *bucket; it; it = it->next) {
                if (it->next == prop) {
                    it->next = it->next->next;
                    break;
                }
            }
        }

        _properties[prop->index] = 0;
        prop->next = _freeList;
        _freeList = prop;
    }

    PropertyTableEntry *findEntry(String *name) const
    {
        if (_properties) {
            for (PropertyTableEntry *prop = _buckets[name->hashValue() % _bucketCount]; prop; prop = prop->next) {
                if (prop && (prop->name == name || prop->hasName(name)))
                    return prop;
            }
        }

        return 0;
    }

    PropertyDescriptor *find(String *name) const
    {
        if (_properties) {
            for (PropertyTableEntry *prop = _buckets[name->hashValue() % _bucketCount]; prop; prop = prop->next) {
                if (prop && (prop->name == name || prop->hasName(name)))
                    return &prop->descriptor;
            }
        }

        return 0;
    }

    PropertyDescriptor *insert(String *name)
    {
        if (PropertyTableEntry *prop = findEntry(name))
            return &prop->descriptor;

        if (++_propertyCount == _allocated) {
            if (! _allocated)
                _allocated = 4;
            else
                _allocated *= 2;

            PropertyTableEntry **properties = new PropertyTableEntry*[_allocated];
            std::copy(_properties, _properties + _propertyCount, properties);
            delete[] _properties;
            _properties = properties;
        }

        PropertyTableEntry *prop;
        if (_freeList) {
            prop = _freeList;
            _freeList = _freeList->next;
        } else {
            prop = new PropertyTableEntry(name);
        }

        prop->index = _propertyCount;
        _properties[_propertyCount] = prop;

        if (! _buckets || 3 * _propertyCount >= 2 * _bucketCount) {
            rehash();
        } else {
            PropertyTableEntry *&bucket = _buckets[prop->hashValue() % _bucketCount];
            prop->next = bucket;
            bucket = prop;
        }

        return &prop->descriptor;
    }

private:
    void rehash()
    {
        _bucketCount = nextPrime();

        delete[] _buckets;
        _buckets = new PropertyTableEntry *[_bucketCount];
        std::fill(_buckets, _buckets + _bucketCount, (PropertyTableEntry *) 0);

        for (int i = 0; i <= _propertyCount; ++i) {
            PropertyTableEntry *prop = _properties[i];
            PropertyTableEntry *&bucket = _buckets[prop->hashValue() % _bucketCount];
            prop->next = bucket;
            bucket = prop;
        }
    }

    inline int nextPrime()
    {
        // IMPORTANT: do not add more primes without checking if _primeIdx needs more bits!
        static const int primes[] = {
            11, 23, 47, 97, 197, 397, 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877
        };

        if (_primeIdx < (int) (sizeof(primes)/sizeof(int)))
            return primes[++_primeIdx];
        else
            return _bucketCount * 2 + 1; // Yes, we're degrading here. But who needs more than about 68000 properties?
    }

private:
    friend struct ForEachIteratorObject;
    PropertyTableEntry **_properties;
    PropertyTableEntry **_buckets;
    PropertyTableEntry *_freeList;
    int _propertyCount;
    int _bucketCount;
    int _primeIdx: 5;
    int _allocated: 27;
};

struct Object: Managed {
    Object *prototype;
    QScopedPointer<PropertyTable> members;

    Object()
        : prototype(0) {}

    virtual ~Object();

    virtual QString className() { return QStringLiteral("Object"); }
    virtual BooleanObject *asBooleanObject() { return 0; }
    virtual NumberObject *asNumberObject() { return 0; }
    virtual StringObject *asStringObject() { return 0; }
    virtual DateObject *asDateObject() { return 0; }
    virtual ArrayObject *asArrayObject() { return 0; }
    virtual FunctionObject *asFunctionObject() { return 0; }
    virtual RegExpObject *asRegExpObject() { return 0; }
    virtual ErrorObject *asErrorObject() { return 0; }
    virtual ArgumentsObject *asArgumentsObject() { return 0; }

    virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty = 0);
    virtual PropertyDescriptor *__getOwnProperty__(ExecutionContext *ctx, String *name);
    PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name);
    virtual void __put__(ExecutionContext *ctx, String *name, Value value);
    virtual bool __canPut__(ExecutionContext *ctx, String *name);
    virtual bool __hasProperty__(const ExecutionContext *ctx, String *name) const;
    virtual bool __delete__(ExecutionContext *ctx, String *name);
    virtual bool __defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc);
    bool __defineOwnProperty__(ExecutionContext *ctx, const QString &name, PropertyDescriptor *desc);

    virtual Value call(ExecutionContext *context, Value, Value *, int);

    //
    // helpers
    //
    void __put__(ExecutionContext *ctx, const QString &name, const Value &value);

    Value getValue(ExecutionContext *ctx, PropertyDescriptor *p) const;
    bool inplaceBinOp(Value rhs, String *name, BinOp op, ExecutionContext *ctx);
    virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx);

    /* The spec default: Writable: true, Enumerable: false, Configurable: true */
    void defineDefaultProperty(String *name, Value value);
    void defineDefaultProperty(ExecutionContext *context, const QString &name, Value value);
    void defineDefaultProperty(ExecutionContext *context, const QString &name, Value (*code)(ExecutionContext *), int count = 0);
    /* Fixed: Writable: false, Enumerable: false, Configurable: false */
    void defineReadonlyProperty(ExecutionEngine *engine, const QString &name, Value value);

protected:
    virtual void getCollectables(QVector<Object *> &objects);
};

struct ForEachIteratorObject: Object {
    Object *object;
    Object *current; // inside the prototype chain
    int tableIndex;
    ForEachIteratorObject(Object *o) : object(o), current(o), tableIndex(-1) {}
    virtual QString className() { return QStringLiteral("__ForEachIteratorObject"); }

    String *nextPropertyName();

protected:
    virtual void getCollectables(QVector<Object *> &objects);
};

struct BooleanObject: Object {
    Value value;
    BooleanObject(const Value &value): value(value) {}
    virtual QString className() { return QStringLiteral("Boolean"); }
    virtual BooleanObject *asBooleanObject() { return this; }
};

struct NumberObject: Object {
    Value value;
    NumberObject(const Value &value): value(value) {}
    virtual QString className() { return QStringLiteral("Number"); }
    virtual NumberObject *asNumberObject() { return this; }
};

struct StringObject: Object {
    Value value;
    StringObject(const Value &value): value(value) {}
    virtual QString className() { return QStringLiteral("String"); }
    virtual StringObject *asStringObject() { return this; }
};

struct DateObject: Object {
    Value value;
    DateObject(const Value &value): value(value) {}
    virtual QString className() { return QStringLiteral("Date"); }
    virtual DateObject *asDateObject() { return this; }
};

struct ArrayObject: Object {
    Array value;
    ArrayObject() {}
    ArrayObject(const Array &value): value(value) {}
    virtual QString className() { return QStringLiteral("Array"); }
    virtual ArrayObject *asArrayObject() { return this; }
    virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty);

    virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx);

protected:
    virtual void getCollectables(QVector<Object *> &objects);
};

struct Function {
    QString name;

    VM::Value (*code)(VM::ExecutionContext *, const uchar *);
    const uchar *codeData;
    JSC::MacroAssemblerCodeRef codeRef;

    QList<QString> formals;
    QList<QString> locals;
    QVector<Function *> nestedFunctions;

    bool hasDirectEval: 1;
    bool usesArgumentsObject : 1;
    bool isStrict: 1;

    Function(const QString &name)
        : name(name)
        , code(0)
        , codeData(0)
        , hasDirectEval(false)
        , usesArgumentsObject(false)
        , isStrict(false)
    {}
    ~Function();

    inline bool hasNestedFunctions() const { return !nestedFunctions.isEmpty(); }

    inline bool needsActivation() const { return hasNestedFunctions() || hasDirectEval || usesArgumentsObject; }
};

struct FunctionObject: Object {
    ExecutionContext *scope;
    String *name;
    String **formalParameterList;
    String **varList;
    unsigned int formalParameterCount;
    unsigned int varCount;

    FunctionObject(ExecutionContext *scope)
        : scope(scope)
        , name(0)
        , formalParameterList(0)
        , varList(0)
        , formalParameterCount(0)
        , varCount(0)
        { needsActivation = false;
          usesArgumentsObject = false;
          strictMode = false; }

    virtual QString className() { return QStringLiteral("Function"); }
    virtual FunctionObject *asFunctionObject() { return this; }
    virtual bool hasInstance(ExecutionContext *ctx, const Value &value);

    Value construct(ExecutionContext *context, Value *args, int argc);
    virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc);

    virtual struct ScriptFunction *asScriptFunction() { return 0; }

protected:
    virtual Value call(ExecutionContext *ctx);
    virtual Value construct(ExecutionContext *ctx);
};

struct NativeFunction: FunctionObject {
    Value (*code)(ExecutionContext *);

    NativeFunction(ExecutionContext *scope, String *name, Value (*code)(ExecutionContext *));
    virtual Value call(ExecutionContext *ctx) { return code(ctx); }
};

struct ScriptFunction: FunctionObject {
    VM::Function *function;

    ScriptFunction(ExecutionContext *scope, VM::Function *function);
    virtual ~ScriptFunction();

    virtual Value call(ExecutionContext *ctx);

    virtual ScriptFunction *asScriptFunction() { return this; }
};

struct EvalFunction : FunctionObject
{
    EvalFunction(ExecutionContext *scope);

    static QQmlJS::VM::Function *parseSource(QQmlJS::VM::ExecutionContext *ctx,
                                             const QString &fileName,
                                             const QString &source,
                                             QQmlJS::Codegen::Mode mode);

    virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc);
};

struct IsNaNFunction: FunctionObject
{
    IsNaNFunction(ExecutionContext *scope);

    virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc);
};

struct IsFiniteFunction: FunctionObject
{
    IsFiniteFunction(ExecutionContext *scope);

    virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc);
};

struct RegExpObject: Object {
    QRegularExpression value;
    Value lastIndex;
    bool global;
    RegExpObject(const QRegularExpression &value, bool global): value(value), lastIndex(Value::fromInt32(0)), global(global) {}
    virtual QString className() { return QStringLiteral("RegExp"); }
    virtual RegExpObject *asRegExpObject() { return this; }
    virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty);
};

struct ErrorObject: Object {
    Value value;
    ErrorObject(const Value &message): value(message) {}
    virtual QString className() { return QStringLiteral("Error"); }
    virtual ErrorObject *asErrorObject() { return this; }
    virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty);

    virtual struct SyntaxErrorObject *asSyntaxError() { return 0; }

protected:
    void setNameProperty(ExecutionContext *ctx);
    virtual void getCollectables(QVector<Object *> &objects);
};

struct EvalErrorObject: ErrorObject {
    EvalErrorObject(ExecutionContext *ctx)
        : ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
    virtual QString className() { return QStringLiteral("EvalError"); }
};

struct RangeErrorObject: ErrorObject {
    RangeErrorObject(ExecutionContext *ctx)
        : ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
    virtual QString className() { return QStringLiteral("RangeError"); }
};

struct ReferenceErrorObject: ErrorObject {
    ReferenceErrorObject(ExecutionContext *ctx)
        : ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
    ReferenceErrorObject(ExecutionContext *ctx, const QString &msg)
        : ErrorObject(Value::fromString(ctx,msg)) { setNameProperty(ctx); }
    virtual QString className() { return QStringLiteral("ReferenceError"); }
};

struct SyntaxErrorObject: ErrorObject {
    SyntaxErrorObject(ExecutionContext *ctx, DiagnosticMessage *msg);
    ~SyntaxErrorObject() { delete msg; }
    virtual QString className() { return QStringLiteral("SyntaxError"); }

    virtual SyntaxErrorObject *asSyntaxError() { return this; }
    DiagnosticMessage *message() { return msg; }

private:
    DiagnosticMessage *msg;
};

struct TypeErrorObject: ErrorObject {
    TypeErrorObject(ExecutionContext *ctx)
        : ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
    TypeErrorObject(ExecutionContext *ctx, const QString &msg)
        : ErrorObject(Value::fromString(ctx,msg)) { setNameProperty(ctx); }
    virtual QString className() { return QStringLiteral("TypeError"); }
};

struct URIErrorObject: ErrorObject {
    URIErrorObject(ExecutionContext *ctx)
        : ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
    virtual QString className() { return QStringLiteral("URIError"); }
};

struct ArgumentsObject: Object {
    ExecutionContext *context;
    int currentIndex;
    ArgumentsObject(ExecutionContext *context);
    virtual QString className() { return QStringLiteral("Arguments"); }
    virtual ArgumentsObject *asArgumentsObject() { return this; }

    virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty = 0);
    virtual void __put__(ExecutionContext *ctx, String *name, Value value);

    static Value method_getArg(ExecutionContext *ctx);
    static Value method_setArg(ExecutionContext *ctx);
};

} // namespace VM
} // namespace QQmlJS

#endif // QMLJS_OBJECTS_H