Search in sources :

Example 1 with ArrayBufferConstructor

use of com.github.anba.es6draft.runtime.objects.binary.ArrayBufferConstructor in project es6draft by anba.

the class Realm method initializeBinaryModule.

/**
 * <h1>22.2 TypedArray Objects, 24.1 ArrayBuffer Objects, 24.2 DataView Objects</h1>
 *
 * @param realm
 *            the realm instance
 */
private static void initializeBinaryModule(Realm realm) {
    EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
    // allocation phase
    ArrayBufferConstructor arrayBufferConstructor = new ArrayBufferConstructor(realm);
    ArrayBufferPrototype arrayBufferPrototype = new ArrayBufferPrototype(realm);
    TypedArrayConstructorPrototype typedArrayConstructor = new TypedArrayConstructorPrototype(realm);
    TypedArrayPrototypePrototype typedArrayPrototype = new TypedArrayPrototypePrototype(realm);
    TypedArrayConstructor int8ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int8);
    TypedArrayPrototype int8ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int8);
    TypedArrayConstructor uint8ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint8);
    TypedArrayPrototype uint8ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint8);
    TypedArrayConstructor uint8CArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint8C);
    TypedArrayPrototype uint8CArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint8C);
    TypedArrayConstructor int16ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int16);
    TypedArrayPrototype int16ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int16);
    TypedArrayConstructor uint16ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint16);
    TypedArrayPrototype uint16ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint16);
    TypedArrayConstructor int32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Int32);
    TypedArrayPrototype int32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Int32);
    TypedArrayConstructor uint32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Uint32);
    TypedArrayPrototype uint32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Uint32);
    TypedArrayConstructor float32ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Float32);
    TypedArrayPrototype float32ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Float32);
    TypedArrayConstructor float64ArrayConstructor = new TypedArrayConstructor(realm, ElementType.Float64);
    TypedArrayPrototype float64ArrayPrototype = new TypedArrayPrototype(realm, ElementType.Float64);
    DataViewConstructor dataViewConstructor = new DataViewConstructor(realm);
    DataViewPrototype dataViewPrototype = new DataViewPrototype(realm);
    // registration phase
    intrinsics.put(Intrinsics.ArrayBuffer, arrayBufferConstructor);
    intrinsics.put(Intrinsics.ArrayBufferPrototype, arrayBufferPrototype);
    intrinsics.put(Intrinsics.TypedArray, typedArrayConstructor);
    intrinsics.put(Intrinsics.TypedArrayPrototype, typedArrayPrototype);
    intrinsics.put(Intrinsics.Int8Array, int8ArrayConstructor);
    intrinsics.put(Intrinsics.Int8ArrayPrototype, int8ArrayPrototype);
    intrinsics.put(Intrinsics.Uint8Array, uint8ArrayConstructor);
    intrinsics.put(Intrinsics.Uint8ArrayPrototype, uint8ArrayPrototype);
    intrinsics.put(Intrinsics.Uint8ClampedArray, uint8CArrayConstructor);
    intrinsics.put(Intrinsics.Uint8ClampedArrayPrototype, uint8CArrayPrototype);
    intrinsics.put(Intrinsics.Int16Array, int16ArrayConstructor);
    intrinsics.put(Intrinsics.Int16ArrayPrototype, int16ArrayPrototype);
    intrinsics.put(Intrinsics.Uint16Array, uint16ArrayConstructor);
    intrinsics.put(Intrinsics.Uint16ArrayPrototype, uint16ArrayPrototype);
    intrinsics.put(Intrinsics.Int32Array, int32ArrayConstructor);
    intrinsics.put(Intrinsics.Int32ArrayPrototype, int32ArrayPrototype);
    intrinsics.put(Intrinsics.Uint32Array, uint32ArrayConstructor);
    intrinsics.put(Intrinsics.Uint32ArrayPrototype, uint32ArrayPrototype);
    intrinsics.put(Intrinsics.Float32Array, float32ArrayConstructor);
    intrinsics.put(Intrinsics.Float32ArrayPrototype, float32ArrayPrototype);
    intrinsics.put(Intrinsics.Float64Array, float64ArrayConstructor);
    intrinsics.put(Intrinsics.Float64ArrayPrototype, float64ArrayPrototype);
    intrinsics.put(Intrinsics.DataView, dataViewConstructor);
    intrinsics.put(Intrinsics.DataViewPrototype, dataViewPrototype);
    // initialization phase
    arrayBufferConstructor.initialize(realm);
    arrayBufferPrototype.initialize(realm);
    typedArrayConstructor.initialize(realm);
    typedArrayPrototype.initialize(realm);
    int8ArrayConstructor.initialize(realm);
    int8ArrayPrototype.initialize(realm);
    uint8ArrayConstructor.initialize(realm);
    uint8ArrayPrototype.initialize(realm);
    uint8CArrayConstructor.initialize(realm);
    uint8CArrayPrototype.initialize(realm);
    int16ArrayConstructor.initialize(realm);
    int16ArrayPrototype.initialize(realm);
    uint16ArrayConstructor.initialize(realm);
    uint16ArrayPrototype.initialize(realm);
    int32ArrayConstructor.initialize(realm);
    int32ArrayPrototype.initialize(realm);
    uint32ArrayConstructor.initialize(realm);
    uint32ArrayPrototype.initialize(realm);
    float32ArrayConstructor.initialize(realm);
    float32ArrayPrototype.initialize(realm);
    float64ArrayConstructor.initialize(realm);
    float64ArrayPrototype.initialize(realm);
    dataViewConstructor.initialize(realm);
    dataViewPrototype.initialize(realm);
}
Also used : TypedArrayPrototype(com.github.anba.es6draft.runtime.objects.binary.TypedArrayPrototype) SharedArrayBufferConstructor(com.github.anba.es6draft.runtime.objects.atomics.SharedArrayBufferConstructor) ArrayBufferConstructor(com.github.anba.es6draft.runtime.objects.binary.ArrayBufferConstructor) TypedArrayConstructor(com.github.anba.es6draft.runtime.objects.binary.TypedArrayConstructor) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) TypedArrayConstructorPrototype(com.github.anba.es6draft.runtime.objects.binary.TypedArrayConstructorPrototype) DataViewPrototype(com.github.anba.es6draft.runtime.objects.binary.DataViewPrototype) TypedArrayPrototypePrototype(com.github.anba.es6draft.runtime.objects.binary.TypedArrayPrototypePrototype) SharedArrayBufferPrototype(com.github.anba.es6draft.runtime.objects.atomics.SharedArrayBufferPrototype) ArrayBufferPrototype(com.github.anba.es6draft.runtime.objects.binary.ArrayBufferPrototype) DataViewConstructor(com.github.anba.es6draft.runtime.objects.binary.DataViewConstructor)

Aggregations

SharedArrayBufferConstructor (com.github.anba.es6draft.runtime.objects.atomics.SharedArrayBufferConstructor)1 SharedArrayBufferPrototype (com.github.anba.es6draft.runtime.objects.atomics.SharedArrayBufferPrototype)1 ArrayBufferConstructor (com.github.anba.es6draft.runtime.objects.binary.ArrayBufferConstructor)1 ArrayBufferPrototype (com.github.anba.es6draft.runtime.objects.binary.ArrayBufferPrototype)1 DataViewConstructor (com.github.anba.es6draft.runtime.objects.binary.DataViewConstructor)1 DataViewPrototype (com.github.anba.es6draft.runtime.objects.binary.DataViewPrototype)1 TypedArrayConstructor (com.github.anba.es6draft.runtime.objects.binary.TypedArrayConstructor)1 TypedArrayConstructorPrototype (com.github.anba.es6draft.runtime.objects.binary.TypedArrayConstructorPrototype)1 TypedArrayPrototype (com.github.anba.es6draft.runtime.objects.binary.TypedArrayPrototype)1 TypedArrayPrototypePrototype (com.github.anba.es6draft.runtime.objects.binary.TypedArrayPrototypePrototype)1 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)1 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)1