[vm] Harden access to unchecked natives.
Bug: https://github.com/dart-lang/sdk/issues/37234
Change-Id: I567b3fa177e89db50345e174a07c98b10c53f102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105721
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: RĂ©gis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
diff --git a/runtime/lib/function.dart b/runtime/lib/function.dart
index ae3902a..1c99ca2 100644
--- a/runtime/lib/function.dart
+++ b/runtime/lib/function.dart
@@ -6,6 +6,10 @@
@pragma("vm:entry-point")
class _Closure implements Function {
+ factory _Closure._uninstantiable() {
+ throw "Unreachable";
+ }
+
bool operator ==(Object other) native "Closure_equals";
int get hashCode {
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart
index 2289012..3a01913 100644
--- a/runtime/lib/integers.dart
+++ b/runtime/lib/integers.dart
@@ -480,8 +480,9 @@
@pragma("vm:entry-point")
class _Smi extends _IntegerImplementation {
factory _Smi._uninstantiable() {
- throw new UnsupportedError("_Smi can only be allocated by the VM");
+ throw "Unreachable";
}
+
int get hashCode => this;
int get _identityHashCode => this;
@pragma("vm:exact-result-type", "dart:core#_Smi")
@@ -682,8 +683,9 @@
@pragma("vm:entry-point")
class _Mint extends _IntegerImplementation {
factory _Mint._uninstantiable() {
- throw new UnsupportedError("_Mint can only be allocated by the VM");
+ throw "Unreachable";
}
+
int get hashCode => this;
int get _identityHashCode => this;
@pragma("vm:non-nullable-result-type")
diff --git a/runtime/lib/lib_prefix.dart b/runtime/lib/lib_prefix.dart
index 483a660..fe12660 100644
--- a/runtime/lib/lib_prefix.dart
+++ b/runtime/lib/lib_prefix.dart
@@ -7,6 +7,10 @@
// This type corresponds to the VM-internal class LibraryPrefix.
@pragma("vm:entry-point")
class _LibraryPrefix {
+ factory _LibraryPrefix._uninstantiable() {
+ throw "Unreachable";
+ }
+
bool _load() native "LibraryPrefix_load";
Object _loadError() native "LibraryPrefix_loadError";
bool isLoaded() native "LibraryPrefix_isLoaded";
diff --git a/runtime/lib/mirror_reference.dart b/runtime/lib/mirror_reference.dart
index ca21b5b..d203953 100644
--- a/runtime/lib/mirror_reference.dart
+++ b/runtime/lib/mirror_reference.dart
@@ -7,7 +7,7 @@
@pragma("vm:entry-point")
class _MirrorReference {
factory _MirrorReference._uninstantiable() {
- throw new UnsupportedError("class _MirrorReference cannot be instantiated");
+ throw "Unreachable";
}
bool operator ==(other) native "MirrorReference_equals";
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index 35a13b1..7621bb0 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -148,7 +148,7 @@
}
class _RegExpMatch implements RegExpMatch {
- _RegExpMatch(this._regexp, this.input, this._match);
+ _RegExpMatch._(this._regexp, this.input, this._match);
int get start => _start(0);
int get end => _end(0);
@@ -222,7 +222,7 @@
if (match == null) {
return null;
}
- return new _RegExpMatch(this, str, match);
+ return new _RegExpMatch._(this, str, match);
}
Iterable<RegExpMatch> allMatches(String string, [int start = 0]) {
@@ -242,7 +242,7 @@
}
List<int> list = _ExecuteMatchSticky(string, start);
if (list == null) return null;
- return new _RegExpMatch(this, string, list);
+ return new _RegExpMatch._(this, string, list);
}
bool hasMatch(String str) {
@@ -379,7 +379,7 @@
if (_nextIndex <= _str.length) {
var match = _re._ExecuteMatch(_str, _nextIndex);
if (match != null) {
- _current = new _RegExpMatch(_re, _str, match);
+ _current = new _RegExpMatch._(_re, _str, match);
_nextIndex = _current.end;
if (_nextIndex == _current.start) {
// Zero-width match. Advance by one more, unless the regexp
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 1099263..52d27db 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -945,10 +945,7 @@
@pragma("vm:entry-point")
class _OneByteString extends _StringBase {
- factory _OneByteString._uninstantiable() {
- throw new UnsupportedError(
- "_OneByteString can only be allocated by the VM");
- }
+ factory _OneByteString._uninstantiable() { throw "Unreachable"; }
@pragma("vm:exact-result-type", "dart:core#_Smi")
int get hashCode native "String_getHashCode";
@@ -1254,10 +1251,7 @@
@pragma("vm:entry-point")
class _TwoByteString extends _StringBase {
- factory _TwoByteString._uninstantiable() {
- throw new UnsupportedError(
- "_TwoByteString can only be allocated by the VM");
- }
+ factory _TwoByteString._uninstantiable() { throw "Unreachable"; }
static String _allocateFromTwoByteList(List<int> list, int start, int end)
native "TwoByteString_allocateFromTwoByteList";
@@ -1277,10 +1271,7 @@
@pragma("vm:entry-point")
class _ExternalOneByteString extends _StringBase {
- factory _ExternalOneByteString._uninstantiable() {
- throw new UnsupportedError(
- "_ExternalOneByteString can only be allocated by the VM");
- }
+ factory _ExternalOneByteString._uninstantiable() { throw "Unreachable"; }
bool _isWhitespace(int codeUnit) {
return _StringBase._isOneByteWhitespace(codeUnit);
@@ -1296,10 +1287,7 @@
@pragma("vm:entry-point")
class _ExternalTwoByteString extends _StringBase {
- factory _ExternalTwoByteString._uninstantiable() {
- throw new UnsupportedError(
- "_ExternalTwoByteString can only be allocated by the VM");
- }
+ factory _ExternalTwoByteString._uninstantiable() { throw "Unreachable"; }
bool _isWhitespace(int codeUnit) {
return _StringBase._isTwoByteWhitespace(codeUnit);
diff --git a/runtime/lib/type_patch.dart b/runtime/lib/type_patch.dart
index a05ce70..35ce89f 100644
--- a/runtime/lib/type_patch.dart
+++ b/runtime/lib/type_patch.dart
@@ -14,14 +14,26 @@
// Equivalent of RawType.
@pragma("vm:entry-point")
class _Type extends _AbstractType {
+ factory _Type._uninstantiable() {
+ throw "Unreachable";
+ }
+
@pragma("vm:exact-result-type", "dart:core#_Smi")
int get hashCode native "Type_getHashCode";
}
// Equivalent of RawTypeRef.
@pragma("vm:entry-point")
-class _TypeRef extends _AbstractType {}
+class _TypeRef extends _AbstractType {
+ factory _TypeRef._uninstantiable() {
+ throw "Unreachable";
+ }
+}
// Equivalent of RawTypeParameter.
@pragma("vm:entry-point")
-class _TypeParameter extends _AbstractType {}
+class _TypeParameter extends _AbstractType {
+ factory _TypeParameter._uninstantiable() {
+ throw "Unreachable";
+ }
+}
diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data_patch.dart
index 7af2181..7c563c4 100644
--- a/runtime/lib/typed_data_patch.dart
+++ b/runtime/lib/typed_data_patch.dart
@@ -40,14 +40,14 @@
factory ByteData(int length) {
final list = new Uint8List(length) as _TypedList;
_rangeCheck(list.lengthInBytes, 0, length);
- return new _ByteDataView(list, 0, length);
+ return new _ByteDataView._(list, 0, length);
}
// Called directly from C code.
@pragma("vm:entry-point")
factory ByteData._view(_TypedList typedData, int offsetInBytes, int length) {
_rangeCheck(typedData.lengthInBytes, offsetInBytes, length);
- return new _ByteDataView(typedData, offsetInBytes, length);
+ return new _ByteDataView._(typedData, offsetInBytes, length);
}
}
@@ -1907,14 +1907,14 @@
ByteData asByteData([int offsetInBytes = 0, int length]) {
length ??= this.lengthInBytes - offsetInBytes;
_rangeCheck(this._data.lengthInBytes, offsetInBytes, length);
- return new _ByteDataView(this._data, offsetInBytes, length);
+ return new _ByteDataView._(this._data, offsetInBytes, length);
}
Int8List asInt8List([int offsetInBytes = 0, int length]) {
length ??= (this.lengthInBytes - offsetInBytes) ~/ Int8List.bytesPerElement;
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Int8List.bytesPerElement);
- return new _Int8ArrayView(this._data, offsetInBytes, length);
+ return new _Int8ArrayView._(this._data, offsetInBytes, length);
}
Uint8List asUint8List([int offsetInBytes = 0, int length]) {
@@ -1922,7 +1922,7 @@
(this.lengthInBytes - offsetInBytes) ~/ Uint8List.bytesPerElement;
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Uint8List.bytesPerElement);
- return new _Uint8ArrayView(this._data, offsetInBytes, length);
+ return new _Uint8ArrayView._(this._data, offsetInBytes, length);
}
Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
@@ -1930,7 +1930,7 @@
Uint8ClampedList.bytesPerElement;
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Uint8ClampedList.bytesPerElement);
- return new _Uint8ClampedArrayView(this._data, offsetInBytes, length);
+ return new _Uint8ClampedArrayView._(this._data, offsetInBytes, length);
}
Int16List asInt16List([int offsetInBytes = 0, int length]) {
@@ -1939,7 +1939,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Int16List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Int16List.bytesPerElement);
- return new _Int16ArrayView(this._data, offsetInBytes, length);
+ return new _Int16ArrayView._(this._data, offsetInBytes, length);
}
Uint16List asUint16List([int offsetInBytes = 0, int length]) {
@@ -1948,7 +1948,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Uint16List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Uint16List.bytesPerElement);
- return new _Uint16ArrayView(this._data, offsetInBytes, length);
+ return new _Uint16ArrayView._(this._data, offsetInBytes, length);
}
Int32List asInt32List([int offsetInBytes = 0, int length]) {
@@ -1957,7 +1957,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Int32List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Int32List.bytesPerElement);
- return new _Int32ArrayView(this._data, offsetInBytes, length);
+ return new _Int32ArrayView._(this._data, offsetInBytes, length);
}
Uint32List asUint32List([int offsetInBytes = 0, int length]) {
@@ -1966,7 +1966,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Uint32List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Uint32List.bytesPerElement);
- return new _Uint32ArrayView(this._data, offsetInBytes, length);
+ return new _Uint32ArrayView._(this._data, offsetInBytes, length);
}
Int64List asInt64List([int offsetInBytes = 0, int length]) {
@@ -1975,7 +1975,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Int64List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Int64List.bytesPerElement);
- return new _Int64ArrayView(this._data, offsetInBytes, length);
+ return new _Int64ArrayView._(this._data, offsetInBytes, length);
}
Uint64List asUint64List([int offsetInBytes = 0, int length]) {
@@ -1984,7 +1984,7 @@
_rangeCheck(
this.lengthInBytes, offsetInBytes, length * Uint64List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Uint64List.bytesPerElement);
- return new _Uint64ArrayView(this._data, offsetInBytes, length);
+ return new _Uint64ArrayView._(this._data, offsetInBytes, length);
}
Float32List asFloat32List([int offsetInBytes = 0, int length]) {
@@ -1993,7 +1993,7 @@
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Float32List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Float32List.bytesPerElement);
- return new _Float32ArrayView(this._data, offsetInBytes, length);
+ return new _Float32ArrayView._(this._data, offsetInBytes, length);
}
Float64List asFloat64List([int offsetInBytes = 0, int length]) {
@@ -2002,7 +2002,7 @@
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Float64List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Float64List.bytesPerElement);
- return new _Float64ArrayView(this._data, offsetInBytes, length);
+ return new _Float64ArrayView._(this._data, offsetInBytes, length);
}
Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
@@ -2011,7 +2011,7 @@
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Float32x4List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Float32x4List.bytesPerElement);
- return new _Float32x4ArrayView(this._data, offsetInBytes, length);
+ return new _Float32x4ArrayView._(this._data, offsetInBytes, length);
}
Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
@@ -2020,7 +2020,7 @@
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Int32x4List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Int32x4List.bytesPerElement);
- return new _Int32x4ArrayView(this._data, offsetInBytes, length);
+ return new _Int32x4ArrayView._(this._data, offsetInBytes, length);
}
Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
@@ -2029,7 +2029,7 @@
_rangeCheck(this.lengthInBytes, offsetInBytes,
length * Float64x2List.bytesPerElement);
_offsetAlignmentCheck(offsetInBytes, Float64x2List.bytesPerElement);
- return new _Float64x2ArrayView(this._data, offsetInBytes, length);
+ return new _Float64x2ArrayView._(this._data, offsetInBytes, length);
}
}
@@ -2139,6 +2139,10 @@
@pragma("vm:entry-point")
class _Int8List extends _TypedList with _IntListMixin implements Int8List {
+ factory _Int8List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2181,6 +2185,10 @@
@pragma("vm:entry-point")
class _Uint8List extends _TypedList with _IntListMixin implements Uint8List {
+ factory _Uint8List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Methods implementing List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2225,6 +2233,10 @@
class _Uint8ClampedList extends _TypedList
with _IntListMixin
implements Uint8ClampedList {
+ factory _Uint8ClampedList._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Methods implementing List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2267,6 +2279,10 @@
@pragma("vm:entry-point")
class _Int16List extends _TypedList with _IntListMixin implements Int16List {
+ factory _Int16List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2328,6 +2344,10 @@
@pragma("vm:entry-point")
class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
+ factory _Uint16List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2389,6 +2409,10 @@
@pragma("vm:entry-point")
class _Int32List extends _TypedList with _IntListMixin implements Int32List {
+ factory _Int32List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -2438,6 +2462,10 @@
@pragma("vm:entry-point")
class _Uint32List extends _TypedList with _IntListMixin implements Uint32List {
+ factory _Uint32List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -2487,6 +2515,10 @@
@pragma("vm:entry-point")
class _Int64List extends _TypedList with _IntListMixin implements Int64List {
+ factory _Int64List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -2536,6 +2568,10 @@
@pragma("vm:entry-point")
class _Uint64List extends _TypedList with _IntListMixin implements Uint64List {
+ factory _Uint64List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -2587,6 +2623,10 @@
class _Float32List extends _TypedList
with _DoubleListMixin
implements Float32List {
+ factory _Float32List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
@pragma("vm:exact-result-type", "dart:core#_Double")
double operator [](int index) {
@@ -2639,6 +2679,10 @@
class _Float64List extends _TypedList
with _DoubleListMixin
implements Float64List {
+ factory _Float64List._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
@pragma("vm:exact-result-type", "dart:core#_Double")
double operator [](int index) {
@@ -2691,6 +2735,10 @@
class _Float32x4List extends _TypedList
with _Float32x4ListMixin
implements Float32x4List {
+ factory _Float32x4List._uninstantiable() {
+ throw "Unreachable";
+ }
+
@pragma("vm:exact-result-type", _Float32x4)
Float32x4 operator [](int index) {
if (index < 0 || index >= length) {
@@ -2742,6 +2790,10 @@
class _Int32x4List extends _TypedList
with _Int32x4ListMixin
implements Int32x4List {
+ factory _Int32x4List._uninstantiable() {
+ throw "Unreachable";
+ }
+
@pragma("vm:exact-result-type", _Int32x4)
Int32x4 operator [](int index) {
if (index < 0 || index >= length) {
@@ -2793,6 +2845,10 @@
class _Float64x2List extends _TypedList
with _Float64x2ListMixin
implements Float64x2List {
+ factory _Float64x2List._uninstantiable() {
+ throw "Unreachable";
+ }
+
@pragma("vm:exact-result-type", _Float64x2)
Float64x2 operator [](int index) {
if (index < 0 || index >= length) {
@@ -2831,6 +2887,10 @@
class _ExternalInt8Array extends _TypedList
with _IntListMixin
implements Int8List {
+ factory _ExternalInt8Array._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -2861,6 +2921,10 @@
class _ExternalUint8Array extends _TypedList
with _IntListMixin
implements Uint8List {
+ factory _ExternalUint8Array._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2892,6 +2956,10 @@
class _ExternalUint8ClampedArray extends _TypedList
with _IntListMixin
implements Uint8ClampedList {
+ factory _ExternalUint8ClampedArray._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
@pragma("vm:exact-result-type", "dart:core#_Smi")
int operator [](int index) {
@@ -2923,8 +2991,11 @@
class _ExternalInt16Array extends _TypedList
with _IntListMixin
implements Int16List {
- // Method(s) implementing the List interface.
+ factory _ExternalInt16Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -2962,8 +3033,11 @@
class _ExternalUint16Array extends _TypedList
with _IntListMixin
implements Uint16List {
- // Method(s) implementing the List interface.
+ factory _ExternalUint16Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3001,6 +3075,10 @@
class _ExternalInt32Array extends _TypedList
with _IntListMixin
implements Int32List {
+ factory _ExternalInt32Array._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
@@ -3039,8 +3117,11 @@
class _ExternalUint32Array extends _TypedList
with _IntListMixin
implements Uint32List {
- // Method(s) implementing the List interface.
+ factory _ExternalUint32Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3078,8 +3159,11 @@
class _ExternalInt64Array extends _TypedList
with _IntListMixin
implements Int64List {
- // Method(s) implementing the List interface.
+ factory _ExternalInt64Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3117,8 +3201,11 @@
class _ExternalUint64Array extends _TypedList
with _IntListMixin
implements Uint64List {
- // Method(s) implementing the List interface.
+ factory _ExternalUint64Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
int operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3156,8 +3243,11 @@
class _ExternalFloat32Array extends _TypedList
with _DoubleListMixin
implements Float32List {
- // Method(s) implementing the List interface.
+ factory _ExternalFloat32Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
double operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3195,8 +3285,11 @@
class _ExternalFloat64Array extends _TypedList
with _DoubleListMixin
implements Float64List {
- // Method(s) implementing the List interface.
+ factory _ExternalFloat64Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
double operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3234,8 +3327,11 @@
class _ExternalFloat32x4Array extends _TypedList
with _Float32x4ListMixin
implements Float32x4List {
- // Method(s) implementing the List interface.
+ factory _ExternalFloat32x4Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
Float32x4 operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3273,8 +3369,11 @@
class _ExternalInt32x4Array extends _TypedList
with _Int32x4ListMixin
implements Int32x4List {
- // Method(s) implementing the List interface.
+ factory _ExternalInt32x4Array._uninstantiable() {
+ throw "Unreachable";
+ }
+ // Method(s) implementing the List interface.
Int32x4 operator [](int index) {
if (index < 0 || index >= length) {
throw new RangeError.index(index, this, "index");
@@ -3312,6 +3411,10 @@
class _ExternalFloat64x2Array extends _TypedList
with _Float64x2ListMixin
implements Float64x2List {
+ factory _ExternalFloat64x2Array._uninstantiable() {
+ throw "Unreachable";
+ }
+
// Method(s) implementing the List interface.
Float64x2 operator [](int index) {
if (index < 0 || index >= length) {
@@ -3599,7 +3702,7 @@
implements Int8List {
// Constructor.
@pragma("vm:exact-result-type", _Int8ArrayView)
- factory _Int8ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Int8ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Int8ArrayView_new";
// Method(s) implementing List interface.
@@ -3636,7 +3739,7 @@
implements Uint8List {
// Constructor.
@pragma("vm:exact-result-type", _Uint8ArrayView)
- factory _Uint8ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Uint8ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Uint8ArrayView_new";
// Method(s) implementing List interface.
@@ -3673,7 +3776,7 @@
implements Uint8ClampedList {
// Constructor.
@pragma("vm:exact-result-type", _Uint8ClampedArrayView)
- factory _Uint8ClampedArrayView(_TypedList buffer, int offsetInBytes,
+ factory _Uint8ClampedArrayView._(_TypedList buffer, int offsetInBytes,
int length) native "TypedDataView_Uint8ClampedArrayView_new";
// Method(s) implementing List interface.
@@ -3710,7 +3813,7 @@
implements Int16List {
// Constructor.
@pragma("vm:exact-result-type", _Int16ArrayView)
- factory _Int16ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Int16ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Int16ArrayView_new";
// Method(s) implementing List interface.
@@ -3759,7 +3862,7 @@
implements Uint16List {
// Constructor.
@pragma("vm:exact-result-type", _Uint16ArrayView)
- factory _Uint16ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Uint16ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Uint16ArrayView_new";
// Method(s) implementing List interface.
@@ -3809,7 +3912,7 @@
implements Int32List {
// Constructor.
@pragma("vm:exact-result-type", _Int32ArrayView)
- factory _Int32ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Int32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Int32ArrayView_new";
// Method(s) implementing List interface.
@@ -3846,7 +3949,7 @@
implements Uint32List {
// Constructor.
@pragma("vm:exact-result-type", _Uint32ArrayView)
- factory _Uint32ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Uint32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Uint32ArrayView_new";
// Method(s) implementing List interface.
@@ -3883,7 +3986,7 @@
implements Int64List {
// Constructor.
@pragma("vm:exact-result-type", _Int64ArrayView)
- factory _Int64ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Int64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Int64ArrayView_new";
// Method(s) implementing List interface.
@@ -3920,7 +4023,7 @@
implements Uint64List {
// Constructor.
@pragma("vm:exact-result-type", _Uint64ArrayView)
- factory _Uint64ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Uint64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Uint64ArrayView_new";
// Method(s) implementing List interface.
@@ -3957,7 +4060,7 @@
implements Float32List {
// Constructor.
@pragma("vm:exact-result-type", _Float32ArrayView)
- factory _Float32ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Float32ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Float32ArrayView_new";
// Method(s) implementing List interface.
@@ -3994,7 +4097,7 @@
implements Float64List {
// Constructor.
@pragma("vm:exact-result-type", _Float64ArrayView)
- factory _Float64ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Float64ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Float64ArrayView_new";
// Method(s) implementing List interface.
@@ -4031,8 +4134,8 @@
implements Float32x4List {
// Constructor.
@pragma("vm:exact-result-type", _Float32x4ArrayView)
- factory _Float32x4ArrayView(_TypedList buffer, int offsetInBytes, int length)
- native "TypedDataView_Float32x4ArrayView_new";
+ factory _Float32x4ArrayView._(_TypedList buffer, int offsetInBytes,
+ int length) native "TypedDataView_Float32x4ArrayView_new";
// Method(s) implementing List interface.
Float32x4 operator [](int index) {
@@ -4068,7 +4171,7 @@
implements Int32x4List {
// Constructor.
@pragma("vm:exact-result-type", _Int32x4ArrayView)
- factory _Int32x4ArrayView(_TypedList buffer, int offsetInBytes, int length)
+ factory _Int32x4ArrayView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_Int32x4ArrayView_new";
// Method(s) implementing List interface.
@@ -4105,8 +4208,8 @@
implements Float64x2List {
// Constructor.
@pragma("vm:exact-result-type", _Float64x2ArrayView)
- factory _Float64x2ArrayView(_TypedList buffer, int offsetInBytes, int length)
- native "TypedDataView_Float64x2ArrayView_new";
+ factory _Float64x2ArrayView._(_TypedList buffer, int offsetInBytes,
+ int length) native "TypedDataView_Float64x2ArrayView_new";
// Method(s) implementing List interface.
Float64x2 operator [](int index) {
@@ -4139,7 +4242,7 @@
@pragma("vm:entry-point")
class _ByteDataView implements ByteData {
@pragma("vm:exact-result-type", _ByteDataView)
- factory _ByteDataView(_TypedList buffer, int offsetInBytes, int length)
+ factory _ByteDataView._(_TypedList buffer, int offsetInBytes, int length)
native "TypedDataView_ByteDataView_new";
// Method(s) implementing TypedData interface.
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index ffd7255..2116ba9 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -47,21 +47,21 @@
V(_ByteDataView, get:_typedData, ByteDataViewTypedData, 0x0) \
V(_TypedListView, get:offsetInBytes, TypedDataViewOffsetInBytes, 0x0) \
V(_TypedListView, get:_typedData, TypedDataViewTypedData, 0x0) \
- V(_ByteDataView, ., TypedData_ByteDataView_factory, 0x0) \
- V(_Int8ArrayView, ., TypedData_Int8ArrayView_factory, 0x0) \
- V(_Uint8ArrayView, ., TypedData_Uint8ArrayView_factory, 0x0) \
- V(_Uint8ClampedArrayView, ., TypedData_Uint8ClampedArrayView_factory, 0x0) \
- V(_Int16ArrayView, ., TypedData_Int16ArrayView_factory, 0x0) \
- V(_Uint16ArrayView, ., TypedData_Uint16ArrayView_factory, 0x0) \
- V(_Int32ArrayView, ., TypedData_Int32ArrayView_factory, 0x0) \
- V(_Uint32ArrayView, ., TypedData_Uint32ArrayView_factory, 0x0) \
- V(_Int64ArrayView, ., TypedData_Int64ArrayView_factory, 0x0) \
- V(_Uint64ArrayView, ., TypedData_Uint64ArrayView_factory, 0x0) \
- V(_Float32ArrayView, ., TypedData_Float32ArrayView_factory, 0x0) \
- V(_Float64ArrayView, ., TypedData_Float64ArrayView_factory, 0x0) \
- V(_Float32x4ArrayView, ., TypedData_Float32x4ArrayView_factory, 0x0) \
- V(_Int32x4ArrayView, ., TypedData_Int32x4ArrayView_factory, 0x0) \
- V(_Float64x2ArrayView, ., TypedData_Float64x2ArrayView_factory, 0x0) \
+ V(_ByteDataView, ._, TypedData_ByteDataView_factory, 0x0) \
+ V(_Int8ArrayView, ._, TypedData_Int8ArrayView_factory, 0x0) \
+ V(_Uint8ArrayView, ._, TypedData_Uint8ArrayView_factory, 0x0) \
+ V(_Uint8ClampedArrayView, ._, TypedData_Uint8ClampedArrayView_factory, 0x0) \
+ V(_Int16ArrayView, ._, TypedData_Int16ArrayView_factory, 0x0) \
+ V(_Uint16ArrayView, ._, TypedData_Uint16ArrayView_factory, 0x0) \
+ V(_Int32ArrayView, ._, TypedData_Int32ArrayView_factory, 0x0) \
+ V(_Uint32ArrayView, ._, TypedData_Uint32ArrayView_factory, 0x0) \
+ V(_Int64ArrayView, ._, TypedData_Int64ArrayView_factory, 0x0) \
+ V(_Uint64ArrayView, ._, TypedData_Uint64ArrayView_factory, 0x0) \
+ V(_Float32ArrayView, ._, TypedData_Float32ArrayView_factory, 0x0) \
+ V(_Float64ArrayView, ._, TypedData_Float64ArrayView_factory, 0x0) \
+ V(_Float32x4ArrayView, ._, TypedData_Float32x4ArrayView_factory, 0x0) \
+ V(_Int32x4ArrayView, ._, TypedData_Int32x4ArrayView_factory, 0x0) \
+ V(_Float64x2ArrayView, ._, TypedData_Float64x2ArrayView_factory, 0x0) \
V(::, _toClampedUint8, ConvertIntToClampedUint8, 0x564b0435) \
V(_StringBase, _interpolate, StringBaseInterpolate, 0x01ecb15a) \
V(_IntegerImplementation, toDouble, IntegerToDouble, 0x05da96ed) \