Exemplo n.º 1
0
        public JSArrayBuffer()
            : base(new mdr.DObject(), "ArrayBuffer")
        {
            JittedCode = (ref mdr.CallFrame callFrame) =>
            {
                DArrayBuffer buffer;
                var          len       = 0;
                var          argsCount = callFrame.PassedArgsCount;
                if (argsCount > 0)
                {
                    len = Math.Max(0, callFrame.Arg0.AsInt32());
                }

                buffer = new DArrayBuffer(TargetPrototype, len);
                if (IsConstrutor)
                {
                    callFrame.This = (buffer);
                }
                else
                {
                    callFrame.Return.Set(buffer);
                }
            };

            TargetPrototype.DefineOwnProperty("byteLength", new mdr.DProperty()
            {
                OnGetDValue = (mdr.DObject This, ref mdr.DValue v) =>
                {
                    v.Set((This as DArrayBuffer).ByteLength);
                },
                OnSetDValue = (mdr.DObject This, ref mdr.DValue v) => { /* do nothing */ },
                OnSetInt    = (mdr.DObject This, int v) => { /* do nothing */ },
            });
        }
Exemplo n.º 2
0
        public JSArrayBuffer()
            : base(new mdr.DObject(), "ArrayBuffer")
        {
            JittedCode = (ref mdr.CallFrame callFrame) =>
            {
                DArrayBuffer buffer;
                var len = 0;
                var argsCount = callFrame.PassedArgsCount;
                if (argsCount > 0)
                    len = Math.Max(0, callFrame.Arg0.AsInt32());

                buffer = new DArrayBuffer(TargetPrototype, len);
                if (IsConstrutor)
                    callFrame.This = (buffer);
                else
                    callFrame.Return.Set(buffer);
            };

            TargetPrototype.DefineOwnProperty("byteLength", new mdr.DProperty()
            {
                OnGetDValue = (mdr.DObject This, ref mdr.DValue v) =>
                {
                    v.Set((This as DArrayBuffer).ByteLength);
                },
                OnSetDValue = (mdr.DObject This, ref mdr.DValue v) => { /* do nothing */ },
                OnSetInt = (mdr.DObject This, int v) => { /* do nothing */ },
            });
        }
Exemplo n.º 3
0
 protected DTypedArray(mdr.DObject prototype, DArrayBuffer array, int byteoffset, int bytelength, int typesize)
     : base(prototype)
 {
     ByteOffset_ = byteoffset;
     TypeSize_ = typesize;
     ByteLength_ = bytelength;
     Elements_ = array.Elements_;
 }
Exemplo n.º 4
0
 protected DTypedArray(mdr.DObject prototype, DArrayBuffer array, int byteoffset, int bytelength, int typesize)
     : base(prototype)
 {
     ByteOffset_ = byteoffset;
     TypeSize_   = typesize;
     ByteLength_ = bytelength;
     Elements_   = array.Elements_;
 }
Exemplo n.º 5
0
 public DInt16Array(mdr.DObject prototype, DArrayBuffer array, int byteoffset, int bytelength, int typesize)
     : base(prototype, array, byteoffset, bytelength, typesize) { }
Exemplo n.º 6
0
 public DFloat32Array(mdr.DObject prototype, DArrayBuffer array, int byteoffset, int bytelength, int typesize)
     : base(prototype, array, byteoffset, bytelength, typesize)
 {
 }