diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-06 17:40:48 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-10 17:15:00 +0100 |
commit | 4b850f3d1e79bb66a53f097ae7b7cc26db8cc2f8 (patch) | |
tree | a46d33ec16596e179aac7ece8bb929f68b03faab /src/qml/jsruntime/qv4typedarray_p.h | |
parent | 3c1041cbfd70a03322ca0278e0db8ac0651c0792 (diff) |
Move Data for typedarrays into Heap namespace
Change-Id: I1737423c22e0c68c9eaa14f6d4f5b1e48aea4a77
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4typedarray_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4typedarray_p.h | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h index 20a7827bf2..adc3368243 100644 --- a/src/qml/jsruntime/qv4typedarray_p.h +++ b/src/qml/jsruntime/qv4typedarray_p.h @@ -52,8 +52,9 @@ struct TypedArrayOperations { TypedArrayWrite write; }; -struct TypedArray : Object -{ +namespace Heap { + +struct TypedArray : Object { enum Type { Int8Array, UInt8Array, @@ -67,15 +68,31 @@ struct TypedArray : Object NTypes }; - struct Data : Heap::Object { - Data(ExecutionEngine *e, Type t); + TypedArray(ExecutionEngine *e, Type t); + + const TypedArrayOperations *type; + ArrayBuffer *buffer; + uint byteLength; + uint byteOffset; +}; + +struct TypedArrayCtor : FunctionObject { + TypedArrayCtor(QV4::ExecutionContext *scope, TypedArray::Type t); + + TypedArray::Type type; +}; + +struct TypedArrayPrototype : Object { + inline TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t); + TypedArray::Type type; +}; - const TypedArrayOperations *type; - ArrayBuffer *buffer; - uint byteLength; - uint byteOffset; - }; - V4_OBJECT(Object) + +} + +struct TypedArray : Object +{ + V4_OBJECT2(TypedArray, Object) uint length() const { return d()->byteLength/d()->type->bytesPerElement; @@ -89,13 +106,7 @@ struct TypedArray : Object struct TypedArrayCtor: FunctionObject { - struct Data : Heap::FunctionObject { - Data(ExecutionContext *scope, TypedArray::Type t); - - TypedArray::Type type; - }; - - V4_OBJECT(FunctionObject) + V4_OBJECT2(TypedArrayCtor, FunctionObject) static ReturnedValue construct(Managed *m, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); @@ -104,16 +115,7 @@ struct TypedArrayCtor: FunctionObject struct TypedArrayPrototype : Object { - struct Data : Heap::Object { - Data(ExecutionEngine *e, TypedArray::Type t) - : Heap::Object(e) - , type(t) - { - setVTable(staticVTable()); - } - TypedArray::Type type; - }; - V4_OBJECT(Object) + V4_OBJECT2(TypedArrayPrototype, Object) void init(ExecutionEngine *engine, TypedArrayCtor *ctor); @@ -126,6 +128,14 @@ struct TypedArrayPrototype : Object static ReturnedValue method_subarray(CallContext *ctx); }; +inline +Heap::TypedArrayPrototype::TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t) + : Heap::Object(e) + , type(t) +{ + setVTable(QV4::TypedArrayPrototype::staticVTable()); +} + } // namespace QV4 QT_END_NAMESPACE |