diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data.dart
similarity index 51%
rename from runtime/lib/typed_data_patch.dart
rename to runtime/lib/typed_data.dart
index 6ad50f31e91..0875fbc989e 100644
--- a/runtime/lib/typed_data_patch.dart
+++ b/runtime/lib/typed_data.dart
@@ -2,13 +2,85 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// Unlike the other SDK libraries, this file is not a patch that is applied to
+// dart:typed_data. Instead, it completely replaces the implementation from the
+// SDK.
+library dart.typed_data;
+
import "dart:_internal";
import "dart:collection" show ListBase;
import 'dart:math' show Random;
-@patch
+/**
+ * A typed view of a sequence of bytes.
+ */
+abstract class TypedData {
+ /**
+ * Returns the number of bytes in the representation of each element in this
+ * list.
+ */
+ int get elementSizeInBytes;
+
+ /**
+ * Returns the offset in bytes into the underlying byte buffer of this view.
+ */
+ int get offsetInBytes;
+
+ /**
+ * Returns the length of this view, in bytes.
+ */
+ int get lengthInBytes;
+
+ /**
+ * Returns the byte buffer associated with this object.
+ */
+ ByteBuffer get buffer;
+}
+
+
+/**
+ * Describes endianness to be used when accessing or updating a
+ * sequence of bytes.
+ */
+class Endianness {
+ const Endianness._(this._littleEndian);
+
+ static const Endianness BIG_ENDIAN = const Endianness._(false);
+ static const Endianness LITTLE_ENDIAN = const Endianness._(true);
+ static final Endianness HOST_ENDIAN =
+ (new ByteData.view(new Uint16List.fromList([1]).buffer)).getInt8(0) == 1 ?
+ LITTLE_ENDIAN : BIG_ENDIAN;
+
+ final bool _littleEndian;
+}
+
+
+/**
+ * A fixed-length, random-access sequence of bytes that also provides random
+ * and unaligned access to the fixed-width integers and floating point
+ * numbers represented by those bytes.
+ *
+ * `ByteData` may be used to pack and unpack data from external sources
+ * (such as networks or files systems), and to process large quantities
+ * of numerical data more efficiently than would be possible
+ * with ordinary [List] implementations.
+ * `ByteData` can save space, by eliminating the need for object headers,
+ * and time, by eliminating the need for data copies.
+ * Finally, `ByteData` may be used to intentionally reinterpret the bytes
+ * representing one arithmetic type as another.
+ * For example this code fragment determine what 32-bit signed integer
+ * is represented by the bytes of a 32-bit floating point number:
+ *
+ * var buffer = new Uint8List(8).buffer;
+ * var bdata = new ByteData.view(buffer);
+ * bdata.setFloat32(0, 3.04);
+ * int huh = bdata.getInt32(0);
+ */
class ByteData implements TypedData {
- @patch
+ /**
+ * Creates a [ByteData] of the specified length (in elements), all of
+ * whose bytes are initially zero.
+ */
factory ByteData(int length) {
var list = new Uint8List(length);
return new _ByteDataView(list, 0, length);
@@ -18,14 +90,302 @@ class ByteData implements TypedData {
factory ByteData._view(TypedData typedData, int offsetInBytes, int length) {
return new _ByteDataView(typedData, offsetInBytes, length);
}
+
+ /**
+ * Creates an [ByteData] _view_ of the specified region in [buffer].
+ *
+ * Changes in the [ByteData] will be visible in the byte
+ * buffer and vice versa.
+ * If the [offsetInBytes] index of the region is not specified,
+ * it defaults to zero (the first byte in the byte buffer).
+ * If the length is not specified, it defaults to `null`,
+ * which indicates that the view extends to the end of the byte buffer.
+ *
+ * Throws [RangeError] if [offsetInBytes] or [length] are negative, or
+ * if [offsetInBytes] + ([length] * elementSizeInBytes) is greater than
+ * the length of [buffer].
+ */
+ factory ByteData.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asByteData(offsetInBytes, length);
+ }
+
+ /**
+ * Returns the (possibly negative) integer represented by the byte at the
+ * specified [byteOffset] in this object, in two's complement binary
+ * representation.
+ *
+ * The return value will be between -128 and 127, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * greater than or equal to the length of this object.
+ */
+ int getInt8(int byteOffset);
+
+ /**
+ * Sets the byte at the specified [byteOffset] in this object to the
+ * two's complement binary representation of the specified [value], which
+ * must fit in a single byte.
+ *
+ * In other words, [value] must be between -128 and 127, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * greater than or equal to the length of this object.
+ */
+ void setInt8(int byteOffset, int value);
+
+ /**
+ * Returns the positive integer represented by the byte at the specified
+ * [byteOffset] in this object, in unsigned binary form.
+ *
+ * The return value will be between 0 and 255, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * greater than or equal to the length of this object.
+ */
+ int getUint8(int byteOffset);
+
+ /**
+ * Sets the byte at the specified [byteOffset] in this object to the
+ * unsigned binary representation of the specified [value], which must fit
+ * in a single byte.
+ *
+ * In other words, [value] must be between 0 and 255, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative,
+ * or greater than or equal to the length of this object.
+ */
+ void setUint8(int byteOffset, int value);
+
+ /**
+ * Returns the (possibly negative) integer represented by the two bytes at
+ * the specified [byteOffset] in this object, in two's complement binary
+ * form.
+ *
+ * The return value will be between 215 and 215 - 1,
+ * inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 2` is greater than the length of this object.
+ */
+ int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the two bytes starting at the specified [byteOffset] in this
+ * object to the two's complement binary representation of the specified
+ * [value], which must fit in two bytes.
+ *
+ * In other words, [value] must lie
+ * between 215 and 215 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 2` is greater than the length of this object.
+ */
+ void setInt16(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the positive integer represented by the two bytes starting
+ * at the specified [byteOffset] in this object, in unsigned binary
+ * form.
+ *
+ * The return value will be between 0 and 216 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 2` is greater than the length of this object.
+ */
+ int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the two bytes starting at the specified [byteOffset] in this object
+ * to the unsigned binary representation of the specified [value],
+ * which must fit in two bytes.
+ *
+ * In other words, [value] must be between
+ * 0 and 216 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 2` is greater than the length of this object.
+ */
+ void setUint16(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the (possibly negative) integer represented by the four bytes at
+ * the specified [byteOffset] in this object, in two's complement binary
+ * form.
+ *
+ * The return value will be between 231 and 231 - 1,
+ * inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the four bytes starting at the specified [byteOffset] in this
+ * object to the two's complement binary representation of the specified
+ * [value], which must fit in four bytes.
+ *
+ * In other words, [value] must lie
+ * between 231 and 231 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ void setInt32(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the positive integer represented by the four bytes starting
+ * at the specified [byteOffset] in this object, in unsigned binary
+ * form.
+ *
+ * The return value will be between 0 and 232 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the four bytes starting at the specified [byteOffset] in this object
+ * to the unsigned binary representation of the specified [value],
+ * which must fit in four bytes.
+ *
+ * In other words, [value] must be between
+ * 0 and 232 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ void setUint32(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the (possibly negative) integer represented by the eight bytes at
+ * the specified [byteOffset] in this object, in two's complement binary
+ * form.
+ *
+ * The return value will be between 263 and 263 - 1,
+ * inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the eight bytes starting at the specified [byteOffset] in this
+ * object to the two's complement binary representation of the specified
+ * [value], which must fit in eight bytes.
+ *
+ * In other words, [value] must lie
+ * between 263 and 263 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ void setInt64(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the positive integer represented by the eight bytes starting
+ * at the specified [byteOffset] in this object, in unsigned binary
+ * form.
+ *
+ * The return value will be between 0 and 264 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the eight bytes starting at the specified [byteOffset] in this object
+ * to the unsigned binary representation of the specified [value],
+ * which must fit in eight bytes.
+ *
+ * In other words, [value] must be between
+ * 0 and 264 - 1, inclusive.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ void setUint64(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the floating point number represented by the four bytes at
+ * the specified [byteOffset] in this object, in IEEE 754
+ * single-precision binary floating-point format (binary32).
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ double getFloat32(int byteOffset,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the four bytes starting at the specified [byteOffset] in this
+ * object to the IEEE 754 single-precision binary floating-point
+ * (binary32) representation of the specified [value].
+ *
+ * **Note that this method can lose precision.** The input [value] is
+ * a 64-bit floating point value, which will be converted to 32-bit
+ * floating point value by IEEE 754 rounding rules before it is stored.
+ * If [value] cannot be represented exactly as a binary32, it will be
+ * converted to the nearest binary32 value. If two binary32 values are
+ * equally close, the one whose least significant bit is zero will be used.
+ * Note that finite (but large) values can be converted to infinity, and
+ * small non-zero values can be converted to zero.
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 4` is greater than the length of this object.
+ */
+ void setFloat32(int byteOffset,
+ double value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Returns the floating point number represented by the eight bytes at
+ * the specified [byteOffset] in this object, in IEEE 754
+ * double-precision binary floating-point format (binary64).
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ double getFloat64(int byteOffset,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
+
+ /**
+ * Sets the eight bytes starting at the specified [byteOffset] in this
+ * object to the IEEE 754 double-precision binary floating-point
+ * (binary64) representation of the specified [value].
+ *
+ * Throws [RangeError] if [byteOffset] is negative, or
+ * `byteOffset + 8` is greater than the length of this object.
+ */
+ void setFloat64(int byteOffset,
+ double value,
+ [Endianness endian = Endianness.BIG_ENDIAN]);
}
+
// Based class for _TypedList that provides common methods for implementing
// the collection and list interfaces.
// This class does not extend ListBase since that would add type arguments
// to instances of _TypeListBase. Instead the subclasses use type specific
// mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase.
abstract class _TypedListBase {
+
// Method(s) implementing the Collection interface.
bool contains(element) {
var len = this.length;
@@ -59,8 +419,8 @@ abstract class _TypedListBase {
return value;
}
- dynamic fold(
- dynamic initialValue, dynamic combine(dynamic initialValue, element)) {
+ dynamic fold(dynamic initialValue,
+ dynamic combine(dynamic initialValue, element)) {
var len = this.length;
for (var i = 0; i < len; ++i) {
initialValue = combine(initialValue, this[i]);
@@ -142,23 +502,28 @@ abstract class _TypedListBase {
// Method(s) implementing the List interface.
set length(newLength) {
- throw new UnsupportedError("Cannot resize a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot resize a fixed-length list");
}
void add(value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot add to a fixed-length list");
}
void addAll(Iterable value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot add to a fixed-length list");
}
void insert(int index, value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot insert into a fixed-length list");
}
void sort([int compare(a, b)]) {
@@ -188,27 +553,33 @@ abstract class _TypedListBase {
}
void clear() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
int removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
bool remove(Object element) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
bool removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
void removeWhere(bool test(element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
void retainWhere(bool test(element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
dynamic get first {
@@ -228,11 +599,13 @@ abstract class _TypedListBase {
}
void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
void replaceRange(int start, int end, Iterable iterable) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw new UnsupportedError(
+ "Cannot remove from a fixed-length list");
}
List toList({bool growable: true}) {
@@ -254,7 +627,7 @@ abstract class _TypedListBase {
void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
// Check ranges.
if (0 > start || start > end || end > length) {
- RangeError.checkValidRange(start, end, length); // Always throws.
+ RangeError.checkValidRange(start, end, length); // Always throws.
assert(false);
}
if (skipCount < 0) {
@@ -272,12 +645,11 @@ abstract class _TypedListBase {
Lists.copy(from, skipCount, this, start, count);
return;
} else if (this.buffer._data._setRange(
- start * elementSizeInBytes + this.offsetInBytes,
- count * elementSizeInBytes,
- from.buffer._data,
- skipCount * elementSizeInBytes + from.offsetInBytes,
- ClassID.getID(this),
- ClassID.getID(from))) {
+ start * elementSizeInBytes + this.offsetInBytes,
+ count * elementSizeInBytes,
+ from.buffer._data,
+ skipCount * elementSizeInBytes + from.offsetInBytes,
+ ClassID.getID(this), ClassID.getID(from))) {
return;
}
} else if (from.buffer == this.buffer) {
@@ -323,9 +695,12 @@ abstract class _TypedListBase {
}
}
+
// Method(s) implementing Object interface.
+
String toString() => ListBase.listToString(this);
+
// Internal utility methods.
// Returns true if operation succeeds.
@@ -333,22 +708,25 @@ abstract class _TypedListBase {
// match the cids of 'this' and 'from'.
// Uses toCid and fromCid to decide if clamping is necessary.
// Element size of toCid and fromCid must match (test at caller).
- bool _setRange(int startInBytes, int lengthInBytes, _TypedListBase from,
- int startFromInBytes, int toCid, int fromCid) native "TypedData_setRange";
+ bool _setRange(int startInBytes, int lengthInBytes,
+ _TypedListBase from, int startFromInBytes,
+ int toCid, int fromCid)
+ native "TypedData_setRange";
}
+
class _IntListMixin {
Iterable where(bool f(int element)) => new WhereIterable(this, f);
Iterable take(int n) => new SubListIterable(this, 0, n);
Iterable takeWhile(bool test(int element)) =>
- new TakeWhileIterable(this, test);
+ new TakeWhileIterable(this, test);
Iterable skip(int n) => new SubListIterable(this, n, null);
Iterable skipWhile(bool test(element)) =>
- new SkipWhileIterable(this, test);
+ new SkipWhileIterable(this, test);
Iterable get reversed => new ReversedListIterable(this);
@@ -370,19 +748,20 @@ class _IntListMixin {
}
}
+
class _DoubleListMixin {
Iterable where(bool f(int element)) =>
- new WhereIterable(this, f);
+ new WhereIterable(this, f);
Iterable take(int n) => new SubListIterable(this, 0, n);
Iterable takeWhile(bool test(int element)) =>
- new TakeWhileIterable(this, test);
+ new TakeWhileIterable(this, test);
Iterable skip(int n) => new SubListIterable(this, n, null);
Iterable skipWhile(bool test(element)) =>
- new SkipWhileIterable(this, test);
+ new SkipWhileIterable(this, test);
Iterable get reversed => new ReversedListIterable(this);
@@ -404,20 +783,21 @@ class _DoubleListMixin {
}
}
+
class _Float32x4ListMixin {
Iterable where(bool f(int element)) =>
- new WhereIterable(this, f);
+ new WhereIterable(this, f);
Iterable take(int n) => new SubListIterable(this, 0, n);
Iterable takeWhile(bool test(int element)) =>
- new TakeWhileIterable(this, test);
+ new TakeWhileIterable(this, test);
Iterable skip(int n) =>
- new SubListIterable(this, n, null);
+ new SubListIterable(this, n, null);
Iterable skipWhile(bool test(element)) =>
- new SkipWhileIterable(this, test);
+ new SkipWhileIterable(this, test);
Iterable get reversed => new ReversedListIterable(this);
@@ -439,19 +819,20 @@ class _Float32x4ListMixin {
}
}
+
class _Int32x4ListMixin {
Iterable where(bool f(int element)) =>
- new WhereIterable(this, f);
+ new WhereIterable(this, f);
Iterable take(int n) => new SubListIterable(this, 0, n);
Iterable takeWhile(bool test(int element)) =>
- new TakeWhileIterable(this, test);
+ new TakeWhileIterable(this, test);
Iterable skip(int n) => new SubListIterable(this, n, null);
Iterable skipWhile(bool test(element)) =>
- new SkipWhileIterable(this, test);
+ new SkipWhileIterable(this, test);
Iterable get reversed => new ReversedListIterable(this);
@@ -473,20 +854,21 @@ class _Int32x4ListMixin {
}
}
+
class _Float64x2ListMixin {
Iterable where(bool f(int element)) =>
- new WhereIterable(this, f);
+ new WhereIterable(this, f);
Iterable take(int n) => new SubListIterable(this, 0, n);
Iterable takeWhile(bool test(int element)) =>
- new TakeWhileIterable(this, test);
+ new TakeWhileIterable(this, test);
Iterable skip(int n) =>
- new SubListIterable(this, n, null);
+ new SubListIterable(this, n, null);
Iterable skipWhile(bool test(element)) =>
- new SkipWhileIterable(this, test);
+ new SkipWhileIterable(this, test);
Iterable get reversed => new ReversedListIterable(this);
@@ -508,18 +890,19 @@ class _Float64x2ListMixin {
}
}
-class _ByteBuffer implements ByteBuffer {
+
+class ByteBuffer {
final _TypedList _data;
- _ByteBuffer(this._data);
+ ByteBuffer(this._data);
- factory _ByteBuffer._New(data) => new _ByteBuffer(data);
+ factory ByteBuffer._New(data) => new ByteBuffer(data);
// Forward calls to _data.
int get lengthInBytes => _data.lengthInBytes;
int get hashCode => _data.hashCode;
- bool operator ==(Object other) =>
- (other is _ByteBuffer) && identical(_data, other._data);
+ bool operator==(Object other) =>
+ (other is ByteBuffer) && identical(_data, other._data);
ByteData asByteData([int offsetInBytes = 0, int length]) {
if (length == null) {
@@ -551,64 +934,64 @@ class _ByteBuffer implements ByteBuffer {
Int16List asInt16List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Int16List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Int16List.BYTES_PER_ELEMENT;
}
return new _Int16ArrayView(this, offsetInBytes, length);
}
Uint16List asUint16List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Uint16List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Uint16List.BYTES_PER_ELEMENT;
}
return new _Uint16ArrayView(this, offsetInBytes, length);
}
Int32List asInt32List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Int32List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Int32List.BYTES_PER_ELEMENT;
}
return new _Int32ArrayView(this, offsetInBytes, length);
}
Uint32List asUint32List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Uint32List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Uint32List.BYTES_PER_ELEMENT;
}
return new _Uint32ArrayView(this, offsetInBytes, length);
}
Int64List asInt64List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Int64List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Int64List.BYTES_PER_ELEMENT;
}
return new _Int64ArrayView(this, offsetInBytes, length);
}
Uint64List asUint64List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Uint64List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Uint64List.BYTES_PER_ELEMENT;
}
return new _Uint64ArrayView(this, offsetInBytes, length);
}
Float32List asFloat32List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Float32List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Float32List.BYTES_PER_ELEMENT;
}
return new _Float32ArrayView(this, offsetInBytes, length);
}
Float64List asFloat64List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Float64List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Float64List.BYTES_PER_ELEMENT;
}
return new _Float64ArrayView(this, offsetInBytes, length);
}
@@ -616,15 +999,15 @@ class _ByteBuffer implements ByteBuffer {
Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
if (length == null) {
length = (this.lengthInBytes - offsetInBytes) ~/
- Float32x4List.BYTES_PER_ELEMENT;
+ Float32x4List.BYTES_PER_ELEMENT;
}
return new _Float32x4ArrayView(this, offsetInBytes, length);
}
Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
if (length == null) {
- length =
- (this.lengthInBytes - offsetInBytes) ~/ Int32x4List.BYTES_PER_ELEMENT;
+ length = (this.lengthInBytes - offsetInBytes) ~/
+ Int32x4List.BYTES_PER_ELEMENT;
}
return new _Int32x4ArrayView(this, offsetInBytes, length);
}
@@ -632,12 +1015,13 @@ class _ByteBuffer implements ByteBuffer {
Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
if (length == null) {
length = (this.lengthInBytes - offsetInBytes) ~/
- Float64x2List.BYTES_PER_ELEMENT;
+ Float64x2List.BYTES_PER_ELEMENT;
}
return new _Float64x2ArrayView(this, offsetInBytes, length);
}
}
+
abstract class _TypedList extends _TypedListBase {
// Default method implementing parts of the TypedData interface.
int get offsetInBytes {
@@ -648,7 +1032,7 @@ abstract class _TypedList extends _TypedListBase {
return length * elementSizeInBytes;
}
- _ByteBuffer get buffer => new _ByteBuffer(this);
+ ByteBuffer get buffer => new ByteBuffer(this);
// Methods implementing the collection interface.
@@ -704,169 +1088,187 @@ abstract class _TypedList extends _TypedListBase {
* Stores the [CodeUnits] as UTF-16 units into this TypedData at
* positions [start]..[end] (uint16 indices).
*/
- void _setCodeUnits(
- CodeUnits units, int byteStart, int length, int skipCount) {
+ void _setCodeUnits(CodeUnits units,
+ int byteStart, int length, int skipCount) {
assert(byteStart + length * Uint16List.BYTES_PER_ELEMENT <= lengthInBytes);
String string = CodeUnits.stringOf(units);
int sliceEnd = skipCount + length;
- RangeError.checkValidRange(
- skipCount, sliceEnd, string.length, "skipCount", "skipCount + length");
+ RangeError.checkValidRange(skipCount, sliceEnd,
+ string.length,
+ "skipCount", "skipCount + length");
for (int i = 0; i < length; i++) {
_setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT,
- string.codeUnitAt(skipCount + i));
+ string.codeUnitAt(skipCount + i));
}
}
}
-@patch
-class Int8List {
- @patch
+
+class Int8List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Int8List(int length) native "TypedData_Int8Array_new";
- @patch
factory Int8List.fromList(List elements) {
return new Int8List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Int8List extends _TypedList with _IntListMixin implements Int8List {
- Type get runtimeType => Int8List;
+ factory Int8List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asInt8List(offsetInBytes, length);
+ }
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getInt8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setInt8(index, _toInt8(value));
}
+ static const int BYTES_PER_ELEMENT = 1;
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Int8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int8List _createList(int length) {
return new Int8List(length);
}
}
-@patch
-class Uint8List {
- @patch
+
+class Uint8List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Uint8List(int length) native "TypedData_Uint8Array_new";
- @patch
factory Uint8List.fromList(List elements) {
return new Uint8List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Uint8List extends _TypedList with _IntListMixin implements Uint8List {
- Type get runtimeType => Uint8List;
+ factory Uint8List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asUint8List(offsetInBytes, length);
+ }
// Methods implementing List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toUint8(value));
}
+ static const int BYTES_PER_ELEMENT = 1;
+
// Methods implementing TypedData interface.
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
// Internal utility methods.
+
Uint8List _createList(int length) {
return new Uint8List(length);
}
}
-@patch
-class Uint8ClampedList {
- @patch
+
+class Uint8ClampedList extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new";
- @patch
factory Uint8ClampedList.fromList(List elements) {
return new Uint8ClampedList(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Uint8ClampedList extends _TypedList
- with _IntListMixin
- implements Uint8ClampedList {
- Type get runtimeType => Uint8ClampedList;
+ factory Uint8ClampedList.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asUint8ClampedList(offsetInBytes, length);
+ }
// Methods implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toClampedUint8(value));
}
+ static const int BYTES_PER_ELEMENT = 1;
+
// Methods implementing TypedData interface.
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint8ClampedList _createList(int length) {
return new Uint8ClampedList(length);
}
}
-@patch
-class Int16List {
- @patch
+
+class Int16List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Int16List(int length) native "TypedData_Int16Array_new";
- @patch
factory Int16List.fromList(List elements) {
return new Int16List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Int16List extends _TypedList with _IntListMixin implements Int16List {
- Type get runtimeType => Int16List;
+ factory Int16List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asInt16List(offsetInBytes, length);
+ }
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt16(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
@@ -885,11 +1287,15 @@ class _Int16List extends _TypedList with _IntListMixin implements Int16List {
}
// Method(s) implementing TypedData interface.
+ static const int BYTES_PER_ELEMENT = 2;
+
int get elementSizeInBytes {
return Int16List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int16List _createList(int length) {
return new Int16List(length);
}
@@ -903,30 +1309,32 @@ class _Int16List extends _TypedList with _IntListMixin implements Int16List {
}
}
-@patch
-class Uint16List {
- @patch
+
+class Uint16List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Uint16List(int length) native "TypedData_Uint16Array_new";
- @patch
factory Uint16List.fromList(List elements) {
return new Uint16List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
- Type get runtimeType => Uint16List;
+ factory Uint16List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asUint16List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint16(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
@@ -945,11 +1353,15 @@ class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
}
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 2;
+
int get elementSizeInBytes {
return Uint16List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint16List _createList(int length) {
return new Uint16List(length);
}
@@ -963,42 +1375,49 @@ class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
}
}
-@patch
-class Int32List {
- @patch
+
+class Int32List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Int32List(int length) native "TypedData_Int32Array_new";
- @patch
factory Int32List.fromList(List elements) {
return new Int32List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Int32List extends _TypedList with _IntListMixin implements Int32List {
- Type get runtimeType => Int32List;
+ factory Int32List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asInt32List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt32(index, _toInt32(value));
}
+
// Method(s) implementing TypedData interface.
+ static const int BYTES_PER_ELEMENT = 4;
+
int get elementSizeInBytes {
return Int32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32List _createList(int length) {
return new Int32List(length);
}
@@ -1010,44 +1429,52 @@ class _Int32List extends _TypedList with _IntListMixin implements Int32List {
void _setIndexedInt32(int index, int value) {
_setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
}
+
}
-@patch
-class Uint32List {
- @patch
+
+class Uint32List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Uint32List(int length) native "TypedData_Uint32Array_new";
- @patch
factory Uint32List.fromList(List elements) {
return new Uint32List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Uint32List extends _TypedList with _IntListMixin implements Uint32List {
- Type get runtimeType => Uint32List;
+ factory Uint32List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asUint32List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint32(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedUint32(index, _toUint32(value));
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 4;
+
int get elementSizeInBytes {
return Uint32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint32List _createList(int length) {
return new Uint32List(length);
}
@@ -1061,42 +1488,49 @@ class _Uint32List extends _TypedList with _IntListMixin implements Uint32List {
}
}
-@patch
-class Int64List {
- @patch
+
+class Int64List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Int64List(int length) native "TypedData_Int64Array_new";
- @patch
factory Int64List.fromList(List elements) {
return new Int64List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Int64List extends _TypedList with _IntListMixin implements Int64List {
- Type get runtimeType => Int64List;
+ factory Int64List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asInt64List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt64(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt64(index, _toInt64(value));
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 8;
+
int get elementSizeInBytes {
return Int64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int64List _createList(int length) {
return new Int64List(length);
}
@@ -1110,42 +1544,49 @@ class _Int64List extends _TypedList with _IntListMixin implements Int64List {
}
}
-@patch
-class Uint64List {
- @patch
+
+class Uint64List extends _TypedList with _IntListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Uint64List(int length) native "TypedData_Uint64Array_new";
- @patch
factory Uint64List.fromList(List elements) {
return new Uint64List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Uint64List extends _TypedList with _IntListMixin implements Uint64List {
- Type get runtimeType => Uint64List;
+ factory Uint64List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asUint64List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint64(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedUint64(index, _toUint64(value));
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 8;
+
int get elementSizeInBytes {
return Uint64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint64List _createList(int length) {
return new Uint64List(length);
}
@@ -1159,44 +1600,49 @@ class _Uint64List extends _TypedList with _IntListMixin implements Uint64List {
}
}
-@patch
-class Float32List {
- @patch
+
+class Float32List extends _TypedList with _DoubleListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Float32List(int length) native "TypedData_Float32Array_new";
- @patch
factory Float32List.fromList(List elements) {
return new Float32List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Float32List extends _TypedList
- with _DoubleListMixin
- implements Float32List {
- Type get runtimeType => Float32List;
+ factory Float32List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asFloat32List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- double operator [](int index) {
+
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32(index);
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32(index, value);
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 4;
+
int get elementSizeInBytes {
return Float32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32List _createList(int length) {
return new Float32List(length);
}
@@ -1210,44 +1656,49 @@ class _Float32List extends _TypedList
}
}
-@patch
-class Float64List {
- @patch
+
+class Float64List extends _TypedList with _DoubleListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Float64List(int length) native "TypedData_Float64Array_new";
- @patch
factory Float64List.fromList(List elements) {
return new Float64List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Float64List extends _TypedList
- with _DoubleListMixin
- implements Float64List {
- Type get runtimeType => Float64List;
+ factory Float64List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asFloat64List(offsetInBytes, length);
+ }
// Method(s) implementing the List interface.
- double operator [](int index) {
+
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64(index);
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64(index, value);
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 8;
+
int get elementSizeInBytes {
return Float64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64List _createList(int length) {
return new Float64List(length);
}
@@ -1261,43 +1712,47 @@ class _Float64List extends _TypedList
}
}
-@patch
-class Float32x4List {
- @patch
+
+class Float32x4List extends _TypedList with _Float32x4ListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Float32x4List(int length) native "TypedData_Float32x4Array_new";
- @patch
factory Float32x4List.fromList(List elements) {
return new Float32x4List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Float32x4List extends _TypedList
- with _Float32x4ListMixin
- implements Float32x4List {
- Type get runtimeType => Float32x4List;
+ factory Float32x4List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asFloat32x4List(offsetInBytes, length);
+ }
- Float32x4 operator [](int index) {
+ Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32x4(index);
}
- void operator []=(int index, Float32x4 value) {
+ void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32x4(index, value);
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 16;
+
int get elementSizeInBytes {
return Float32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32x4List _createList(int length) {
return new Float32x4List(length);
}
@@ -1311,43 +1766,47 @@ class _Float32x4List extends _TypedList
}
}
-@patch
-class Int32x4List {
- @patch
+
+class Int32x4List extends _TypedList with _Int32x4ListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Int32x4List(int length) native "TypedData_Int32x4Array_new";
- @patch
factory Int32x4List.fromList(List elements) {
return new Int32x4List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Int32x4List extends _TypedList
- with _Int32x4ListMixin
- implements Int32x4List {
- Type get runtimeType => Int32x4List;
+ factory Int32x4List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asInt32x4List(offsetInBytes, length);
+ }
- Int32x4 operator [](int index) {
+ Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32x4(index);
}
- void operator []=(int index, Int32x4 value) {
+ void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt32x4(index, value);
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 16;
+
int get elementSizeInBytes {
return Int32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32x4List _createList(int length) {
return new Int32x4List(length);
}
@@ -1361,43 +1820,47 @@ class _Int32x4List extends _TypedList
}
}
-@patch
-class Float64x2List {
- @patch
+
+class Float64x2List extends _TypedList with _Float64x2ListMixin implements List, TypedData {
+ // Factory constructors.
+
factory Float64x2List(int length) native "TypedData_Float64x2Array_new";
- @patch
factory Float64x2List.fromList(List elements) {
return new Float64x2List(elements.length)
- ..setRange(0, elements.length, elements);
+ ..setRange(0, elements.length, elements);
}
-}
-class _Float64x2List extends _TypedList
- with _Float64x2ListMixin
- implements Float64x2List {
- Type get runtimeType => Float64x2List;
+ factory Float64x2List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ return buffer.asFloat64x2List(offsetInBytes, length);
+ }
- Float64x2 operator [](int index) {
+ Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64x2(index);
}
- void operator []=(int index, Float64x2 value) {
+ void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64x2(index, value);
}
+
// Method(s) implementing the TypedData interface.
+ static const int BYTES_PER_ELEMENT = 16;
+
int get elementSizeInBytes {
return Float64x2List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64x2List _createList(int length) {
return new Float64x2List(length);
}
@@ -1411,118 +1874,132 @@ class _Float64x2List extends _TypedList
}
}
-class _ExternalInt8Array extends _TypedList
- with _IntListMixin
- implements Int8List {
+
+class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getInt8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setInt8(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Int8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int8List _createList(int length) {
return new Int8List(length);
}
}
-class _ExternalUint8Array extends _TypedList
- with _IntListMixin
- implements Uint8List {
+
+class _ExternalUint8Array extends _TypedList with _IntListMixin implements Uint8List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toUint8(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint8List _createList(int length) {
return new Uint8List(length);
}
}
-class _ExternalUint8ClampedArray extends _TypedList
- with _IntListMixin
- implements Uint8ClampedList {
+
+class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implements Uint8ClampedList {
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getUint8(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setUint8(index, _toClampedUint8(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint8ClampedList _createList(int length) {
return new Uint8ClampedList(length);
}
}
-class _ExternalInt16Array extends _TypedList
- with _IntListMixin
- implements Int16List {
+
+class _ExternalInt16Array extends _TypedList with _IntListMixin implements Int16List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt16(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt16(index, _toInt16(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Int16List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int16List _createList(int length) {
return new Int16List(length);
}
@@ -1536,31 +2013,34 @@ class _ExternalInt16Array extends _TypedList
}
}
-class _ExternalUint16Array extends _TypedList
- with _IntListMixin
- implements Uint16List {
+
+class _ExternalUint16Array extends _TypedList with _IntListMixin implements Uint16List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint16(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedUint16(index, _toUint16(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Uint16List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint16List _createList(int length) {
return new Uint16List(length);
}
@@ -1574,30 +2054,34 @@ class _ExternalUint16Array extends _TypedList
}
}
-class _ExternalInt32Array extends _TypedList
- with _IntListMixin
- implements Int32List {
+
+class _ExternalInt32Array extends _TypedList with _IntListMixin implements Int32List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt32(index, _toInt32(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Int32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32List _createList(int length) {
return new Int32List(length);
}
@@ -1611,31 +2095,34 @@ class _ExternalInt32Array extends _TypedList
}
}
-class _ExternalUint32Array extends _TypedList
- with _IntListMixin
- implements Uint32List {
+
+class _ExternalUint32Array extends _TypedList with _IntListMixin implements Uint32List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint32(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedUint32(index, _toUint32(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Uint32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint32List _createList(int length) {
return new Uint32List(length);
}
@@ -1649,31 +2136,34 @@ class _ExternalUint32Array extends _TypedList
}
}
-class _ExternalInt64Array extends _TypedList
- with _IntListMixin
- implements Int64List {
+
+class _ExternalInt64Array extends _TypedList with _IntListMixin implements Int64List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt64(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt64(index, _toInt64(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Int64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int64List _createList(int length) {
return new Int64List(length);
}
@@ -1687,31 +2177,34 @@ class _ExternalInt64Array extends _TypedList
}
}
-class _ExternalUint64Array extends _TypedList
- with _IntListMixin
- implements Uint64List {
+
+class _ExternalUint64Array extends _TypedList with _IntListMixin implements Uint64List {
// Method(s) implementing the List interface.
- int operator [](int index) {
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedUint64(index);
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedUint64(index, _toUint64(value));
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Uint64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint64List _createList(int length) {
return new Uint64List(length);
}
@@ -1725,31 +2218,34 @@ class _ExternalUint64Array extends _TypedList
}
}
-class _ExternalFloat32Array extends _TypedList
- with _DoubleListMixin
- implements Float32List {
+
+class _ExternalFloat32Array extends _TypedList with _DoubleListMixin implements Float32List {
// Method(s) implementing the List interface.
- double operator [](int index) {
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32(index);
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Float32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32List _createList(int length) {
return new Float32List(length);
}
@@ -1763,31 +2259,34 @@ class _ExternalFloat32Array extends _TypedList
}
}
-class _ExternalFloat64Array extends _TypedList
- with _DoubleListMixin
- implements Float64List {
+
+class _ExternalFloat64Array extends _TypedList with _DoubleListMixin implements Float64List {
// Method(s) implementing the List interface.
- double operator [](int index) {
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64(index);
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Float64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64List _createList(int length) {
return new Float64List(length);
}
@@ -1801,31 +2300,34 @@ class _ExternalFloat64Array extends _TypedList
}
}
-class _ExternalFloat32x4Array extends _TypedList
- with _Float32x4ListMixin
- implements Float32x4List {
+
+class _ExternalFloat32x4Array extends _TypedList with _Float32x4ListMixin implements Float32x4List {
// Method(s) implementing the List interface.
- Float32x4 operator [](int index) {
+ Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat32x4(index);
}
- void operator []=(int index, Float32x4 value) {
+ void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat32x4(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Float32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32x4List _createList(int length) {
return new Float32x4List(length);
}
@@ -1839,31 +2341,34 @@ class _ExternalFloat32x4Array extends _TypedList
}
}
-class _ExternalInt32x4Array extends _TypedList
- with _Int32x4ListMixin
- implements Int32x4List {
+
+class _ExternalInt32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4List {
// Method(s) implementing the List interface.
- Int32x4 operator [](int index) {
+ Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedInt32x4(index);
}
- void operator []=(int index, Int32x4 value) {
+ void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedInt32x4(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Int32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32x4List _createList(int length) {
return new Int32x4List(length);
}
@@ -1877,30 +2382,34 @@ class _ExternalInt32x4Array extends _TypedList
}
}
-class _ExternalFloat64x2Array extends _TypedList
- with _Float64x2ListMixin
- implements Float64x2List {
+
+class _ExternalFloat64x2Array extends _TypedList with _Float64x2ListMixin implements Float64x2List {
// Method(s) implementing the List interface.
- Float64x2 operator [](int index) {
+
+ Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
return _getIndexedFloat64x2(index);
}
- void operator []=(int index, Float64x2 value) {
+ void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_setIndexedFloat64x2(index, value);
}
+
// Method(s) implementing the TypedData interface.
+
int get elementSizeInBytes {
return Float64x2List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64x2List _createList(int length) {
return new Float64x2List(length);
}
@@ -1914,41 +2423,74 @@ class _ExternalFloat64x2Array extends _TypedList
}
}
-@patch
+
class Float32x4 {
- @patch
factory Float32x4(double x, double y, double z, double w)
native "Float32x4_fromDoubles";
-
- @patch
factory Float32x4.splat(double v) native "Float32x4_splat";
-
- @patch
factory Float32x4.zero() native "Float32x4_zero";
-
- @patch
factory Float32x4.fromInt32x4Bits(Int32x4 x)
native "Float32x4_fromInt32x4Bits";
-
- @patch
- factory Float32x4.fromFloat64x2(Float64x2 v) native "Float32x4_fromFloat64x2";
-}
-
-class _Float32x4 implements Float32x4 {
- Float32x4 operator +(Float32x4 other) native "Float32x4_add";
- Float32x4 operator -() native "Float32x4_negate";
- Float32x4 operator -(Float32x4 other) native "Float32x4_sub";
- Float32x4 operator *(Float32x4 other) native "Float32x4_mul";
- Float32x4 operator /(Float32x4 other) native "Float32x4_div";
- Int32x4 lessThan(Float32x4 other) native "Float32x4_cmplt";
- Int32x4 lessThanOrEqual(Float32x4 other) native "Float32x4_cmplte";
- Int32x4 greaterThan(Float32x4 other) native "Float32x4_cmpgt";
- Int32x4 greaterThanOrEqual(Float32x4 other) native "Float32x4_cmpgte";
- Int32x4 equal(Float32x4 other) native "Float32x4_cmpequal";
- Int32x4 notEqual(Float32x4 other) native "Float32x4_cmpnequal";
- Float32x4 scale(double s) native "Float32x4_scale";
- Float32x4 abs() native "Float32x4_abs";
- Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
+ factory Float32x4.fromFloat64x2(Float64x2 v)
+ native "Float32x4_fromFloat64x2";
+ Float32x4 operator +(Float32x4 other) {
+ return _add(other);
+ }
+ Float32x4 _add(Float32x4 other) native "Float32x4_add";
+ Float32x4 operator -() {
+ return _negate();
+ }
+ Float32x4 _negate() native "Float32x4_negate";
+ Float32x4 operator -(Float32x4 other) {
+ return _sub(other);
+ }
+ Float32x4 _sub(Float32x4 other) native "Float32x4_sub";
+ Float32x4 operator *(Float32x4 other) {
+ return _mul(other);
+ }
+ Float32x4 _mul(Float32x4 other) native "Float32x4_mul";
+ Float32x4 operator /(Float32x4 other) {
+ return _div(other);
+ }
+ Float32x4 _div(Float32x4 other) native "Float32x4_div";
+ Int32x4 lessThan(Float32x4 other) {
+ return _cmplt(other);
+ }
+ Int32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt";
+ Int32x4 lessThanOrEqual(Float32x4 other) {
+ return _cmplte(other);
+ }
+ Int32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte";
+ Int32x4 greaterThan(Float32x4 other) {
+ return _cmpgt(other);
+ }
+ Int32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt";
+ Int32x4 greaterThanOrEqual(Float32x4 other) {
+ return _cmpgte(other);
+ }
+ Int32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte";
+ Int32x4 equal(Float32x4 other) {
+ return _cmpequal(other);
+ }
+ Int32x4 _cmpequal(Float32x4 other)
+ native "Float32x4_cmpequal";
+ Int32x4 notEqual(Float32x4 other) {
+ return _cmpnequal(other);
+ }
+ Int32x4 _cmpnequal(Float32x4 other)
+ native "Float32x4_cmpnequal";
+ Float32x4 scale(double s) {
+ return _scale(s);
+ }
+ Float32x4 _scale(double s) native "Float32x4_scale";
+ Float32x4 abs() {
+ return _abs();
+ }
+ Float32x4 _abs() native "Float32x4_abs";
+ Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit) {
+ return _clamp(lowerLimit, upperLimit);
+ }
+ Float32x4 _clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
native "Float32x4_clamp";
double get x native "Float32x4_getX";
double get y native "Float32x4_getY";
@@ -1963,33 +2505,315 @@ class _Float32x4 implements Float32x4 {
Float32x4 withY(double y) native "Float32x4_setY";
Float32x4 withZ(double z) native "Float32x4_setZ";
Float32x4 withW(double w) native "Float32x4_setW";
- Float32x4 min(Float32x4 other) native "Float32x4_min";
- Float32x4 max(Float32x4 other) native "Float32x4_max";
- Float32x4 sqrt() native "Float32x4_sqrt";
- Float32x4 reciprocal() native "Float32x4_reciprocal";
- Float32x4 reciprocalSqrt() native "Float32x4_reciprocalSqrt";
+ Float32x4 min(Float32x4 other) {
+ return _min(other);
+ }
+ Float32x4 _min(Float32x4 other) native "Float32x4_min";
+ Float32x4 max(Float32x4 other) {
+ return _max(other);
+ }
+ Float32x4 _max(Float32x4 other) native "Float32x4_max";
+ Float32x4 sqrt() {
+ return _sqrt();
+ }
+ Float32x4 _sqrt() native "Float32x4_sqrt";
+ Float32x4 reciprocal() {
+ return _reciprocal();
+ }
+ Float32x4 _reciprocal() native "Float32x4_reciprocal";
+ Float32x4 reciprocalSqrt() {
+ return _reciprocalSqrt();
+ }
+ Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt";
+
+ /// Mask passed to [shuffle] or [shuffleMix].
+ static const int XXXX = 0x0;
+ static const int XXXY = 0x40;
+ static const int XXXZ = 0x80;
+ static const int XXXW = 0xC0;
+ static const int XXYX = 0x10;
+ static const int XXYY = 0x50;
+ static const int XXYZ = 0x90;
+ static const int XXYW = 0xD0;
+ static const int XXZX = 0x20;
+ static const int XXZY = 0x60;
+ static const int XXZZ = 0xA0;
+ static const int XXZW = 0xE0;
+ static const int XXWX = 0x30;
+ static const int XXWY = 0x70;
+ static const int XXWZ = 0xB0;
+ static const int XXWW = 0xF0;
+ static const int XYXX = 0x4;
+ static const int XYXY = 0x44;
+ static const int XYXZ = 0x84;
+ static const int XYXW = 0xC4;
+ static const int XYYX = 0x14;
+ static const int XYYY = 0x54;
+ static const int XYYZ = 0x94;
+ static const int XYYW = 0xD4;
+ static const int XYZX = 0x24;
+ static const int XYZY = 0x64;
+ static const int XYZZ = 0xA4;
+ static const int XYZW = 0xE4;
+ static const int XYWX = 0x34;
+ static const int XYWY = 0x74;
+ static const int XYWZ = 0xB4;
+ static const int XYWW = 0xF4;
+ static const int XZXX = 0x8;
+ static const int XZXY = 0x48;
+ static const int XZXZ = 0x88;
+ static const int XZXW = 0xC8;
+ static const int XZYX = 0x18;
+ static const int XZYY = 0x58;
+ static const int XZYZ = 0x98;
+ static const int XZYW = 0xD8;
+ static const int XZZX = 0x28;
+ static const int XZZY = 0x68;
+ static const int XZZZ = 0xA8;
+ static const int XZZW = 0xE8;
+ static const int XZWX = 0x38;
+ static const int XZWY = 0x78;
+ static const int XZWZ = 0xB8;
+ static const int XZWW = 0xF8;
+ static const int XWXX = 0xC;
+ static const int XWXY = 0x4C;
+ static const int XWXZ = 0x8C;
+ static const int XWXW = 0xCC;
+ static const int XWYX = 0x1C;
+ static const int XWYY = 0x5C;
+ static const int XWYZ = 0x9C;
+ static const int XWYW = 0xDC;
+ static const int XWZX = 0x2C;
+ static const int XWZY = 0x6C;
+ static const int XWZZ = 0xAC;
+ static const int XWZW = 0xEC;
+ static const int XWWX = 0x3C;
+ static const int XWWY = 0x7C;
+ static const int XWWZ = 0xBC;
+ static const int XWWW = 0xFC;
+ static const int YXXX = 0x1;
+ static const int YXXY = 0x41;
+ static const int YXXZ = 0x81;
+ static const int YXXW = 0xC1;
+ static const int YXYX = 0x11;
+ static const int YXYY = 0x51;
+ static const int YXYZ = 0x91;
+ static const int YXYW = 0xD1;
+ static const int YXZX = 0x21;
+ static const int YXZY = 0x61;
+ static const int YXZZ = 0xA1;
+ static const int YXZW = 0xE1;
+ static const int YXWX = 0x31;
+ static const int YXWY = 0x71;
+ static const int YXWZ = 0xB1;
+ static const int YXWW = 0xF1;
+ static const int YYXX = 0x5;
+ static const int YYXY = 0x45;
+ static const int YYXZ = 0x85;
+ static const int YYXW = 0xC5;
+ static const int YYYX = 0x15;
+ static const int YYYY = 0x55;
+ static const int YYYZ = 0x95;
+ static const int YYYW = 0xD5;
+ static const int YYZX = 0x25;
+ static const int YYZY = 0x65;
+ static const int YYZZ = 0xA5;
+ static const int YYZW = 0xE5;
+ static const int YYWX = 0x35;
+ static const int YYWY = 0x75;
+ static const int YYWZ = 0xB5;
+ static const int YYWW = 0xF5;
+ static const int YZXX = 0x9;
+ static const int YZXY = 0x49;
+ static const int YZXZ = 0x89;
+ static const int YZXW = 0xC9;
+ static const int YZYX = 0x19;
+ static const int YZYY = 0x59;
+ static const int YZYZ = 0x99;
+ static const int YZYW = 0xD9;
+ static const int YZZX = 0x29;
+ static const int YZZY = 0x69;
+ static const int YZZZ = 0xA9;
+ static const int YZZW = 0xE9;
+ static const int YZWX = 0x39;
+ static const int YZWY = 0x79;
+ static const int YZWZ = 0xB9;
+ static const int YZWW = 0xF9;
+ static const int YWXX = 0xD;
+ static const int YWXY = 0x4D;
+ static const int YWXZ = 0x8D;
+ static const int YWXW = 0xCD;
+ static const int YWYX = 0x1D;
+ static const int YWYY = 0x5D;
+ static const int YWYZ = 0x9D;
+ static const int YWYW = 0xDD;
+ static const int YWZX = 0x2D;
+ static const int YWZY = 0x6D;
+ static const int YWZZ = 0xAD;
+ static const int YWZW = 0xED;
+ static const int YWWX = 0x3D;
+ static const int YWWY = 0x7D;
+ static const int YWWZ = 0xBD;
+ static const int YWWW = 0xFD;
+ static const int ZXXX = 0x2;
+ static const int ZXXY = 0x42;
+ static const int ZXXZ = 0x82;
+ static const int ZXXW = 0xC2;
+ static const int ZXYX = 0x12;
+ static const int ZXYY = 0x52;
+ static const int ZXYZ = 0x92;
+ static const int ZXYW = 0xD2;
+ static const int ZXZX = 0x22;
+ static const int ZXZY = 0x62;
+ static const int ZXZZ = 0xA2;
+ static const int ZXZW = 0xE2;
+ static const int ZXWX = 0x32;
+ static const int ZXWY = 0x72;
+ static const int ZXWZ = 0xB2;
+ static const int ZXWW = 0xF2;
+ static const int ZYXX = 0x6;
+ static const int ZYXY = 0x46;
+ static const int ZYXZ = 0x86;
+ static const int ZYXW = 0xC6;
+ static const int ZYYX = 0x16;
+ static const int ZYYY = 0x56;
+ static const int ZYYZ = 0x96;
+ static const int ZYYW = 0xD6;
+ static const int ZYZX = 0x26;
+ static const int ZYZY = 0x66;
+ static const int ZYZZ = 0xA6;
+ static const int ZYZW = 0xE6;
+ static const int ZYWX = 0x36;
+ static const int ZYWY = 0x76;
+ static const int ZYWZ = 0xB6;
+ static const int ZYWW = 0xF6;
+ static const int ZZXX = 0xA;
+ static const int ZZXY = 0x4A;
+ static const int ZZXZ = 0x8A;
+ static const int ZZXW = 0xCA;
+ static const int ZZYX = 0x1A;
+ static const int ZZYY = 0x5A;
+ static const int ZZYZ = 0x9A;
+ static const int ZZYW = 0xDA;
+ static const int ZZZX = 0x2A;
+ static const int ZZZY = 0x6A;
+ static const int ZZZZ = 0xAA;
+ static const int ZZZW = 0xEA;
+ static const int ZZWX = 0x3A;
+ static const int ZZWY = 0x7A;
+ static const int ZZWZ = 0xBA;
+ static const int ZZWW = 0xFA;
+ static const int ZWXX = 0xE;
+ static const int ZWXY = 0x4E;
+ static const int ZWXZ = 0x8E;
+ static const int ZWXW = 0xCE;
+ static const int ZWYX = 0x1E;
+ static const int ZWYY = 0x5E;
+ static const int ZWYZ = 0x9E;
+ static const int ZWYW = 0xDE;
+ static const int ZWZX = 0x2E;
+ static const int ZWZY = 0x6E;
+ static const int ZWZZ = 0xAE;
+ static const int ZWZW = 0xEE;
+ static const int ZWWX = 0x3E;
+ static const int ZWWY = 0x7E;
+ static const int ZWWZ = 0xBE;
+ static const int ZWWW = 0xFE;
+ static const int WXXX = 0x3;
+ static const int WXXY = 0x43;
+ static const int WXXZ = 0x83;
+ static const int WXXW = 0xC3;
+ static const int WXYX = 0x13;
+ static const int WXYY = 0x53;
+ static const int WXYZ = 0x93;
+ static const int WXYW = 0xD3;
+ static const int WXZX = 0x23;
+ static const int WXZY = 0x63;
+ static const int WXZZ = 0xA3;
+ static const int WXZW = 0xE3;
+ static const int WXWX = 0x33;
+ static const int WXWY = 0x73;
+ static const int WXWZ = 0xB3;
+ static const int WXWW = 0xF3;
+ static const int WYXX = 0x7;
+ static const int WYXY = 0x47;
+ static const int WYXZ = 0x87;
+ static const int WYXW = 0xC7;
+ static const int WYYX = 0x17;
+ static const int WYYY = 0x57;
+ static const int WYYZ = 0x97;
+ static const int WYYW = 0xD7;
+ static const int WYZX = 0x27;
+ static const int WYZY = 0x67;
+ static const int WYZZ = 0xA7;
+ static const int WYZW = 0xE7;
+ static const int WYWX = 0x37;
+ static const int WYWY = 0x77;
+ static const int WYWZ = 0xB7;
+ static const int WYWW = 0xF7;
+ static const int WZXX = 0xB;
+ static const int WZXY = 0x4B;
+ static const int WZXZ = 0x8B;
+ static const int WZXW = 0xCB;
+ static const int WZYX = 0x1B;
+ static const int WZYY = 0x5B;
+ static const int WZYZ = 0x9B;
+ static const int WZYW = 0xDB;
+ static const int WZZX = 0x2B;
+ static const int WZZY = 0x6B;
+ static const int WZZZ = 0xAB;
+ static const int WZZW = 0xEB;
+ static const int WZWX = 0x3B;
+ static const int WZWY = 0x7B;
+ static const int WZWZ = 0xBB;
+ static const int WZWW = 0xFB;
+ static const int WWXX = 0xF;
+ static const int WWXY = 0x4F;
+ static const int WWXZ = 0x8F;
+ static const int WWXW = 0xCF;
+ static const int WWYX = 0x1F;
+ static const int WWYY = 0x5F;
+ static const int WWYZ = 0x9F;
+ static const int WWYW = 0xDF;
+ static const int WWZX = 0x2F;
+ static const int WWZY = 0x6F;
+ static const int WWZZ = 0xAF;
+ static const int WWZW = 0xEF;
+ static const int WWWX = 0x3F;
+ static const int WWWY = 0x7F;
+ static const int WWWZ = 0xBF;
+ static const int WWWW = 0xFF;
+
}
-@patch
-class Int32x4 {
- @patch
- factory Int32x4(int x, int y, int z, int w) native "Int32x4_fromInts";
- @patch
+class Int32x4 {
+ factory Int32x4(int x, int y, int z, int w)
+ native "Int32x4_fromInts";
factory Int32x4.bool(bool x, bool y, bool z, bool w)
native "Int32x4_fromBools";
-
- @patch
factory Int32x4.fromFloat32x4Bits(Float32x4 x)
native "Int32x4_fromFloat32x4Bits";
-}
-
-class _Int32x4 implements Int32x4 {
- Int32x4 operator |(Int32x4 other) native "Int32x4_or";
- Int32x4 operator &(Int32x4 other) native "Int32x4_and";
- Int32x4 operator ^(Int32x4 other) native "Int32x4_xor";
- Int32x4 operator +(Int32x4 other) native "Int32x4_add";
- Int32x4 operator -(Int32x4 other) native "Int32x4_sub";
+ Int32x4 operator |(Int32x4 other) {
+ return _or(other);
+ }
+ Int32x4 _or(Int32x4 other) native "Int32x4_or";
+ Int32x4 operator &(Int32x4 other) {
+ return _and(other);
+ }
+ Int32x4 _and(Int32x4 other) native "Int32x4_and";
+ Int32x4 operator ^(Int32x4 other) {
+ return _xor(other);
+ }
+ Int32x4 _xor(Int32x4 other) native "Int32x4_xor";
+ Int32x4 operator +(Int32x4 other) {
+ return _add(other);
+ }
+ Int32x4 _add(Int32x4 other) native "Int32x4_add";
+ Int32x4 operator -(Int32x4 other) {
+ return _sub(other);
+ }
+ Int32x4 _sub(Int32x4 other) native "Int32x4_sub";
int get x native "Int32x4_getX";
int get y native "Int32x4_getY";
int get z native "Int32x4_getZ";
@@ -2009,45 +2833,335 @@ class _Int32x4 implements Int32x4 {
Int32x4 withFlagY(bool y) native "Int32x4_setFlagY";
Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ";
Int32x4 withFlagW(bool w) native "Int32x4_setFlagW";
- Float32x4 select(Float32x4 trueValue, Float32x4 falseValue)
+ Float32x4 select(Float32x4 trueValue, Float32x4 falseValue) {
+ return _select(trueValue, falseValue);
+ }
+ Float32x4 _select(Float32x4 trueValue, Float32x4 falseValue)
native "Int32x4_select";
+
+ /// Mask passed to [shuffle] or [shuffleMix].
+ static const int XXXX = 0x0;
+ static const int XXXY = 0x40;
+ static const int XXXZ = 0x80;
+ static const int XXXW = 0xC0;
+ static const int XXYX = 0x10;
+ static const int XXYY = 0x50;
+ static const int XXYZ = 0x90;
+ static const int XXYW = 0xD0;
+ static const int XXZX = 0x20;
+ static const int XXZY = 0x60;
+ static const int XXZZ = 0xA0;
+ static const int XXZW = 0xE0;
+ static const int XXWX = 0x30;
+ static const int XXWY = 0x70;
+ static const int XXWZ = 0xB0;
+ static const int XXWW = 0xF0;
+ static const int XYXX = 0x4;
+ static const int XYXY = 0x44;
+ static const int XYXZ = 0x84;
+ static const int XYXW = 0xC4;
+ static const int XYYX = 0x14;
+ static const int XYYY = 0x54;
+ static const int XYYZ = 0x94;
+ static const int XYYW = 0xD4;
+ static const int XYZX = 0x24;
+ static const int XYZY = 0x64;
+ static const int XYZZ = 0xA4;
+ static const int XYZW = 0xE4;
+ static const int XYWX = 0x34;
+ static const int XYWY = 0x74;
+ static const int XYWZ = 0xB4;
+ static const int XYWW = 0xF4;
+ static const int XZXX = 0x8;
+ static const int XZXY = 0x48;
+ static const int XZXZ = 0x88;
+ static const int XZXW = 0xC8;
+ static const int XZYX = 0x18;
+ static const int XZYY = 0x58;
+ static const int XZYZ = 0x98;
+ static const int XZYW = 0xD8;
+ static const int XZZX = 0x28;
+ static const int XZZY = 0x68;
+ static const int XZZZ = 0xA8;
+ static const int XZZW = 0xE8;
+ static const int XZWX = 0x38;
+ static const int XZWY = 0x78;
+ static const int XZWZ = 0xB8;
+ static const int XZWW = 0xF8;
+ static const int XWXX = 0xC;
+ static const int XWXY = 0x4C;
+ static const int XWXZ = 0x8C;
+ static const int XWXW = 0xCC;
+ static const int XWYX = 0x1C;
+ static const int XWYY = 0x5C;
+ static const int XWYZ = 0x9C;
+ static const int XWYW = 0xDC;
+ static const int XWZX = 0x2C;
+ static const int XWZY = 0x6C;
+ static const int XWZZ = 0xAC;
+ static const int XWZW = 0xEC;
+ static const int XWWX = 0x3C;
+ static const int XWWY = 0x7C;
+ static const int XWWZ = 0xBC;
+ static const int XWWW = 0xFC;
+ static const int YXXX = 0x1;
+ static const int YXXY = 0x41;
+ static const int YXXZ = 0x81;
+ static const int YXXW = 0xC1;
+ static const int YXYX = 0x11;
+ static const int YXYY = 0x51;
+ static const int YXYZ = 0x91;
+ static const int YXYW = 0xD1;
+ static const int YXZX = 0x21;
+ static const int YXZY = 0x61;
+ static const int YXZZ = 0xA1;
+ static const int YXZW = 0xE1;
+ static const int YXWX = 0x31;
+ static const int YXWY = 0x71;
+ static const int YXWZ = 0xB1;
+ static const int YXWW = 0xF1;
+ static const int YYXX = 0x5;
+ static const int YYXY = 0x45;
+ static const int YYXZ = 0x85;
+ static const int YYXW = 0xC5;
+ static const int YYYX = 0x15;
+ static const int YYYY = 0x55;
+ static const int YYYZ = 0x95;
+ static const int YYYW = 0xD5;
+ static const int YYZX = 0x25;
+ static const int YYZY = 0x65;
+ static const int YYZZ = 0xA5;
+ static const int YYZW = 0xE5;
+ static const int YYWX = 0x35;
+ static const int YYWY = 0x75;
+ static const int YYWZ = 0xB5;
+ static const int YYWW = 0xF5;
+ static const int YZXX = 0x9;
+ static const int YZXY = 0x49;
+ static const int YZXZ = 0x89;
+ static const int YZXW = 0xC9;
+ static const int YZYX = 0x19;
+ static const int YZYY = 0x59;
+ static const int YZYZ = 0x99;
+ static const int YZYW = 0xD9;
+ static const int YZZX = 0x29;
+ static const int YZZY = 0x69;
+ static const int YZZZ = 0xA9;
+ static const int YZZW = 0xE9;
+ static const int YZWX = 0x39;
+ static const int YZWY = 0x79;
+ static const int YZWZ = 0xB9;
+ static const int YZWW = 0xF9;
+ static const int YWXX = 0xD;
+ static const int YWXY = 0x4D;
+ static const int YWXZ = 0x8D;
+ static const int YWXW = 0xCD;
+ static const int YWYX = 0x1D;
+ static const int YWYY = 0x5D;
+ static const int YWYZ = 0x9D;
+ static const int YWYW = 0xDD;
+ static const int YWZX = 0x2D;
+ static const int YWZY = 0x6D;
+ static const int YWZZ = 0xAD;
+ static const int YWZW = 0xED;
+ static const int YWWX = 0x3D;
+ static const int YWWY = 0x7D;
+ static const int YWWZ = 0xBD;
+ static const int YWWW = 0xFD;
+ static const int ZXXX = 0x2;
+ static const int ZXXY = 0x42;
+ static const int ZXXZ = 0x82;
+ static const int ZXXW = 0xC2;
+ static const int ZXYX = 0x12;
+ static const int ZXYY = 0x52;
+ static const int ZXYZ = 0x92;
+ static const int ZXYW = 0xD2;
+ static const int ZXZX = 0x22;
+ static const int ZXZY = 0x62;
+ static const int ZXZZ = 0xA2;
+ static const int ZXZW = 0xE2;
+ static const int ZXWX = 0x32;
+ static const int ZXWY = 0x72;
+ static const int ZXWZ = 0xB2;
+ static const int ZXWW = 0xF2;
+ static const int ZYXX = 0x6;
+ static const int ZYXY = 0x46;
+ static const int ZYXZ = 0x86;
+ static const int ZYXW = 0xC6;
+ static const int ZYYX = 0x16;
+ static const int ZYYY = 0x56;
+ static const int ZYYZ = 0x96;
+ static const int ZYYW = 0xD6;
+ static const int ZYZX = 0x26;
+ static const int ZYZY = 0x66;
+ static const int ZYZZ = 0xA6;
+ static const int ZYZW = 0xE6;
+ static const int ZYWX = 0x36;
+ static const int ZYWY = 0x76;
+ static const int ZYWZ = 0xB6;
+ static const int ZYWW = 0xF6;
+ static const int ZZXX = 0xA;
+ static const int ZZXY = 0x4A;
+ static const int ZZXZ = 0x8A;
+ static const int ZZXW = 0xCA;
+ static const int ZZYX = 0x1A;
+ static const int ZZYY = 0x5A;
+ static const int ZZYZ = 0x9A;
+ static const int ZZYW = 0xDA;
+ static const int ZZZX = 0x2A;
+ static const int ZZZY = 0x6A;
+ static const int ZZZZ = 0xAA;
+ static const int ZZZW = 0xEA;
+ static const int ZZWX = 0x3A;
+ static const int ZZWY = 0x7A;
+ static const int ZZWZ = 0xBA;
+ static const int ZZWW = 0xFA;
+ static const int ZWXX = 0xE;
+ static const int ZWXY = 0x4E;
+ static const int ZWXZ = 0x8E;
+ static const int ZWXW = 0xCE;
+ static const int ZWYX = 0x1E;
+ static const int ZWYY = 0x5E;
+ static const int ZWYZ = 0x9E;
+ static const int ZWYW = 0xDE;
+ static const int ZWZX = 0x2E;
+ static const int ZWZY = 0x6E;
+ static const int ZWZZ = 0xAE;
+ static const int ZWZW = 0xEE;
+ static const int ZWWX = 0x3E;
+ static const int ZWWY = 0x7E;
+ static const int ZWWZ = 0xBE;
+ static const int ZWWW = 0xFE;
+ static const int WXXX = 0x3;
+ static const int WXXY = 0x43;
+ static const int WXXZ = 0x83;
+ static const int WXXW = 0xC3;
+ static const int WXYX = 0x13;
+ static const int WXYY = 0x53;
+ static const int WXYZ = 0x93;
+ static const int WXYW = 0xD3;
+ static const int WXZX = 0x23;
+ static const int WXZY = 0x63;
+ static const int WXZZ = 0xA3;
+ static const int WXZW = 0xE3;
+ static const int WXWX = 0x33;
+ static const int WXWY = 0x73;
+ static const int WXWZ = 0xB3;
+ static const int WXWW = 0xF3;
+ static const int WYXX = 0x7;
+ static const int WYXY = 0x47;
+ static const int WYXZ = 0x87;
+ static const int WYXW = 0xC7;
+ static const int WYYX = 0x17;
+ static const int WYYY = 0x57;
+ static const int WYYZ = 0x97;
+ static const int WYYW = 0xD7;
+ static const int WYZX = 0x27;
+ static const int WYZY = 0x67;
+ static const int WYZZ = 0xA7;
+ static const int WYZW = 0xE7;
+ static const int WYWX = 0x37;
+ static const int WYWY = 0x77;
+ static const int WYWZ = 0xB7;
+ static const int WYWW = 0xF7;
+ static const int WZXX = 0xB;
+ static const int WZXY = 0x4B;
+ static const int WZXZ = 0x8B;
+ static const int WZXW = 0xCB;
+ static const int WZYX = 0x1B;
+ static const int WZYY = 0x5B;
+ static const int WZYZ = 0x9B;
+ static const int WZYW = 0xDB;
+ static const int WZZX = 0x2B;
+ static const int WZZY = 0x6B;
+ static const int WZZZ = 0xAB;
+ static const int WZZW = 0xEB;
+ static const int WZWX = 0x3B;
+ static const int WZWY = 0x7B;
+ static const int WZWZ = 0xBB;
+ static const int WZWW = 0xFB;
+ static const int WWXX = 0xF;
+ static const int WWXY = 0x4F;
+ static const int WWXZ = 0x8F;
+ static const int WWXW = 0xCF;
+ static const int WWYX = 0x1F;
+ static const int WWYY = 0x5F;
+ static const int WWYZ = 0x9F;
+ static const int WWYW = 0xDF;
+ static const int WWZX = 0x2F;
+ static const int WWZY = 0x6F;
+ static const int WWZZ = 0xAF;
+ static const int WWZW = 0xEF;
+ static const int WWWX = 0x3F;
+ static const int WWWY = 0x7F;
+ static const int WWWZ = 0xBF;
+ static const int WWWW = 0xFF;
+
}
-@patch
+
class Float64x2 {
- @patch
factory Float64x2(double x, double y) native "Float64x2_fromDoubles";
-
- @patch
factory Float64x2.splat(double v) native "Float64x2_splat";
-
- @patch
factory Float64x2.zero() native "Float64x2_zero";
-
- @patch
factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4";
-}
-class _Float64x2 implements Float64x2 {
- Float64x2 operator +(Float64x2 other) native "Float64x2_add";
- Float64x2 operator -() native "Float64x2_negate";
- Float64x2 operator -(Float64x2 other) native "Float64x2_sub";
- Float64x2 operator *(Float64x2 other) native "Float64x2_mul";
- Float64x2 operator /(Float64x2 other) native "Float64x2_div";
+ Float64x2 operator +(Float64x2 other) {
+ return _add(other);
+ }
+ Float64x2 _add(Float64x2 other) native "Float64x2_add";
+ Float64x2 operator -() {
+ return _negate();
+ }
+ Float64x2 _negate() native "Float64x2_negate";
+ Float64x2 operator -(Float64x2 other) {
+ return _sub(other);
+ }
+ Float64x2 _sub(Float64x2 other) native "Float64x2_sub";
+ Float64x2 operator *(Float64x2 other) {
+ return _mul(other);
+ }
+ Float64x2 _mul(Float64x2 other) native "Float64x2_mul";
+ Float64x2 operator /(Float64x2 other) {
+ return _div(other);
+ }
+ Float64x2 _div(Float64x2 other) native "Float64x2_div";
+
+
+ /// Returns a copy of [this] each lane being scaled by [s].
Float64x2 scale(double s) native "Float64x2_scale";
+ /// Returns the absolute value of this [Float64x2].
Float64x2 abs() native "Float64x2_abs";
- Float64x2 clamp(Float64x2 lowerLimit, Float64x2 upperLimit)
- native "Float64x2_clamp";
+
+ /// Clamps [this] to be in the range [lowerLimit]-[upperLimit].
+ Float64x2 clamp(Float64x2 lowerLimit,
+ Float64x2 upperLimit) native "Float64x2_clamp";
+
+ /// Extracted x value.
double get x native "Float64x2_getX";
+ /// Extracted y value.
double get y native "Float64x2_getY";
+
+ /// Extract the sign bits from each lane return them in the first 2 bits.
int get signMask native "Float64x2_getSignMask";
+
+ /// Returns a new [Float64x2] copied from [this] with a new x value.
Float64x2 withX(double x) native "Float64x2_setX";
+ /// Returns a new [Float64x2] copied from [this] with a new y value.
Float64x2 withY(double y) native "Float64x2_setY";
+
+ /// Returns the lane-wise minimum value in [this] or [other].
Float64x2 min(Float64x2 other) native "Float64x2_min";
+
+ /// Returns the lane-wise maximum value in [this] or [other].
Float64x2 max(Float64x2 other) native "Float64x2_max";
+
+ /// Returns the lane-wise square root of [this].
Float64x2 sqrt() native "Float64x2_sqrt";
}
+
+
class _TypedListIterator implements Iterator {
final List _array;
final int _length;
@@ -2055,9 +3169,7 @@ class _TypedListIterator implements Iterator {
E _current;
_TypedListIterator(List array)
- : _array = array,
- _length = array.length,
- _position = -1 {
+ : _array = array, _length = array.length, _position = -1 {
assert(array is _TypedList || array is _TypedListView);
}
@@ -2076,11 +3188,13 @@ class _TypedListIterator implements Iterator {
E get current => _current;
}
+
class _TypedListView extends _TypedListBase implements TypedData {
- _TypedListView(_ByteBuffer _buffer, int _offset, int _length)
- : _typedData = _buffer._data,
- offsetInBytes = _offset,
- length = _length {}
+ _TypedListView(ByteBuffer _buffer, int _offset, int _length)
+ : _typedData = _buffer._data,
+ offsetInBytes = _offset,
+ length = _length {
+ }
// Method(s) implementing the TypedData interface.
@@ -2088,7 +3202,7 @@ class _TypedListView extends _TypedListBase implements TypedData {
return length * elementSizeInBytes;
}
- _ByteBuffer get buffer {
+ ByteBuffer get buffer {
return _typedData.buffer;
}
@@ -2097,171 +3211,179 @@ class _TypedListView extends _TypedListBase implements TypedData {
final int length;
}
-class _Int8ArrayView extends _TypedListView
- with _IntListMixin
- implements Int8List {
+
+class _Int8ArrayView extends _TypedListView with _IntListMixin implements Int8List {
// Constructor.
- _Int8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Int8List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
- length * Int8List.BYTES_PER_ELEMENT);
+ _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Int8List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ _offsetInBytes,
+ length * Int8List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT));
+ return _typedData._getInt8(offsetInBytes +
+ (index * Int8List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setInt8(
- offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), _toInt8(value));
+ _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
+ _toInt8(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Int8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int8List _createList(int length) {
return new Int8List(length);
}
}
-class _Uint8ArrayView extends _TypedListView
- with _IntListMixin
- implements Uint8List {
+
+class _Uint8ArrayView extends _TypedListView with _IntListMixin implements Uint8List {
// Constructor.
- _Uint8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Uint8List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
- length * Uint8List.BYTES_PER_ELEMENT);
+ _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Uint8List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ _offsetInBytes,
+ length * Uint8List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
+ return _typedData._getUint8(offsetInBytes +
+ (index * Uint8List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setUint8(
- offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), _toUint8(value));
+ _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
+ _toUint8(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint8List _createList(int length) {
return new Uint8List(length);
}
}
-class _Uint8ClampedArrayView extends _TypedListView
- with _IntListMixin
- implements Uint8ClampedList {
+
+class _Uint8ClampedArrayView extends _TypedListView with _IntListMixin implements Uint8ClampedList {
// Constructor.
- _Uint8ClampedArrayView(_ByteBuffer buffer,
- [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Uint8List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Uint8List.BYTES_PER_ELEMENT);
+ _Uint8ClampedArrayView(ByteBuffer buffer,
+ [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Uint8List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Uint8List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
+ return _typedData._getUint8(offsetInBytes +
+ (index * Uint8List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
_typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
- _toClampedUint8(value));
+ _toClampedUint8(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Uint8List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint8ClampedList _createList(int length) {
return new Uint8ClampedList(length);
}
}
-class _Int16ArrayView extends _TypedListView
- with _IntListMixin
- implements Int16List {
+
+class _Int16ArrayView extends _TypedListView with _IntListMixin implements Int16List {
// Constructor.
- _Int16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Int16List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Int16List.BYTES_PER_ELEMENT);
+ _Int16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Int16List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Int16List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT));
+ return _typedData._getInt16(offsetInBytes +
+ (index * Int16List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setInt16(
- offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), _toInt16(value));
+ _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT),
+ _toInt16(value));
}
void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
@@ -2281,45 +3403,45 @@ class _Int16ArrayView extends _TypedListView
return Int16List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int16List _createList(int length) {
return new Int16List(length);
}
}
-class _Uint16ArrayView extends _TypedListView
- with _IntListMixin
- implements Uint16List {
+
+class _Uint16ArrayView extends _TypedListView with _IntListMixin implements Uint16List {
// Constructor.
- _Uint16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Uint16List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Uint16List.BYTES_PER_ELEMENT);
+ _Uint16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Uint16List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Uint16List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT));
+ return _typedData._getUint16(offsetInBytes +
+ (index * Uint16List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setUint16(
- offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
- _toUint16(value));
+ _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
+ _toUint16(value));
}
void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
@@ -2346,423 +3468,451 @@ class _Uint16ArrayView extends _TypedListView
}
}
-class _Int32ArrayView extends _TypedListView
- with _IntListMixin
- implements Int32List {
+
+class _Int32ArrayView extends _TypedListView with _IntListMixin implements Int32List {
// Constructor.
- _Int32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Int32List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Int32List.BYTES_PER_ELEMENT);
+ _Int32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Int32List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Int32List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT));
+ return _typedData._getInt32(offsetInBytes +
+ (index * Int32List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setInt32(
- offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), _toInt32(value));
+ _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT),
+ _toInt32(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Int32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32List _createList(int length) {
return new Int32List(length);
}
}
-class _Uint32ArrayView extends _TypedListView
- with _IntListMixin
- implements Uint32List {
+
+class _Uint32ArrayView extends _TypedListView with _IntListMixin implements Uint32List {
// Constructor.
- _Uint32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Uint32List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Uint32List.BYTES_PER_ELEMENT);
+ _Uint32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Uint32List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Uint32List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT));
+ return _typedData._getUint32(offsetInBytes +
+ (index * Uint32List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setUint32(
- offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
- _toUint32(value));
+ _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
+ _toUint32(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Uint32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint32List _createList(int length) {
return new Uint32List(length);
}
}
-class _Int64ArrayView extends _TypedListView
- with _IntListMixin
- implements Int64List {
+
+class _Int64ArrayView extends _TypedListView with _IntListMixin implements Int64List {
// Constructor.
- _Int64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Int64List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Int64List.BYTES_PER_ELEMENT);
+ _Int64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Int64List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Int64List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT));
+ return _typedData._getInt64(offsetInBytes +
+ (index * Int64List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setInt64(
- offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), _toInt64(value));
+ _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT),
+ _toInt64(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Int64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int64List _createList(int length) {
return new Int64List(length);
}
}
-class _Uint64ArrayView extends _TypedListView
- with _IntListMixin
- implements Uint64List {
+
+class _Uint64ArrayView extends _TypedListView with _IntListMixin implements Uint64List {
// Constructor.
- _Uint64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Uint64List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Uint64List.BYTES_PER_ELEMENT);
+ _Uint64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Uint64List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Uint64List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- int operator [](int index) {
+
+ int operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT));
+ return _typedData._getUint64(offsetInBytes +
+ (index * Uint64List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, int value) {
+ void operator[]=(int index, int value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setUint64(
- offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
- _toUint64(value));
+ _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
+ _toUint64(value));
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Uint64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Uint64List _createList(int length) {
return new Uint64List(length);
}
}
-class _Float32ArrayView extends _TypedListView
- with _DoubleListMixin
- implements Float32List {
+
+class _Float32ArrayView extends _TypedListView with _DoubleListMixin implements Float32List {
// Constructor.
- _Float32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Float32List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Float32List.BYTES_PER_ELEMENT);
+ _Float32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Float32List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Float32List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- double operator [](int index) {
+
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getFloat32(offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT));
+ return _typedData._getFloat32(offsetInBytes +
+ (index * Float32List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setFloat32(
- offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT), value);
+ _typedData._setFloat32(offsetInBytes +
+ (index * Float32List.BYTES_PER_ELEMENT), value);
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Float32List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32List _createList(int length) {
return new Float32List(length);
}
}
-class _Float64ArrayView extends _TypedListView
- with _DoubleListMixin
- implements Float64List {
+
+class _Float64ArrayView extends _TypedListView with _DoubleListMixin implements Float64List {
// Constructor.
- _Float64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Float64List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Float64List.BYTES_PER_ELEMENT);
+ _Float64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Float64List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Float64List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- double operator [](int index) {
+
+ double operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getFloat64(offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT));
+ return _typedData._getFloat64(offsetInBytes +
+ (index * Float64List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, double value) {
+ void operator[]=(int index, double value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setFloat64(
- offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT), value);
+ _typedData._setFloat64(offsetInBytes +
+ (index * Float64List.BYTES_PER_ELEMENT), value);
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Float64List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64List _createList(int length) {
return new Float64List(length);
}
}
-class _Float32x4ArrayView extends _TypedListView
- with _Float32x4ListMixin
- implements Float32x4List {
+
+class _Float32x4ArrayView extends _TypedListView with _Float32x4ListMixin implements Float32x4List {
// Constructor.
- _Float32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Float32x4List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Float32x4List.BYTES_PER_ELEMENT);
+ _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Float32x4List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Float32x4List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- Float32x4 operator [](int index) {
+
+ Float32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData._getFloat32x4(
- offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT));
+ return _typedData._getFloat32x4(offsetInBytes +
+ (index * Float32x4List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, Float32x4 value) {
+ void operator[]=(int index, Float32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setFloat32x4(
- offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT), value);
+ _typedData._setFloat32x4(offsetInBytes +
+ (index * Float32x4List.BYTES_PER_ELEMENT), value);
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Float32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float32x4List _createList(int length) {
return new Float32x4List(length);
}
}
-class _Int32x4ArrayView extends _TypedListView
- with _Int32x4ListMixin
- implements Int32x4List {
+
+class _Int32x4ArrayView extends _TypedListView with _Int32x4ListMixin implements Int32x4List {
// Constructor.
- _Int32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Int32x4List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Int32x4List.BYTES_PER_ELEMENT);
+ _Int32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Int32x4List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Int32x4List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- Int32x4 operator [](int index) {
+
+ Int32x4 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData
- ._getInt32x4(offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT));
+ return _typedData._getInt32x4(offsetInBytes +
+ (index * Int32x4List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, Int32x4 value) {
+ void operator[]=(int index, Int32x4 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setInt32x4(
- offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT), value);
+ _typedData._setInt32x4(offsetInBytes +
+ (index * Int32x4List.BYTES_PER_ELEMENT), value);
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Int32x4List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Int32x4List _createList(int length) {
return new Int32x4List(length);
}
}
-class _Float64x2ArrayView extends _TypedListView
- with _Float64x2ListMixin
- implements Float64x2List {
+
+class _Float64x2ArrayView extends _TypedListView with _Float64x2ListMixin implements Float64x2List {
// Constructor.
- _Float64x2ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
- : super(
- buffer,
- _offsetInBytes,
- _defaultIfNull(
- _length,
- ((buffer.lengthInBytes - _offsetInBytes) ~/
- Float64x2List.BYTES_PER_ELEMENT))) {
- _rangeCheck(buffer.lengthInBytes, offsetInBytes,
- length * Float64x2List.BYTES_PER_ELEMENT);
+ _Float64x2ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+ : super(buffer, _offsetInBytes,
+ _defaultIfNull(_length,
+ ((buffer.lengthInBytes - _offsetInBytes) ~/
+ Float64x2List.BYTES_PER_ELEMENT))) {
+ _rangeCheck(buffer.lengthInBytes,
+ offsetInBytes,
+ length * Float64x2List.BYTES_PER_ELEMENT);
_offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT);
}
+
// Method(s) implementing List interface.
- Float64x2 operator [](int index) {
+
+ Float64x2 operator[](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- return _typedData._getFloat64x2(
- offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT));
+ return _typedData._getFloat64x2(offsetInBytes +
+ (index * Float64x2List.BYTES_PER_ELEMENT));
}
- void operator []=(int index, Float64x2 value) {
+ void operator[]=(int index, Float64x2 value) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
}
- _typedData._setFloat64x2(
- offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT), value);
+ _typedData._setFloat64x2(offsetInBytes +
+ (index * Float64x2List.BYTES_PER_ELEMENT), value);
}
+
// Method(s) implementing TypedData interface.
+
int get elementSizeInBytes {
return Float64x2List.BYTES_PER_ELEMENT;
}
+
// Internal utility methods.
+
Float64x2List _createList(int length) {
return new Float64x2List(length);
}
}
+
class _ByteDataView implements ByteData {
_ByteDataView(TypedData typedData, int _offsetInBytes, int _lengthInBytes)
- : _typedData = typedData,
- _offset = _offsetInBytes,
- length = _lengthInBytes {
+ : _typedData = typedData,
+ _offset = _offsetInBytes,
+ length = _lengthInBytes {
_rangeCheck(_typedData.lengthInBytes, _offset, length);
}
+
// Method(s) implementing TypedData interface.
- _ByteBuffer get buffer {
+
+ ByteBuffer get buffer {
return _typedData.buffer;
}
@@ -2786,7 +3936,6 @@ class _ByteDataView implements ByteData {
}
return _typedData._getInt8(_offset + byteOffset);
}
-
void setInt8(int byteOffset, int value) {
if (byteOffset < 0 || byteOffset >= length) {
throw new RangeError.index(byteOffset, this, "byteOffset");
@@ -2800,7 +3949,6 @@ class _ByteDataView implements ByteData {
}
return _typedData._getUint8(_offset + byteOffset);
}
-
void setUint8(int byteOffset, int value) {
if (byteOffset < 0 || byteOffset >= length) {
throw new RangeError.index(byteOffset, this, "byteOffset");
@@ -2818,9 +3966,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap16(result).toSigned(16);
}
-
- void setInt16(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setInt16(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
@@ -2838,9 +3986,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap16(result);
}
-
- void setUint16(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setUint16(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 1 >= length) {
throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
}
@@ -2858,9 +4006,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap32(result).toSigned(32);
}
-
- void setInt32(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setInt32(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
@@ -2878,9 +4026,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap32(result);
}
-
- void setUint32(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setUint32(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
@@ -2898,9 +4046,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap64(result).toSigned(64);
}
-
- void setInt64(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setInt64(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
@@ -2918,9 +4066,9 @@ class _ByteDataView implements ByteData {
}
return _byteSwap64(result);
}
-
- void setUint64(int byteOffset, int value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setUint64(int byteOffset,
+ int value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
@@ -2929,7 +4077,7 @@ class _ByteDataView implements ByteData {
}
double getFloat32(int byteOffset,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
@@ -2939,9 +4087,9 @@ class _ByteDataView implements ByteData {
_convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset));
return _convF32[0];
}
-
- void setFloat32(int byteOffset, double value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setFloat32(int byteOffset,
+ double value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
@@ -2954,7 +4102,7 @@ class _ByteDataView implements ByteData {
}
double getFloat64(int byteOffset,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
@@ -2964,9 +4112,9 @@ class _ByteDataView implements ByteData {
_convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset));
return _convF64[0];
}
-
- void setFloat64(int byteOffset, double value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setFloat64(int byteOffset,
+ double value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 7 >= length) {
throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
}
@@ -2979,21 +4127,22 @@ class _ByteDataView implements ByteData {
}
Float32x4 getFloat32x4(int byteOffset,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
// TODO(johnmccutchan) : Need to resolve this for endianity.
return _typedData._getFloat32x4(_offset + byteOffset);
}
-
- void setFloat32x4(int byteOffset, Float32x4 value,
- [Endianness endian = Endianness.BIG_ENDIAN]) {
+ void setFloat32x4(int byteOffset,
+ Float32x4 value,
+ [Endianness endian = Endianness.BIG_ENDIAN]) {
if (byteOffset < 0 || byteOffset + 3 >= length) {
throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
}
// TODO(johnmccutchan) : Need to resolve this for endianity.
_typedData._setFloat32x4(_offset + byteOffset, value);
+
}
final TypedData _typedData;
@@ -3002,11 +4151,12 @@ class _ByteDataView implements ByteData {
}
int _byteSwap16(int value) {
- return ((value & 0xFF00) >> 8) | ((value & 0x00FF) << 8);
+ return ((value & 0xFF00) >> 8) |
+ ((value & 0x00FF) << 8);
}
int _byteSwap32(int value) {
- value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
+ value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16);
return value;
}
@@ -3027,50 +4177,58 @@ int _toInt(int value, int mask) {
return value;
}
+
int _toInt8(int value) {
return _toInt(value, 0xFF);
}
+
int _toUint8(int value) {
return value & 0xFF;
}
+
int _toClampedUint8(int value) {
if (value < 0) return 0;
if (value > 0xFF) return 0xFF;
return value;
}
+
int _toInt16(int value) {
return _toInt(value, 0xFFFF);
}
+
int _toUint16(int value) {
return value & 0xFFFF;
}
+
int _toInt32(int value) {
return _toInt(value, 0xFFFFFFFF);
}
+
int _toUint32(int value) {
return value & 0xFFFFFFFF;
}
+
int _toInt64(int value) {
// Avoid bigint mask when possible.
- return (ClassID.getID(value) == ClassID.cidBigint)
- ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
- : value;
+ return (ClassID.getID(value) == ClassID.cidBigint) ?
+ _toInt(value, 0xFFFFFFFFFFFFFFFF) : value;
}
+
int _toUint64(int value) {
// Avoid bigint mask when possible.
- return (ClassID.getID(value) == ClassID.cidBigint)
- ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
- : value;
+ return (ClassID.getID(value) == ClassID.cidBigint) ?
+ _toInt(value, 0xFFFFFFFFFFFFFFFF) : value;
}
+
void _rangeCheck(int listLength, int start, int length) {
if (length < 0) {
throw new RangeError.value(length);
@@ -3083,13 +4241,15 @@ void _rangeCheck(int listLength, int start, int length) {
}
}
+
void _offsetAlignmentCheck(int offset, int alignment) {
if ((offset % alignment) != 0) {
throw new RangeError('Offset ($offset) must be a multiple of '
- 'BYTES_PER_ELEMENT ($alignment)');
+ 'BYTES_PER_ELEMENT ($alignment)');
}
}
+
int _defaultIfNull(object, value) {
if (object == null) {
return value;
diff --git a/runtime/lib/typed_data_sources.gypi b/runtime/lib/typed_data_sources.gypi
index d68daed967d..28d6a53e538 100644
--- a/runtime/lib/typed_data_sources.gypi
+++ b/runtime/lib/typed_data_sources.gypi
@@ -7,7 +7,8 @@
{
'sources': [
'typed_data.cc',
- 'typed_data_patch.dart',
+ 'typed_data.dart',
'simd128.cc',
],
}
+
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 0cf6bd7cd41..3611ef82a03 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -2551,33 +2551,33 @@ M.InstanceKind stringToInstanceKind(String s) {
return M.InstanceKind.float64x2;
case 'Int32x4':
return M.InstanceKind.int32x4;
- case '_Uint8ClampedList':
+ case 'Uint8ClampedList':
return M.InstanceKind.uint8ClampedList;
- case '_Uint8List':
+ case 'Uint8List':
return M.InstanceKind.uint8List;
- case '_Uint16List':
+ case 'Uint16List':
return M.InstanceKind.uint16List;
- case '_Uint32List':
+ case 'Uint32List':
return M.InstanceKind.uint32List;
- case '_Uint64List':
+ case 'Uint64List':
return M.InstanceKind.uint64List;
- case '_Int8List':
+ case 'Int8List':
return M.InstanceKind.int8List;
- case '_Int16List':
+ case 'Int16List':
return M.InstanceKind.int16List;
- case '_Int32List':
+ case 'Int32List':
return M.InstanceKind.int32List;
- case '_Int64List':
+ case 'Int64List':
return M.InstanceKind.int64List;
- case '_Float32List':
+ case 'Float32List':
return M.InstanceKind.float32List;
- case '_Float64List':
+ case 'Float64List':
return M.InstanceKind.float64List;
- case '_Int32x4List':
+ case 'Int32x4List':
return M.InstanceKind.int32x4List;
- case '_Float32x4List':
+ case 'Float32x4List':
return M.InstanceKind.float32x4List;
- case '_Float64x2List':
+ case 'Float64x2List':
return M.InstanceKind.float64x2List;
case 'StackTrace':
return M.InstanceKind.stackTrace;
@@ -2791,46 +2791,46 @@ class Instance extends HeapObject implements M.Instance {
if (map['bytes'] != null) {
Uint8List bytes = BASE64.decode(map['bytes']);
switch (map['kind']) {
- case "_Uint8ClampedList":
+ case "Uint8ClampedList":
typedElements = bytes.buffer.asUint8ClampedList();
break;
- case "_Uint8List":
+ case "Uint8List":
typedElements = bytes.buffer.asUint8List();
break;
- case "_Uint16List":
+ case "Uint16List":
typedElements = bytes.buffer.asUint16List();
break;
- case "_Uint32List":
+ case "Uint32List":
typedElements = bytes.buffer.asUint32List();
break;
- case "_Uint64List":
+ case "Uint64List":
typedElements = bytes.buffer.asUint64List();
break;
- case "_Int8List":
+ case "Int8List":
typedElements = bytes.buffer.asInt8List();
break;
- case "_Int16List":
+ case "Int16List":
typedElements = bytes.buffer.asInt16List();
break;
- case "_Int32List":
+ case "Int32List":
typedElements = bytes.buffer.asInt32List();
break;
- case "_Int64List":
+ case "Int64List":
typedElements = bytes.buffer.asInt64List();
break;
- case "_Float32List":
+ case "Float32List":
typedElements = bytes.buffer.asFloat32List();
break;
- case "_Float64List":
+ case "Float64List":
typedElements = bytes.buffer.asFloat64List();
break;
- case "_Int32x4List":
+ case "Int32x4List":
typedElements = bytes.buffer.asInt32x4List();
break;
- case "_Float32x4List":
+ case "Float32x4List":
typedElements = bytes.buffer.asFloat32x4List();
break;
- case "_Float64x2List":
+ case "Float64x2List":
typedElements = bytes.buffer.asFloat64x2List();
break;
}
diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart
index 893ec843a27..2f45f3acba9 100644
--- a/runtime/observatory/tests/service/get_object_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_rpc_test.dart
@@ -436,12 +436,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint8List'));
+ expect(result['kind'], equals('Uint8List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint8List'));
+ expect(result['class']['name'], equals('Uint8List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -462,12 +462,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint8List'));
+ expect(result['kind'], equals('Uint8List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint8List'));
+ expect(result['class']['name'], equals('Uint8List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -489,12 +489,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint8List'));
+ expect(result['kind'], equals('Uint8List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint8List'));
+ expect(result['class']['name'], equals('Uint8List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -516,12 +516,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint8List'));
+ expect(result['kind'], equals('Uint8List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint8List'));
+ expect(result['class']['name'], equals('Uint8List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -539,12 +539,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint64List'));
+ expect(result['kind'], equals('Uint64List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint64List'));
+ expect(result['class']['name'], equals('Uint64List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -565,12 +565,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint64List'));
+ expect(result['kind'], equals('Uint64List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint64List'));
+ expect(result['class']['name'], equals('Uint64List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -592,12 +592,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint64List'));
+ expect(result['kind'], equals('Uint64List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint64List'));
+ expect(result['class']['name'], equals('Uint64List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
@@ -619,12 +619,12 @@ var tests = [
};
var result = await isolate.invokeRpcNoUpgrade('getObject', params);
expect(result['type'], equals('Instance'));
- expect(result['kind'], equals('_Uint64List'));
+ expect(result['kind'], equals('Uint64List'));
expect(result['_vmType'], equals('TypedData'));
expect(result['id'], startsWith('objects/'));
expect(result['valueAsString'], isNull);
expect(result['class']['type'], equals('@Class'));
- expect(result['class']['name'], equals('_Uint64List'));
+ expect(result['class']['name'], equals('Uint64List'));
expect(result['size'], isPositive);
expect(result['fields'], isEmpty);
expect(result['length'], equals(3));
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index bc8989427cc..2c0493355b8 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -344,12 +344,10 @@ generate_core_libraries("core_libraries") {
],
[
"typed_data",
- processed_gypis.typed_data_sdk_sources,
- "../../sdk/lib/typed_data",
- "typed_data",
- true,
processed_gypis.typed_data_runtime_sources,
"../lib",
+ "typed_data",
+ false,
],
[
"_vmservice",
@@ -430,6 +428,7 @@ template("generate_patched_sdk") {
# Files below are not patches, they will not be in [concatenation_files]
# but the `patch_sdk.dart` script will copy them into the patched sdk.
inputs += [
+ "../lib/typed_data.dart",
"../bin/builtin.dart",
"../bin/vmservice/vmservice_io.dart",
"../bin/vmservice/loader.dart",
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc
index 8ef219d37bc..0dc6e7cf389 100644
--- a/runtime/vm/bootstrap.cc
+++ b/runtime/vm/bootstrap.cc
@@ -44,6 +44,7 @@ enum {
const char** Bootstrap::profiler_patch_paths_ = NULL;
+const char** Bootstrap::typed_data_patch_paths_ = NULL;
#define MAKE_PROPERTIES(CamelName, name) \
diff --git a/runtime/vm/bootstrap.h b/runtime/vm/bootstrap.h
index 0c271b38246..15f454b2ea1 100644
--- a/runtime/vm/bootstrap.h
+++ b/runtime/vm/bootstrap.h
@@ -55,11 +55,11 @@ class Bootstrap : public AllStatic {
static const char* isolate_patch_paths_[];
static const char* math_patch_paths_[];
static const char* mirrors_patch_paths_[];
- static const char* typed_data_patch_paths_[];
static const char* _vmservice_patch_paths_[];
// NULL patch paths for libraries that do not have patch files.
static const char** profiler_patch_paths_;
+ static const char** typed_data_patch_paths_;
};
} // namespace dart
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 8ff2deb5d67..a68cfbf45af 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -3539,8 +3539,8 @@ DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data) {
RETURN_TYPE_ERROR(Z, typed_data, 'TypedData');
}
Object& result = Object::Handle(Z);
- result = GetByteBufferConstructor(T, Symbols::_ByteBuffer(),
- Symbols::_ByteBufferDot_New(), 1);
+ result = GetByteBufferConstructor(T, Symbols::ByteBuffer(),
+ Symbols::ByteBufferDot_New(), 1);
ASSERT(!result.IsNull());
ASSERT(result.IsFunction());
const Function& factory = Function::Cast(result);
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 265c3088f86..e3963d94dea 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -76,11 +76,12 @@ uword FlowGraphBuilder::FindDoubleConstant(double value) {
}
-#define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp) \
- {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid}, // NOLINT
+#define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \
+ {Symbols::k##test_factory_symbol##Id, cid, fp, \
+ #test_factory_symbol ", " #cid}, // NOLINT
static struct {
- intptr_t symbol_id;
+ intptr_t symbold_id;
intptr_t cid;
intptr_t finger_print;
const char* name;
@@ -97,10 +98,10 @@ intptr_t FactoryRecognizer::ResultCid(const Function& factory) {
(lib.raw() == Library::TypedDataLibrary()));
const String& factory_name = String::Handle(factory.name());
for (intptr_t i = 0;
- factory_recognizer_list[i].symbol_id != Symbols::kIllegal; i++) {
+ factory_recognizer_list[i].symbold_id != Symbols::kIllegal; i++) {
if (String::EqualsIgnoringPrivateKey(
factory_name,
- Symbols::Symbol(factory_recognizer_list[i].symbol_id))) {
+ Symbols::Symbol(factory_recognizer_list[i].symbold_id))) {
return factory_recognizer_list[i].cid;
}
}
diff --git a/runtime/vm/gypi_contents.gni b/runtime/vm/gypi_contents.gni
index 4ba651e5f25..403efdfce42 100644
--- a/runtime/vm/gypi_contents.gni
+++ b/runtime/vm/gypi_contents.gni
@@ -42,7 +42,6 @@ _core_library_gypis = [
"../../sdk/lib/math/math_sources.gypi",
"../../sdk/lib/mirrors/mirrors_sources.gypi",
"../../sdk/lib/profiler/profiler_sources.gypi",
- "../../sdk/lib/typed_data/typed_data_sources.gypi",
"../../sdk/lib/vmservice/vmservice_sources.gypi",
"../bin/io_sources.gypi",
]
diff --git a/runtime/vm/method_recognizer.h b/runtime/vm/method_recognizer.h
index 14410a1408b..043dd70153f 100644
--- a/runtime/vm/method_recognizer.h
+++ b/runtime/vm/method_recognizer.h
@@ -57,65 +57,63 @@ namespace dart {
0x46d00995) \
V(Float32x4, Float32x4.fromFloat64x2, Float32x4FromFloat64x2, Float32x4, \
0x685a86d2) \
- V(_Float32x4, shuffle, Float32x4Shuffle, Float32x4, 0x7829101f) \
- V(_Float32x4, shuffleMix, Float32x4ShuffleMix, Float32x4, 0x4182c06b) \
- V(_Float32x4, get:signMask, Float32x4GetSignMask, Dynamic, 0x1d07ca93) \
- V(_Float32x4, equal, Float32x4Equal, Int32x4, 0x11adb239) \
- V(_Float32x4, greaterThan, Float32x4GreaterThan, Int32x4, 0x48adaf58) \
- V(_Float32x4, greaterThanOrEqual, Float32x4GreaterThanOrEqual, Int32x4, \
- 0x32db94ca) \
- V(_Float32x4, lessThan, Float32x4LessThan, Int32x4, 0x425b000c) \
- V(_Float32x4, lessThanOrEqual, Float32x4LessThanOrEqual, Int32x4, \
- 0x0278c2f8) \
- V(_Float32x4, notEqual, Float32x4NotEqual, Int32x4, 0x2987cd26) \
- V(_Float32x4, min, Float32x4Min, Float32x4, 0x5ed74b6f) \
- V(_Float32x4, max, Float32x4Max, Float32x4, 0x68696442) \
- V(_Float32x4, scale, Float32x4Scale, Float32x4, 0x704e4122) \
- V(_Float32x4, sqrt, Float32x4Sqrt, Float32x4, 0x2c967a6f) \
- V(_Float32x4, reciprocalSqrt, Float32x4ReciprocalSqrt, Float32x4, \
- 0x6264bfe8) \
- V(_Float32x4, reciprocal, Float32x4Reciprocal, Float32x4, 0x3cd7e819) \
- V(_Float32x4, unary-, Float32x4Negate, Float32x4, 0x34431a14) \
- V(_Float32x4, abs, Float32x4Absolute, Float32x4, 0x471cdd87) \
- V(_Float32x4, clamp, Float32x4Clamp, Float32x4, 0x2cb30492) \
- V(_Float32x4, withX, Float32x4WithX, Float32x4, 0x4e336aff) \
- V(_Float32x4, withY, Float32x4WithY, Float32x4, 0x0a72b910) \
- V(_Float32x4, withZ, Float32x4WithZ, Float32x4, 0x31e93658) \
- V(_Float32x4, withW, Float32x4WithW, Float32x4, 0x60ddc105) \
+ V(Float32x4, shuffle, Float32x4Shuffle, Float32x4, 0x7829101f) \
+ V(Float32x4, shuffleMix, Float32x4ShuffleMix, Float32x4, 0x4182c06b) \
+ V(Float32x4, get:signMask, Float32x4GetSignMask, Dynamic, 0x1d07ca93) \
+ V(Float32x4, _cmpequal, Float32x4Equal, Int32x4, 0x16ad0fea) \
+ V(Float32x4, _cmpgt, Float32x4GreaterThan, Int32x4, 0x0641f613) \
+ V(Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, Int32x4, 0x464b8ffc) \
+ V(Float32x4, _cmplt, Float32x4LessThan, Int32x4, 0x3eecd0de) \
+ V(Float32x4, _cmplte, Float32x4LessThanOrEqual, Int32x4, 0x06384754) \
+ V(Float32x4, _cmpnequal, Float32x4NotEqual, Int32x4, 0x2f25ef10) \
+ V(Float32x4, _min, Float32x4Min, Float32x4, 0x1ee6c750) \
+ V(Float32x4, _max, Float32x4Max, Float32x4, 0x4db6bbb4) \
+ V(Float32x4, _scale, Float32x4Scale, Float32x4, 0x52052a66) \
+ V(Float32x4, _sqrt, Float32x4Sqrt, Float32x4, 0x479f6b4a) \
+ V(Float32x4, _reciprocalSqrt, Float32x4ReciprocalSqrt, Float32x4, \
+ 0x6d35bfcf) \
+ V(Float32x4, _reciprocal, Float32x4Reciprocal, Float32x4, 0x21a56839) \
+ V(Float32x4, _negate, Float32x4Negate, Float32x4, 0x6cfd5db7) \
+ V(Float32x4, _abs, Float32x4Absolute, Float32x4, 0x249b8078) \
+ V(Float32x4, _clamp, Float32x4Clamp, Float32x4, 0x28b06c7a) \
+ V(Float32x4, withX, Float32x4WithX, Float32x4, 0x4e336aff) \
+ V(Float32x4, withY, Float32x4WithY, Float32x4, 0x0a72b910) \
+ V(Float32x4, withZ, Float32x4WithZ, Float32x4, 0x31e93658) \
+ V(Float32x4, withW, Float32x4WithW, Float32x4, 0x60ddc105) \
V(Float64x2, Float64x2., Float64x2Constructor, Float64x2, 0x193be61d) \
V(Float64x2, Float64x2.zero, Float64x2Zero, Float64x2, 0x7b2ed5df) \
V(Float64x2, Float64x2.splat, Float64x2Splat, Float64x2, 0x2abbfcb2) \
V(Float64x2, Float64x2.fromFloat32x4, Float64x2FromFloat32x4, Float64x2, \
0x2f43d3a6) \
- V(_Float64x2, get:x, Float64x2GetX, Double, 0x58bfb39a) \
- V(_Float64x2, get:y, Float64x2GetY, Double, 0x3cf4fcfa) \
- V(_Float64x2, unary-, Float64x2Negate, Float64x2, 0x3df2eecb) \
- V(_Float64x2, abs, Float64x2Abs, Float64x2, 0x031f9e47) \
- V(_Float64x2, sqrt, Float64x2Sqrt, Float64x2, 0x77f711dd) \
- V(_Float64x2, get:signMask, Float64x2GetSignMask, Dynamic, 0x27ddf18d) \
- V(_Float64x2, scale, Float64x2Scale, Float64x2, 0x26830a61) \
- V(_Float64x2, withX, Float64x2WithX, Float64x2, 0x1d2bcaf5) \
- V(_Float64x2, withY, Float64x2WithY, Float64x2, 0x383ed6ac) \
- V(_Float64x2, min, Float64x2Min, Float64x2, 0x28d7ddf6) \
- V(_Float64x2, max, Float64x2Max, Float64x2, 0x0bd74e5b) \
+ V(Float64x2, get:x, Float64x2GetX, Double, 0x58bfb39a) \
+ V(Float64x2, get:y, Float64x2GetY, Double, 0x3cf4fcfa) \
+ V(Float64x2, _negate, Float64x2Negate, Float64x2, 0x523937da) \
+ V(Float64x2, abs, Float64x2Abs, Float64x2, 0x031f9e47) \
+ V(Float64x2, sqrt, Float64x2Sqrt, Float64x2, 0x77f711dd) \
+ V(Float64x2, get:signMask, Float64x2GetSignMask, Dynamic, 0x27ddf18d) \
+ V(Float64x2, scale, Float64x2Scale, Float64x2, 0x26830a61) \
+ V(Float64x2, withX, Float64x2WithX, Float64x2, 0x1d2bcaf5) \
+ V(Float64x2, withY, Float64x2WithY, Float64x2, 0x383ed6ac) \
+ V(Float64x2, min, Float64x2Min, Float64x2, 0x28d7ddf6) \
+ V(Float64x2, max, Float64x2Max, Float64x2, 0x0bd74e5b) \
V(Int32x4, Int32x4., Int32x4Constructor, Int32x4, 0x26b199a7) \
V(Int32x4, Int32x4.bool, Int32x4BoolConstructor, Int32x4, 0x1b55a5e1) \
V(Int32x4, Int32x4.fromFloat32x4Bits, Int32x4FromFloat32x4Bits, Int32x4, \
0x7e82564c) \
- V(_Int32x4, get:flagX, Int32x4GetFlagX, Bool, 0x563883c4) \
- V(_Int32x4, get:flagY, Int32x4GetFlagY, Bool, 0x446f5e7a) \
- V(_Int32x4, get:flagZ, Int32x4GetFlagZ, Bool, 0x20d61679) \
- V(_Int32x4, get:flagW, Int32x4GetFlagW, Bool, 0x504478ac) \
- V(_Int32x4, get:signMask, Int32x4GetSignMask, Dynamic, 0x2c1ec9e5) \
- V(_Int32x4, shuffle, Int32x4Shuffle, Int32x4, 0x20bc0b16) \
- V(_Int32x4, shuffleMix, Int32x4ShuffleMix, Int32x4, 0x5c7056e1) \
- V(_Int32x4, select, Int32x4Select, Float32x4, 0x6b49654f) \
- V(_Int32x4, withFlagX, Int32x4WithFlagX, Int32x4, 0x0ef58fcf) \
- V(_Int32x4, withFlagY, Int32x4WithFlagY, Int32x4, 0x6485a9c4) \
- V(_Int32x4, withFlagZ, Int32x4WithFlagZ, Int32x4, 0x267acdfa) \
- V(_Int32x4, withFlagW, Int32x4WithFlagW, Int32x4, 0x345ac675) \
- V(_Int64List, [], Int64ArrayGetIndexed, Dynamic, 0x680ec59b) \
- V(_Int64List, []=, Int64ArraySetIndexed, Dynamic, 0x0872fc15) \
+ V(Int32x4, get:flagX, Int32x4GetFlagX, Bool, 0x563883c4) \
+ V(Int32x4, get:flagY, Int32x4GetFlagY, Bool, 0x446f5e7a) \
+ V(Int32x4, get:flagZ, Int32x4GetFlagZ, Bool, 0x20d61679) \
+ V(Int32x4, get:flagW, Int32x4GetFlagW, Bool, 0x504478ac) \
+ V(Int32x4, get:signMask, Int32x4GetSignMask, Dynamic, 0x2c1ec9e5) \
+ V(Int32x4, shuffle, Int32x4Shuffle, Int32x4, 0x20bc0b16) \
+ V(Int32x4, shuffleMix, Int32x4ShuffleMix, Int32x4, 0x5c7056e1) \
+ V(Int32x4, select, Int32x4Select, Float32x4, 0x5c254e86) \
+ V(Int32x4, withFlagX, Int32x4WithFlagX, Int32x4, 0x0ef58fcf) \
+ V(Int32x4, withFlagY, Int32x4WithFlagY, Int32x4, 0x6485a9c4) \
+ V(Int32x4, withFlagZ, Int32x4WithFlagZ, Int32x4, 0x267acdfa) \
+ V(Int32x4, withFlagW, Int32x4WithFlagW, Int32x4, 0x345ac675) \
+ V(Int64List, [], Int64ArrayGetIndexed, Dynamic, 0x680ec59b) \
+ V(Int64List, []=, Int64ArraySetIndexed, Dynamic, 0x0872fc15) \
V(_Bigint, get:_neg, Bigint_getNeg, Bool, 0x355fa565) \
V(_Bigint, get:_used, Bigint_getUsed, Smi, 0x33b9dcd2) \
V(_Bigint, get:_digits, Bigint_getDigits, TypedDataUint32Array, 0x68de883a) \
@@ -268,45 +266,45 @@ namespace dart {
TypedDataFloat64x2Array, 0x18cbf4d9) \
#define GRAPH_TYPED_DATA_INTRINSICS_LIST(V) \
- V(_Int8List, [], Int8ArrayGetIndexed, Smi, 0x5f9a4430) \
- V(_Int8List, []=, Int8ArraySetIndexed, Dynamic, 0x5f880110) \
- V(_Uint8List, [], Uint8ArrayGetIndexed, Smi, 0x1eb150d8) \
- V(_Uint8List, []=, Uint8ArraySetIndexed, Dynamic, 0x4cf76981) \
+ V(Int8List, [], Int8ArrayGetIndexed, Smi, 0x5f9a4430) \
+ V(Int8List, []=, Int8ArraySetIndexed, Dynamic, 0x5f880110) \
+ V(Uint8List, [], Uint8ArrayGetIndexed, Smi, 0x1eb150d8) \
+ V(Uint8List, []=, Uint8ArraySetIndexed, Dynamic, 0x4cf76981) \
V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, Smi, 0x1eb150d8) \
V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, Dynamic, \
0x4cf76981) \
- V(_Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, Smi, 0x1eb150d8) \
- V(_Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, Dynamic, 0x2224afe1) \
+ V(Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, Smi, 0x1eb150d8) \
+ V(Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, Dynamic, 0x2224afe1) \
V(_ExternalUint8ClampedArray, [], ExternalUint8ClampedArrayGetIndexed, \
Smi, 0x1eb150d8) \
V(_ExternalUint8ClampedArray, []=, ExternalUint8ClampedArraySetIndexed, \
Dynamic, 0x2224afe1) \
- V(_Int16List, [], Int16ArrayGetIndexed, Smi, 0x74ea134c) \
- V(_Int16List, []=, Int16ArraySetIndexed, Dynamic, 0x48e25661) \
- V(_Uint16List, [], Uint16ArrayGetIndexed, Smi, 0x756d9a97) \
- V(_Uint16List, []=, Uint16ArraySetIndexed, Dynamic, 0x698f9d4f) \
- V(_Int32List, [], Int32ArrayGetIndexed, Dynamic, 0x61e49de1) \
- V(_Int32List, []=, Int32ArraySetIndexed, Dynamic, 0x55736c63) \
- V(_Uint32List, [], Uint32ArrayGetIndexed, Dynamic, 0x2eaa22d2) \
- V(_Uint32List, []=, Uint32ArraySetIndexed, Dynamic, 0x3c88eeb9) \
- V(_Float64List, [], Float64ArrayGetIndexed, Double, 0x20950e8a) \
- V(_Float64List, []=, Float64ArraySetIndexed, Dynamic, 0x556a0727) \
- V(_Float32List, [], Float32ArrayGetIndexed, Double, 0x7101fa23) \
- V(_Float32List, []=, Float32ArraySetIndexed, Dynamic, 0x5e32c1eb) \
- V(_Float32x4List, [], Float32x4ArrayGetIndexed, Float32x4, 0x28b0a7ef) \
- V(_Float32x4List, []=, Float32x4ArraySetIndexed, Dynamic, 0x4babf032) \
- V(_Int32x4List, [], Int32x4ArrayGetIndexed, Int32x4, 0x619c79a0) \
- V(_Int32x4List, []=, Int32x4ArraySetIndexed, Dynamic, 0x021bd16b) \
- V(_Float64x2List, [], Float64x2ArrayGetIndexed, Float64x2, 0x7a6dd5e5) \
- V(_Float64x2List, []=, Float64x2ArraySetIndexed, Dynamic, 0x3c59fecb) \
+ V(Int16List, [], Int16ArrayGetIndexed, Smi, 0x74ea134c) \
+ V(Int16List, []=, Int16ArraySetIndexed, Dynamic, 0x48e25661) \
+ V(Uint16List, [], Uint16ArrayGetIndexed, Smi, 0x756d9a97) \
+ V(Uint16List, []=, Uint16ArraySetIndexed, Dynamic, 0x698f9d4f) \
+ V(Int32List, [], Int32ArrayGetIndexed, Dynamic, 0x61e49de1) \
+ V(Int32List, []=, Int32ArraySetIndexed, Dynamic, 0x55736c63) \
+ V(Uint32List, [], Uint32ArrayGetIndexed, Dynamic, 0x2eaa22d2) \
+ V(Uint32List, []=, Uint32ArraySetIndexed, Dynamic, 0x3c88eeb9) \
+ V(Float64List, [], Float64ArrayGetIndexed, Double, 0x20950e8a) \
+ V(Float64List, []=, Float64ArraySetIndexed, Dynamic, 0x556a0727) \
+ V(Float32List, [], Float32ArrayGetIndexed, Double, 0x7101fa23) \
+ V(Float32List, []=, Float32ArraySetIndexed, Dynamic, 0x5e32c1eb) \
+ V(Float32x4List, [], Float32x4ArrayGetIndexed, Float32x4, 0x28b0a7ef) \
+ V(Float32x4List, []=, Float32x4ArraySetIndexed, Dynamic, 0x4babf032) \
+ V(Int32x4List, [], Int32x4ArrayGetIndexed, Int32x4, 0x619c79a0) \
+ V(Int32x4List, []=, Int32x4ArraySetIndexed, Dynamic, 0x021bd16b) \
+ V(Float64x2List, [], Float64x2ArrayGetIndexed, Float64x2, 0x7a6dd5e5) \
+ V(Float64x2List, []=, Float64x2ArraySetIndexed, Dynamic, 0x3c59fecb) \
V(_TypedList, get:length, TypedDataLength, Smi, 0x2090dc1a) \
- V(_Float32x4, get:x, Float32x4ShuffleX, Double, 0x63d0c13f) \
- V(_Float32x4, get:y, Float32x4ShuffleY, Double, 0x20343b1b) \
- V(_Float32x4, get:z, Float32x4ShuffleZ, Double, 0x13181dba) \
- V(_Float32x4, get:w, Float32x4ShuffleW, Double, 0x69895020) \
- V(_Float32x4, *, Float32x4Mul, Float32x4, 0x0e2a0ef4) \
- V(_Float32x4, -, Float32x4Sub, Float32x4, 0x6edeeaa3) \
- V(_Float32x4, +, Float32x4Add, Float32x4, 0x303a9943) \
+ V(Float32x4, get:x, Float32x4ShuffleX, Double, 0x63d0c13f) \
+ V(Float32x4, get:y, Float32x4ShuffleY, Double, 0x20343b1b) \
+ V(Float32x4, get:z, Float32x4ShuffleZ, Double, 0x13181dba) \
+ V(Float32x4, get:w, Float32x4ShuffleW, Double, 0x69895020) \
+ V(Float32x4, _mul, Float32x4Mul, Float32x4, 0x6183ae12) \
+ V(Float32x4, _sub, Float32x4Sub, Float32x4, 0x22a8d3ea) \
+ V(Float32x4, _add, Float32x4Add, Float32x4, 0x613c30f4) \
#define GRAPH_CORE_INTRINSICS_LIST(V) \
V(_List, get:length, ObjectArrayLength, Smi, 0x25943ad2) \
@@ -540,30 +538,23 @@ class MethodRecognizer : public AllStatic {
// clang-format off
// List of recognized list factories:
-// (factory-name-symbol, class-name-string, constructor-name-string,
-// result-cid, fingerprint).
+// (factory-name-symbol, result-cid, fingerprint).
#define RECOGNIZED_LIST_FACTORY_LIST(V) \
- V(_ListFactory, _List, ., kArrayCid, 0x375519ad) \
- V(_GrowableListWithData, _GrowableList, .withData, kGrowableObjectArrayCid, \
- 0x401f3150) \
- V(_GrowableListFactory, _GrowableList, ., kGrowableObjectArrayCid, \
- 0x0b8d9feb) \
- V(_Int8ArrayFactory, Int8List, ., kTypedDataInt8ArrayCid, 0x2e7749e3) \
- V(_Uint8ArrayFactory, Uint8List, ., kTypedDataUint8ArrayCid, 0x6ab75439) \
- V(_Uint8ClampedArrayFactory, Uint8ClampedList, ., \
- kTypedDataUint8ClampedArrayCid, 0x183129d7) \
- V(_Int16ArrayFactory, Int16List, ., kTypedDataInt16ArrayCid, 0x14b563ea) \
- V(_Uint16ArrayFactory, Uint16List, ., kTypedDataUint16ArrayCid, 0x07456be4) \
- V(_Int32ArrayFactory, Int32List, ., kTypedDataInt32ArrayCid, 0x5bd49250) \
- V(_Uint32ArrayFactory, Uint32List, ., kTypedDataUint32ArrayCid, 0x3c59b3a4) \
- V(_Int64ArrayFactory, Int64List, ., kTypedDataInt64ArrayCid, 0x57d85ac7) \
- V(_Uint64ArrayFactory, Uint64List, ., kTypedDataUint64ArrayCid, 0x2c093004) \
- V(_Float64ArrayFactory, Float64List, ., kTypedDataFloat64ArrayCid, \
- 0x501be4f1) \
- V(_Float32ArrayFactory, Float32List, ., kTypedDataFloat32ArrayCid, \
- 0x738e124b) \
- V(_Float32x4ArrayFactory, Float32x4List, ., kTypedDataFloat32x4ArrayCid, \
- 0x7a7dd718)
+ V(_ListFactory, kArrayCid, 0x375519ad) \
+ V(_GrowableListWithData, kGrowableObjectArrayCid, 0x401f3150) \
+ V(_GrowableListFactory, kGrowableObjectArrayCid, 0x0b8d9feb) \
+ V(_Int8ArrayFactory, kTypedDataInt8ArrayCid, 0x2e7749e3) \
+ V(_Uint8ArrayFactory, kTypedDataUint8ArrayCid, 0x6ab75439) \
+ V(_Uint8ClampedArrayFactory, kTypedDataUint8ClampedArrayCid, 0x183129d7) \
+ V(_Int16ArrayFactory, kTypedDataInt16ArrayCid, 0x14b563ea) \
+ V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 0x07456be4) \
+ V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 0x5bd49250) \
+ V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 0x3c59b3a4) \
+ V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 0x57d85ac7) \
+ V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 0x2c093004) \
+ V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 0x501be4f1) \
+ V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 0x738e124b) \
+ V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 0x7a7dd718)
// clang-format on
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4d584694ce8..d447c93c079 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1510,7 +1510,7 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
ASSERT(lib.raw() == Library::TypedDataLibrary());
#define REGISTER_TYPED_DATA_CLASS(clazz) \
cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid); \
- RegisterPrivateClass(cls, Symbols::clazz##List(), lib);
+ RegisterClass(cls, Symbols::clazz##List(), lib);
DART_CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
#undef REGISTER_TYPED_DATA_CLASS
@@ -1531,14 +1531,14 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
cls = Class::New(kByteBufferCid);
cls.set_instance_size(0);
cls.set_next_field_offset(-kWordSize);
- RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib);
+ RegisterClass(cls, Symbols::ByteBuffer(), lib);
pending_classes.Add(cls);
CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
#undef REGISTER_EXT_TYPED_DATA_CLASS
// Register Float32x4 and Int32x4 in the object store.
cls = Class::New();
- RegisterPrivateClass(cls, Symbols::Float32x4(), lib);
+ RegisterClass(cls, Symbols::Float32x4(), lib);
cls.set_num_type_arguments(0);
cls.set_num_own_type_arguments(0);
cls.set_is_prefinalized();
@@ -1548,7 +1548,7 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
object_store->set_float32x4_type(type);
cls = Class::New();
- RegisterPrivateClass(cls, Symbols::Int32x4(), lib);
+ RegisterClass(cls, Symbols::Int32x4(), lib);
cls.set_num_type_arguments(0);
cls.set_num_own_type_arguments(0);
cls.set_is_prefinalized();
@@ -1558,7 +1558,7 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
object_store->set_int32x4_type(type);
cls = Class::New();
- RegisterPrivateClass(cls, Symbols::Float64x2(), lib);
+ RegisterClass(cls, Symbols::Float64x2(), lib);
cls.set_num_type_arguments(0);
cls.set_num_own_type_arguments(0);
cls.set_is_prefinalized();
@@ -11575,16 +11575,19 @@ void Library::CheckFunctionFingerprints() {
#undef CHECK_FINGERPRINTS2
-#define CHECK_FACTORY_FINGERPRINTS(symbol, class_name, factory_name, cid, fp) \
- func = GetFunction(all_libs, #class_name, #factory_name); \
+ Class& cls = Class::Handle();
+
+#define CHECK_FACTORY_FINGERPRINTS(factory_symbol, cid, fp) \
+ cls = Isolate::Current()->class_table()->At(cid); \
+ func = cls.LookupFunctionAllowPrivate(Symbols::factory_symbol()); \
if (func.IsNull()) { \
has_errors = true; \
- OS::Print("Function not found %s.%s\n", #class_name, #factory_name); \
+ OS::Print("Function not found %s.%s\n", cls.ToCString(), \
+ Symbols::factory_symbol().ToCString()); \
} else { \
- CHECK_FINGERPRINT2(func, symbol, cid, fp); \
+ CHECK_FINGERPRINT2(func, factory_symbol, cid, fp); \
}
- all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary()));
RECOGNIZED_LIST_FACTORY_LIST(CHECK_FACTORY_FINGERPRINTS);
#undef CHECK_FACTORY_FINGERPRINTS
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 36fdaafb854..e45c04cf086 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -678,7 +678,7 @@ void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) {
{"dart:isolate", "_SendPortImpl", "send"},
{"dart:typed_data", "ByteData", "ByteData."},
{"dart:typed_data", "ByteData", "ByteData._view"},
- {"dart:typed_data", "_ByteBuffer", "_ByteBuffer._New"},
+ {"dart:typed_data", "ByteBuffer", "ByteBuffer._New"},
{"dart:_vmservice", "::", "_registerIsolate"},
{"dart:_vmservice", "::", "boot"},
#if !defined(PRODUCT)
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index dce810e7750..a150c302a76 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -994,7 +994,7 @@ TEST_CASE(Profiler_TypedArrayAllocation) {
Library::Handle(isolate->object_store()->typed_data_library());
const Class& float32_list_class =
- Class::Handle(GetClass(typed_data_library, "_Float32List"));
+ Class::Handle(GetClass(typed_data_library, "Float32List"));
EXPECT(!float32_list_class.IsNull());
Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 502f0312cce..b709b0a70d0 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -215,23 +215,23 @@ class ObjectPointerVisitor;
V(Object, "Object") \
V(Int, "int") \
V(Double, "double") \
- V(Float32x4, "_Float32x4") \
- V(Float64x2, "_Float64x2") \
- V(Int32x4, "_Int32x4") \
- V(Int8List, "_Int8List") \
- V(Uint8List, "_Uint8List") \
- V(Uint8ClampedList, "_Uint8ClampedList") \
- V(Int16List, "_Int16List") \
- V(Uint16List, "_Uint16List") \
- V(Int32List, "_Int32List") \
- V(Uint32List, "_Uint32List") \
- V(Int64List, "_Int64List") \
- V(Uint64List, "_Uint64List") \
- V(Float32x4List, "_Float32x4List") \
- V(Int32x4List, "_Int32x4List") \
- V(Float64x2List, "_Float64x2List") \
- V(Float32List, "_Float32List") \
- V(Float64List, "_Float64List") \
+ V(Float32x4, "Float32x4") \
+ V(Float64x2, "Float64x2") \
+ V(Int32x4, "Int32x4") \
+ V(Int8List, "Int8List") \
+ V(Uint8List, "Uint8List") \
+ V(Uint8ClampedList, "Uint8ClampedList") \
+ V(Int16List, "Int16List") \
+ V(Uint16List, "Uint16List") \
+ V(Int32List, "Int32List") \
+ V(Uint32List, "Uint32List") \
+ V(Int64List, "Int64List") \
+ V(Uint64List, "Uint64List") \
+ V(Float32x4List, "Float32x4List") \
+ V(Int32x4List, "Int32x4List") \
+ V(Float64x2List, "Float64x2List") \
+ V(Float32List, "Float32List") \
+ V(Float64List, "Float64List") \
V(_Int8ArrayFactory, "Int8List.") \
V(_Uint8ArrayFactory, "Uint8List.") \
V(_Uint8ClampedArrayFactory, "Uint8ClampedList.") \
@@ -278,8 +278,8 @@ class ObjectPointerVisitor;
V(ByteDataDot, "ByteData.") \
V(ByteDataDot_view, "ByteData._view") \
V(_ByteDataView, "_ByteDataView") \
- V(_ByteBuffer, "_ByteBuffer") \
- V(_ByteBufferDot_New, "_ByteBuffer._New") \
+ V(ByteBuffer, "ByteBuffer") \
+ V(ByteBufferDot_New, "ByteBuffer._New") \
V(_WeakProperty, "_WeakProperty") \
V(_MirrorReference, "_MirrorReference") \
V(FreeListElement, "FreeListElement") \
diff --git a/runtime/vm/vm.gypi b/runtime/vm/vm.gypi
index a8c0e74ac4b..3da329123e9 100644
--- a/runtime/vm/vm.gypi
+++ b/runtime/vm/vm.gypi
@@ -30,7 +30,6 @@
'snapshot_test_in_dat_file': 'snapshot_test_in.dat',
'snapshot_test_dart_file': 'snapshot_test.dart',
'typed_data_cc_file': '<(gen_source_dir)/typed_data_gen.cc',
- 'typed_data_patch_cc_file': '<(gen_source_dir)/typed_data_patch_gen.cc',
'vmservice_cc_file': '<(gen_source_dir)/vmservice_gen.cc',
'vmservice_patch_cc_file': '<(gen_source_dir)/vmservice_patch_gen.cc',
},
@@ -234,7 +233,6 @@
'generate_mirrors_patch_cc_file#host',
'generate_profiler_cc_file#host',
'generate_typed_data_cc_file#host',
- 'generate_typed_data_patch_cc_file#host',
'generate_vmservice_cc_file#host',
'generate_vmservice_patch_cc_file#host',
],
@@ -273,7 +271,6 @@
'<(mirrors_patch_cc_file)',
'<(profiler_cc_file)',
'<(typed_data_cc_file)',
- '<(typed_data_patch_cc_file)',
'<(vmservice_cc_file)',
'<(vmservice_patch_cc_file)',
],
@@ -970,12 +967,16 @@
]
},
{
+ # Unlike the other libraries in the SDK, dart:typed_data is not
+ # implemented as a patch applied to the base SDK implementation.
+ # Instead the VM has a complete replacement library and the
+ # implementation in the SDK is ignored.
'target_name': 'generate_typed_data_cc_file',
'type': 'none',
'toolsets':['host'],
'includes': [
# Load the runtime implementation sources.
- '../../sdk/lib/typed_data/typed_data_sources.gypi',
+ '../lib/typed_data_sources.gypi',
],
'sources/': [
# Exclude all .[cc|h] files.
@@ -1009,46 +1010,6 @@
},
]
},
- {
- 'target_name': 'generate_typed_data_patch_cc_file',
- 'type': 'none',
- 'toolsets':['host'],
- 'includes': [
- # Load the patch sources.
- '../lib/typed_data_sources.gypi',
- ],
- 'sources/': [
- # Exclude all .[cc|h] files.
- # This is only here for reference. Excludes happen after
- # variable expansion, so the script has to do its own
- # exclude processing of the sources being passed.
- ['exclude', '\\.cc|h$'],
- ],
- 'actions': [
- {
- 'action_name': 'generate_typed_data_patch_cc',
- 'inputs': [
- '../tools/gen_library_src_paths.py',
- '<(libgen_in_cc_file)',
- '<@(_sources)',
- ],
- 'outputs': [
- '<(typed_data_patch_cc_file)',
- ],
- 'action': [
- 'python',
- 'tools/gen_library_src_paths.py',
- '--output', '<(typed_data_patch_cc_file)',
- '--input_cc', '<(libgen_in_cc_file)',
- '--include', 'vm/bootstrap.h',
- '--var_name', 'dart::Bootstrap::typed_data_patch_paths_',
- '--library_name', 'dart:typed_data',
- '<@(_sources)',
- ],
- 'message': 'Generating ''<(typed_data_patch_cc_file)'' file.'
- },
- ]
- },
{
'target_name': 'generate_profiler_cc_file',
'type': 'none',
@@ -1294,7 +1255,6 @@
'generate_math_library_patch',
'generate_mirrors_library_patch',
'generate_profiler_library_patch',
- 'generate_typed_data_library_patch',
'generate_vmservice_library_patch',
],
'actions': [
@@ -1305,6 +1265,11 @@
'"dart$", "sdk/lib"])',
'../../tools/patch_sdk.py',
'../../tools/patch_sdk.dart',
+ # Unlike the other libraries in the SDK, dart:typed_data is not
+ # implemented as a patch applied to the base SDK implementation.
+ # Instead the VM has a complete replacement library and the
+ # implementation in the SDK is ignored.
+ '../lib/typed_data.dart',
# Unlike the other libraries in the SDK, dart:_builtin and
# dart:nativewrappers are only available for the Dart VM.
'../bin/builtin.dart',
@@ -1322,7 +1287,6 @@
'<(gen_source_dir)/patches/math_patch.dart',
'<(gen_source_dir)/patches/mirrors_patch.dart',
'<(gen_source_dir)/patches/profiler_patch.dart',
- '<(gen_source_dir)/patches/typed_data_patch.dart',
'<(gen_source_dir)/patches/vmservice_patch.dart',
],
'outputs': [
@@ -1694,38 +1658,6 @@
},
],
},
- {
- 'variables': {
- 'library_name': 'typed_data',
- 'library_uri': 'dart:typed_data',
- },
- 'target_name': 'generate_<(library_name)_library_patch',
- 'type': 'none',
- 'toolsets': ['host'],
- 'includes': [
- '../lib/typed_data_sources.gypi',
- ],
- 'actions': [
- {
- 'action_name': 'concatenate_<(library_name)_patches',
- 'inputs': [
- '../tools/concatenate_patches.py',
- '<@(_sources)',
- ],
- 'outputs': [
- '<(gen_source_dir)/patches/<(library_name)_patch.dart'
- ],
- 'action': [
- 'python',
- 'tools/concatenate_patches.py',
- '--output',
- '<(gen_source_dir)/patches/<(library_name)_patch.dart',
- '<@(_sources)',
- ],
- 'message': 'Generating <(library_uri) patch.',
- },
- ],
- },
{
'variables': {
'library_name': 'vmservice',
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index e9980eab858..5a76ff5f5d3 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -110,7 +110,14 @@ void main(List argv) {
var libraryOut = path.join(sdkLibIn, library.path);
var libraryIn;
- if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
+ if (mode == 'vm' && library.path.contains('typed_data.dart')) {
+ // dart:typed_data is unlike the other libraries in the SDK. The VM does
+ // not apply a patch to the base SDK implementation of the library.
+ // Instead, the VM provides a replacement implementation and ignores the
+ // sources in the SDK.
+ libraryIn =
+ path.join(dartDir, 'runtime', 'lib', 'typed_data.dart');
+ } else if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
libraryIn =
path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, ''));
} else {