// GENERATED, DO NOT EDIT // file: testAtomics.js // Copyright (C) 2017 Mozilla Corporation. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| CollectionoffunctionsusedtoassertthecorrectnessofSharedArrayBufferobjects. defines: -testWithAtomicsOutOfBoundsIndices -testWithAtomicsInBoundsIndices -testWithAtomicsNonViewValues
---*/
function testWithAtomicsNonViewValues(f) { var values = [ null,
undefined, true, false, newBoolean(true), 10, 3.14, new Number(4), 'Hi there', new Date,
/a*utomaton/g,
{ password: 'qumquat' }, new DataView(new ArrayBuffer(10)), new ArrayBuffer(128), new SharedArrayBuffer(128), new Error('Ouch'),
[1,1,2,3,5,8], function(x) { return -x; },
Symbol('halleluja'), // TODO: Proxy?
Object,
Int32Array,
Date,
Math,
Atomics
];
for (var i = 0; i < values.length; ++i) { var nonView = values[i]; try {
f(nonView);
} catch (e) {
e.message += ' (Testing with non-view value ' + nonView + '.)'; throw e;
}
}
}
// file: testTypedArray.js // Copyright (C) 2015 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| CollectionoffunctionsusedtoassertthecorrectnessofTypedArrayobjects. defines: -floatArrayConstructors -nonClampedIntArrayConstructors -intArrayConstructors -typedArrayConstructors -TypedArray -testWithAllTypedArrayConstructors -testWithTypedArrayConstructors -testWithBigIntTypedArrayConstructors -nonAtomicsFriendlyTypedArrayConstructors -testWithAtomicsFriendlyTypedArrayConstructors -testWithNonAtomicsFriendlyTypedArrayConstructors -testTypedArrayConversions
---*/
var floatArrayConstructors = [
Float64Array,
Float32Array
];
var intArrayConstructors = nonClampedIntArrayConstructors.concat([Uint8ClampedArray]);
// Float16Array is a newer feature // adding it to this list unconditionally would cause implementations lacking it to fail every test which uses it if (typeof Float16Array !== "undefined") {
floatArrayConstructors.push(Float16Array);
}
var bigIntArrayConstructors = []; if (typeof BigInt64Array !== "undefined") {
bigIntArrayConstructors.push(BigInt64Array);
} if (typeof BigUint64Array !== "undefined") {
bigIntArrayConstructors.push(BigUint64Array);
}
/** *Arraycontainingeverynon-biginttypedarrayconstructor.
*/ var typedArrayConstructors = floatArrayConstructors.concat(intArrayConstructors);
/** *Arraycontainingeverytypedarrayconstructor,includingthosewithbigintvalues.
*/ var allTypedArrayConstructors = typedArrayConstructors.concat(bigIntArrayConstructors);
/** *The%TypedArray%intrinsicconstructorfunction.
*/ var TypedArray = Object.getPrototypeOf(Int8Array);
function makePassthrough(TA, primitiveOrIterable) { return primitiveOrIterable;
}
function makeArray(TA, primitiveOrIterable) { if (isPrimitive(primitiveOrIterable)) { var n = Number(primitiveOrIterable); // Only values between 0 and 2**53 - 1 inclusive can get mapped into TA contents. if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; return Array.from({ length: n }, function() { return"0"; });
} return Array.from(primitiveOrIterable);
}
function makeArrayLike(TA, primitiveOrIterable) { var arr = makeArray(TA, primitiveOrIterable); if (isPrimitive(arr)) return arr; var obj = { length: arr.length }; for (var i = 0; i < obj.length; i++) obj[i] = arr[i]; return obj;
}
var makeIterable; if (typeof Symbol !== "undefined" && Symbol.iterator) {
makeIterable = function makeIterable(TA, primitiveOrIterable) { var src = makeArray(TA, primitiveOrIterable); if (isPrimitive(src)) return src; var obj = {};
obj[Symbol.iterator] = function() { return src[Symbol.iterator](); }; return obj;
};
}
function makeArrayBuffer(TA, primitiveOrIterable) { var arr = makeArray(TA, primitiveOrIterable); if (isPrimitive(arr)) return arr; returnnew TA(arr).buffer;
}
var makeResizableArrayBuffer, makeGrownArrayBuffer, makeShrunkArrayBuffer, makeImmutableArrayBuffer; if (ArrayBuffer.prototype.resize) { var copyIntoArrayBuffer = function(destBuffer, srcBuffer) { var destView = new Uint8Array(destBuffer); var srcView = new Uint8Array(srcBuffer); for (var i = 0; i < srcView.length; i++) destView[i] = srcView[i]; return destBuffer;
};
makeResizableArrayBuffer = function makeResizableArrayBuffer(TA, primitiveOrIterable) { if (isPrimitive(primitiveOrIterable)) { var n = Number(primitiveOrIterable) * TA.BYTES_PER_ELEMENT; if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; returnnew ArrayBuffer(n, { maxByteLength: n * 2 });
} var fixed = makeArrayBuffer(TA, primitiveOrIterable); var byteLength = fixed.byteLength; var resizable = new ArrayBuffer(byteLength, { maxByteLength: byteLength * 2 }); return copyIntoArrayBuffer(resizable, fixed);
};
makeGrownArrayBuffer = function makeGrownArrayBuffer(TA, primitiveOrIterable) { if (isPrimitive(primitiveOrIterable)) { var n = Number(primitiveOrIterable) * TA.BYTES_PER_ELEMENT; if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; var grown = new ArrayBuffer(Math.floor(n / 2), { maxByteLength: n });
grown.resize(n);
} var fixed = makeArrayBuffer(TA, primitiveOrIterable); var byteLength = fixed.byteLength; var grown = new ArrayBuffer(Math.floor(byteLength / 2), { maxByteLength: byteLength });
grown.resize(byteLength); return copyIntoArrayBuffer(grown, fixed);
};
makeShrunkArrayBuffer = function makeShrunkArrayBuffer(TA, primitiveOrIterable) { if (isPrimitive(primitiveOrIterable)) { var n = Number(primitiveOrIterable) * TA.BYTES_PER_ELEMENT; if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; var shrunk = new ArrayBuffer(n * 2, { maxByteLength: n * 2 });
shrunk.resize(n);
} var fixed = makeArrayBuffer(TA, primitiveOrIterable); var byteLength = fixed.byteLength; var shrunk = new ArrayBuffer(byteLength * 2, { maxByteLength: byteLength * 2 });
copyIntoArrayBuffer(shrunk, fixed);
shrunk.resize(byteLength); return shrunk;
};
} if (ArrayBuffer.prototype.transferToImmutable) {
makeImmutableArrayBuffer = function makeImmutableArrayBuffer(TA, primitiveOrIterable) { if (isPrimitive(primitiveOrIterable)) { var n = Number(primitiveOrIterable) * TA.BYTES_PER_ELEMENT; if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; return (new ArrayBuffer(n)).transferToImmutable();
} var mutable = makeArrayBuffer(TA, primitiveOrIterable); return mutable.transferToImmutable();
};
}
var typedArrayCtorArgFactories = [makePassthrough, makeArray, makeArrayLike]; if (makeIterable) typedArrayCtorArgFactories.push(makeIterable);
typedArrayCtorArgFactories.push(makeArrayBuffer); if (makeResizableArrayBuffer) typedArrayCtorArgFactories.push(makeResizableArrayBuffer); if (makeGrownArrayBuffer) typedArrayCtorArgFactories.push(makeGrownArrayBuffer); if (makeShrunkArrayBuffer) typedArrayCtorArgFactories.push(makeShrunkArrayBuffer); if (makeImmutableArrayBuffer) typedArrayCtorArgFactories.push(makeImmutableArrayBuffer);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.