Skip to content

Commit 43b5c14

Browse files
rakudramaCommit Queue
authored andcommitted
Revert "[dart2js,rti] Add direct methods for as JSObject"
This reverts commit f35c922. Reason for revert: _isJSObject requires a full Rti. Bug: #60746 Original change's description: > [dart2js,rti] Add direct methods for `as JSObject` > > The specialized methods are generally smaller. > > Bug: #60746 > Change-Id: I1824bcded9312bb1ba1c3ecd11fe904de1eb32cc > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434142 > Reviewed-by: Mayank Patke <[email protected]> > Commit-Queue: Stephen Adams <[email protected]> > Reviewed-by: Nicholas Shahan <[email protected]> Bug: #60746 Change-Id: I26b8e25d50fe46f840ea4b3f6eda18524c41b84d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434901 Reviewed-by: Nicholas Shahan <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent c48dd51 commit 43b5c14

File tree

4 files changed

+0
-40
lines changed

4 files changed

+0
-40
lines changed

pkg/compiler/lib/src/common/elements.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,6 @@ abstract class CommonElements {
700700

701701
late final ClassEntity jsUInt31Class = _findInterceptorsClass('JSUInt31');
702702

703-
// Static interop JavaScript object interface class.
704-
late final ClassEntity jsObjectClass = _findInterceptorsClass('JSObject');
705-
706703
/// Returns `true` member is the 'findIndexForNativeSubclassType' method
707704
/// declared in `dart:_interceptors`.
708705
bool isFindIndexForNativeSubclassType(MemberEntity member) {
@@ -1103,11 +1100,6 @@ abstract class CommonElements {
11031100
FunctionEntity get specializedAsStringNullable =>
11041101
_findRtiFunction('_asStringQ');
11051102

1106-
FunctionEntity get specializedAsJSObject => _findRtiFunction('_asJSObject');
1107-
1108-
FunctionEntity get specializedAsJSObjectNullable =>
1109-
_findRtiFunction('_asJSObjectQ');
1110-
11111103
FunctionEntity get instantiatedGenericFunctionType =>
11121104
_findRtiFunction('instantiatedGenericFunctionType');
11131105

pkg/compiler/lib/src/js_backend/specialized_checks.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,6 @@ class SpecializedChecks {
192192
return commonElements.specializedAsInt;
193193
}
194194

195-
if (element == commonElements.objectClass) {
196-
if (!nullable) return commonElements.specializedAsObject;
197-
}
198-
199-
if (element == commonElements.jsObjectClass) {
200-
if (nullable) return commonElements.specializedAsJSObjectNullable;
201-
return commonElements.specializedAsJSObject;
202-
}
203-
204195
return null;
205196
}
206197
}

pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,6 @@ class FragmentEmitter {
19731973
commonElements.listClass,
19741974
commonElements.objectClass,
19751975
commonElements.mapClass,
1976-
commonElements.jsObjectClass,
19771976
];
19781977
// TODO(floitsch): this should probably be on a per-fragment basis.
19791978

sdk/lib/_internal/js_shared/lib/rti.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,8 +1337,6 @@ Object? _specializedAsCheck(Rti testRti) {
13371337
asFn = RAW_DART_FUNCTION_REF(_asNumQ);
13381338
} else if (_Utils.isIdentical(testRti, TYPE_REF<double?>())) {
13391339
asFn = RAW_DART_FUNCTION_REF(_asDoubleQ);
1340-
} else if (_Utils.isIdentical(testRti, TYPE_REF<JSObject?>())) {
1341-
asFn = RAW_DART_FUNCTION_REF(_asJSObjectQ);
13421340
}
13431341
} else {
13441342
if (_Utils.isIdentical(testRti, TYPE_REF<int>())) {
@@ -1351,8 +1349,6 @@ Object? _specializedAsCheck(Rti testRti) {
13511349
asFn = RAW_DART_FUNCTION_REF(_asNum);
13521350
} else if (_Utils.isIdentical(testRti, TYPE_REF<double>())) {
13531351
asFn = RAW_DART_FUNCTION_REF(_asDouble);
1354-
} else if (_Utils.isIdentical(testRti, TYPE_REF<JSObject>())) {
1355-
asFn = RAW_DART_FUNCTION_REF(_asJSObject);
13561352
}
13571353
}
13581354
return asFn;
@@ -1705,23 +1701,6 @@ String? _asStringQ(dynamic object) {
17051701
throw _TypeError.forType(object, 'String?');
17061702
}
17071703

1708-
/// Specialization for 'as JSObject'.
1709-
/// Called from generated code.
1710-
@pragma('dart2js:stack-starts-at-throw')
1711-
JSObject _asJSObject(Object? object) {
1712-
if (_isJSObject(object)) return _Utils.asJSObject(object);
1713-
throw _TypeError.forType(object, 'JSObject');
1714-
}
1715-
1716-
/// Specialization for 'as JSObject?'.
1717-
/// Called from generated code.
1718-
@pragma('dart2js:stack-starts-at-throw')
1719-
JSObject? _asJSObjectQ(Object? object) {
1720-
if (_isJSObject(object)) return _Utils.asJSObject(object);
1721-
if (object == null) return _Utils.asNull(object);
1722-
(throw _TypeError.forType(object, 'JSObject?'));
1723-
}
1724-
17251704
String _rtiArrayToString(Object? array, List<String>? genericContext) {
17261705
String s = '', sep = '';
17271706
for (int i = 0; i < _Utils.arrayLength(array); i++) {
@@ -3941,7 +3920,6 @@ class _Utils {
39413920
static Rti asRti(Object? s) => JS('Rti', '#', s);
39423921
static Rti? asRtiOrNull(Object? s) => JS('Rti|Null', '#', s);
39433922
static _Type as_Type(Object? o) => JS('_Type', '#', o);
3944-
static JSObject asJSObject(Object? o) => JS('', '#', o);
39453923

39463924
static bool isString(Object? o) => JS('bool', 'typeof # == "string"', o);
39473925
static bool isNum(Object? o) => JS('bool', 'typeof # == "number"', o);

0 commit comments

Comments
 (0)