Skip to content

Commit ae721d7

Browse files
author
Dart CI
committed
Version 3.9.0-235.0.dev
Merge 6575655 into dev
2 parents 533af3e + 6575655 commit ae721d7

File tree

6 files changed

+41
-3
lines changed

6 files changed

+41
-3
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,9 @@ 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+
703706
/// Returns `true` member is the 'findIndexForNativeSubclassType' method
704707
/// declared in `dart:_interceptors`.
705708
bool isFindIndexForNativeSubclassType(MemberEntity member) {
@@ -1100,6 +1103,11 @@ abstract class CommonElements {
11001103
FunctionEntity get specializedAsStringNullable =>
11011104
_findRtiFunction('_asStringQ');
11021105

1106+
FunctionEntity get specializedAsJSObject => _findRtiFunction('_asJSObject');
1107+
1108+
FunctionEntity get specializedAsJSObjectNullable =>
1109+
_findRtiFunction('_asJSObjectQ');
1110+
11031111
FunctionEntity get instantiatedGenericFunctionType =>
11041112
_findRtiFunction('instantiatedGenericFunctionType');
11051113

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ 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+
195204
return null;
196205
}
197206
}

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

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,8 @@ 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);
13401342
}
13411343
} else {
13421344
if (_Utils.isIdentical(testRti, TYPE_REF<int>())) {
@@ -1349,6 +1351,8 @@ Object? _specializedAsCheck(Rti testRti) {
13491351
asFn = RAW_DART_FUNCTION_REF(_asNum);
13501352
} else if (_Utils.isIdentical(testRti, TYPE_REF<double>())) {
13511353
asFn = RAW_DART_FUNCTION_REF(_asDouble);
1354+
} else if (_Utils.isIdentical(testRti, TYPE_REF<JSObject>())) {
1355+
asFn = RAW_DART_FUNCTION_REF(_asJSObject);
13521356
}
13531357
}
13541358
return asFn;
@@ -1701,6 +1705,23 @@ String? _asStringQ(dynamic object) {
17011705
throw _TypeError.forType(object, 'String?');
17021706
}
17031707

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+
17041725
String _rtiArrayToString(Object? array, List<String>? genericContext) {
17051726
String s = '', sep = '';
17061727
for (int i = 0; i < _Utils.arrayLength(array); i++) {
@@ -3920,6 +3941,7 @@ class _Utils {
39203941
static Rti asRti(Object? s) => JS('Rti', '#', s);
39213942
static Rti? asRtiOrNull(Object? s) => JS('Rti|Null', '#', s);
39223943
static _Type as_Type(Object? o) => JS('_Type', '#', o);
3944+
static JSObject asJSObject(Object? o) => JS('', '#', o);
39233945

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

tests/standalone/standalone.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ dwarf_stack_trace_test: SkipByDesign # Due to instruction canonicalization we ca
9494
io/http_basic_test: Slow, Pass # Issue 28046, These tests might be slow on an opt counter threshold bot. They also time out on the bot occasionally => flaky test issue 28046
9595

9696
[ $system == macos && ($runtime == dart_precompiled || $runtime == vm) ]
97-
io/raw_secure_server_socket_test: Crash
98-
io/raw_server_socket_cancel_test: Skip # Issue 28182 # This test sometimes hangs on Mac.
9997
io/socket_many_connections_test: Skip # This test fails with "Too many open files" on the Mac OS buildbot. This is expected as MacOS by default runs with a very low number of allowed open files ('ulimit -n' says something like 256).
10098

10199
[ $compiler == dart2js || $compiler == dart2wasm || $compiler == ddc ]

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 3
2828
MINOR 9
2929
PATCH 0
30-
PRERELEASE 234
30+
PRERELEASE 235
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)